BFS vs CFS: Some personal observations on Linux Kernel performance
"Scheduler" is a time-resource-manager (task scheduler) who determines which process and how much it employs the processor (CPU) of the computer. The official scheduler of the Linux kernel is the CFS.
In the past, I made several experiments (benchmarks) to see if I could find any noticeable difference in performance of my system by optimizing the kernel and changing the scheduler. The results of the experiments did not give me any reasonable grounds for the necessity of optimizing the Linux Kernel, let alone to change the scheduler of the kernel on modern machines.
Nevertheless I continued to use a Linux Kernel with the BFS scheduler (see my article here : [Greek] Optimizing Ubuntu Linux Kernel with BFS - BFQ ) and of course to optimize the kernel according the specs of my machine.
But yesterday, something really unexpected happened and I saw before my eyes the huge difference in performance that can give a Linux Kernel scheduler not only to an old PC but also to a modern PC with 4GB DDR3 RAM and a Intel i7 Quad Core CPU !!
Completely Fair Schedule (CFS):
To quote Wikipedia "The Completely Fair Scheduler is the name of a task scheduler which was merged into the 2.6.23 release of the Linux kernel. It handles CPU resource allocation for executing processes, and aims to maximize overall CPU utilization while also maximizing interactive performance."
CFS is the standard scheduler for Android. As such it is compatible with all apps and processes run in Android
Brain FUCK Scheduler (BFS):
To quote Mr. Con Kolivas, the writer of BFS "BFS is the Brain Fuck Scheduler. It was designed to be forward looking only, make the most of lower spec machines, and not scale to massive hardware. ie it is a desktop orientated scheduler, with extremely low latencies for excellent interactivity by design rather than "calculated", with rigid fairness, nice priority distribution and extreme scalability within normal load levels."
Google looked at BFS to use as the Android scheduler but decided that it wasn't mature enough yet.
In this experiment I used a 1,6 GB video file (.MOV) 40 minutes long and started to render it on 720p resolution. The system had the same Uptime and same conditions. The screenshot where taken on the same percentage so that we can have a fair measurement on "estimated completion time".
I repeated this experiment for about 10 times, keeping the same conditions and it gave me the same results.
Now this is what I got :
As you can see with the BFS scheduler the "Job" will be completed in half of the time that CFS needs. One observation that can not be seen in a picture is that with BFS the CPU had a constant and steady 98-100% CPU utilization, in contrast with CFS the CPU utilization was dropping from time to time to 25%.
A "must read" paper for a Scientific measurements of CFS vs BFS : Scientific approach to the CFS vs BFS
What are your observations ? Do you use the BFS scheduler or the CFS ?