Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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

share|improve this 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
add comment

2 Answers

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.

share|improve this answer
    
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
add comment

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

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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