How can you determine which process scheduler is being used?
10,572
You can call sched_getscheduler(process_pid)
to determine the scheduling policy for a process.
If /sys/kernel/uids
exists, you have CFS. Or you could try
[[ -n $(awk '$3 == "load_balance_fair" {print;}' < /proc/kallsyms) ]] &&
echo CFS
I'm not sure how you could distinguish the O(1) scheduler from other obsolete schedulers. You could use the kernel version I suppose, but since distributions applied patches to their shipped kernels, this will be unreliable.
Related videos on Youtube
Author by
daveb
Updated on September 18, 2022Comments
-
daveb over 1 year
I.e. is it the O(1) scheduler, the CFS scheduler, or an older one?
-
Karlson about 12 yearsWhich OS are you asking about?
-
Gilles 'SO- stop being evil' about 12 yearsI assume you're talking about Linux? I don't think there's any other unix variant with these scheduler names.
-
daveb about 12 yearsIt's a linux variant: RHEL
-
-
Mikel about 12 yearsThat's what I thought at first, but it looks like the return value from
sched_getscheduler
doesn't tell you which process scheduler is being used, just what scheduling policy is being used for the current process (essentially: normal/batch/realtime/low priority). -
Batfan about 12 yearsYes. That's why the second and following sentences of my answer are there!
-
Jaime over 6 yearsThe
sched_setscheduler
allows a program to define parameters for the scheduler. It is not selecting which scheduler O(1) or CFS the linux is using. Nowadays, since kernel 2.6.23, the official kernel uses the CFS scheduler -- You may check man7.org/linux/man-pages/man2/sched_setscheduler.2.html