5

What are the difference between FreeBSD scheduler and Linux Scheduler ?

1
  • 2
    This is off-topic for StackOverflow. Probably more appropriate to post this question on Unix & Linux.
    – Graham
    Commented Feb 27, 2013 at 15:13

1 Answer 1

14

There are several schedulers available. This answer assumes the default schedulers: CFS (Linux) and ULE (FreeBSD).

CFS is short for Completely Fair Scheduler. The most notable difference is that CFS is not based on run queues for process selection. Instead, it uses a red-black tree with O(log N) complexity that is indexed by CPU time spent.

Another notable detail is that CFS uses nanoseconds for its time accounting. From Kernel Trap:

CFS uses nanosecond granularity accounting and does not rely on any jiffies or other HZ detail. Thus the CFS scheduler has no notion of 'timeslices' and has no heuristics whatsoever. There is only one central tunable:

  /proc/sys/kernel/sched_granularity_ns

which can be used to tune the scheduler from 'desktop' (low latencies) to 'server' (good batching) workloads. It defaults to a setting suitable for desktop workloads. SCHED_BATCH is handled by the CFS scheduler module too.

ULE is the successor to the traditional BSD scheduler. It offers much improved performance on SMP systems as well as uniprocessor systems. It follows a more traditional design with run queues and time slices. It strives to be fair, but can be instructed to favor interactive processes.

Here's a link to some findings by the author of ULE while studying CFS source. They also discuss the complexity (which has been heavily debated) of the algorithms in the CFS scheduler in the comments.

Both schedulers are suitable for desktop use. With kern.sched.interact set, ULE favors interactive processes. Without it, CFS and ULE should be equally fair.

ULE lands at roughly 3000 lines of code, while CFS is pushing close to the double of that.

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