What are the difference between FreeBSD scheduler and Linux Scheduler ?
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With