8

This question already has an answer here:

I.e. is it the O(1) scheduler, the CFS scheduler, or an older one?

marked as duplicate by goldilocks, terdon, slm, Ramesh, Braiam Apr 29 '14 at 15:30

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • Which OS are you asking about? – Karlson Apr 17 '12 at 14:42
  • I assume you're talking about Linux? I don't think there's any other unix variant with these scheduler names. – Gilles Apr 17 '12 at 23:39
  • It's a linux variant: RHEL – daveb Apr 18 '12 at 10:55
3

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.

  • That'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). – Mikel Apr 17 '12 at 15:27
  • Yes. That's why the second and following sentences of my answer are there! – James Youngman Apr 18 '12 at 8:38
0

The scheduler of a process can be defined by the programmer, using this funcion man sched_setscheduler

to see the scheduler uses by a process you can use the top command

for change the scheduler of a procces chrt

  • The 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 – Jaime Aug 26 '17 at 16:55

Not the answer you're looking for? Browse other questions tagged or ask your own question.