sys_sched_getscheduler(9)
π sys_sched_getscheduler β from the Kernel API Manual, bestie β¨
Okay so picture this: you're deep in the kernel, you've got a thread, and you're dying to know what scheduling class it's vibing in. That's literally this whole function. It's sys_sched_getscheduler, and it's giving "just tell me the policy, no drama" energy. π
πΈ NAME πΈ
sys_sched_getscheduler β get the policy (scheduling class) of a thread. That's it. That's the whole job. π
β¨ SYNOPSIS β¨
long sys_sched_getscheduler (pid_t pid );
One argument, one return value, zero games. Slay.
π¦ ARGUMENTS π¦
pidβ the pid in question. Like, the specific one you're curious about. Drop the pid, get the tea. π«Ά
π RETURN π
On success? You get the policy of the thread. Iconic. The main character reveal. π
Otherwise? A negative error code. π Not the vibe, but at least it's honest about it. Ngl, negative error codes are lowkey the most relatable thing in the kernel β sometimes you just can't.
fr fr, check for that negative value before you start celebrating. It's giving "read the room."
π SEE ALSO π
The whole group chat, assembled. Grab a snack, this is a long guest list:
- Kernel file
./kernel/sched/syscalls.cβ the source, the origin story π task_prio(9)idle_cpu(9)idle_task(9)find_process_by_pid(9)sched_setscheduler(9)sched_setscheduler_nocheck(9)sys_sched_setscheduler(9)sys_sched_setparam(9)sys_sched_setattr(9)sys_sched_getparam(9)sys_sched_getattr(9)sys_sched_setaffinity(9)sys_sched_getaffinity(9)sys_sched_yield(9)yield(9)yield_to(9)sys_sched_get_priority_max(9)sys_sched_get_priority_min(9)sys_sched_rr_get_interval(9)
Basically every get has a matching set, and every scheduler function is somehow related to every other scheduler function. It's a whole ecosystem, bestie. π
Mwah π β this page lives in ./kernel/sched, and it's stamped October 2026. Go forth and query those policies, queen. πβ¨
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms