Linux Gets Completely Fair Scheduler 274
SchedFred writes "KernelTrap is reporting that CFS, Ingo Molnar's Completely Fair Scheduler, was just merged into the Linux kernel. The new CPU scheduler includes a pluggable framework that completely replaces Molnar's earlier O(1) scheduler, and is described to 'model an "ideal, precise multi-tasking CPU" on real hardware. CFS tries to run the task with the "gravest need" for more CPU time. So CFS always tries to split up CPU time between runnable tasks as close to "ideal multitasking hardware" as possible.' The new CPU scheduler should improve the desktop Linux experience, and will be part of the upcoming 2.6.23 kernel."
Process Neutrality? (Score:5, Interesting)
I know enough about process scheduling to fill a ketchup cup at the nearest burger joint, but it struck me that this sounds like the debate about "network neutrality" vs "tiered service." The O(1) was supposed to be a very generic decision-making system that made a decision in a very agnostic way (to simplify the work down to a predictable consistent order of work). This CFS strikes me as a system which will have a much higher level of complexity and context awareness, which sounds like some processes will get more than others. The intention is to make it fair in the real world but not necessarily balanced, since not all processes are alike in their needs or expectations of task switching.
This is just rambling on, and admittedly it may be straining a metaphor too far, so don't go crazy biting my head off for not knowing all things about the kernel. See 'ketchup cup' above.
Can anyone compare this to Jonathan Lemons Kqueue? (Score:4, Interesting)
We saw crazy performance improvements implementing kqueue in bsd, would love to see something that great at handling many sockets standard linux.
Questions (Score:2, Interesting)
Improve how? (Score:3, Interesting)
Could someone outline concrete problem the Linux desktop scheduling had right now that are visible resolved by CFS.
I'm not a heavy user of Linux desktop (just servers on the shell), but it was always my experience that Linux handles simultaneous multimedia tasks (for example) better on the same hardware than Windows.
While I contribute this more to architectural problem on the Windows side (such as.. it's quite easy an app to stall Explorer.exe or vice versa, no amount of scheduling helps there), I'm curious to see if there's tangible difference someone could describe with CFS running desktop software in Linux.
Re:Cool (Score:2, Interesting)
Of course these applications have had years of tuning under SOlaris so it's not an entirely accurate example...
Re:how it's possible? (Score:4, Interesting)
Actually, no, Gnome and KDE aren't the troublemakers. It turns out that certain X drivers are poorly written and X preempts processes vying for CPU. CFS helps improve the situation - almost to the point where you don't notice it.
Re:crap (Score:4, Interesting)
Re:CFS vs. O(1) (Score:2, Interesting)
Maybe I'm remembering the worst case behaviour of rbtree wrong.
Re:Process Neutrality? (Score:3, Interesting)
The analogy with a tiered internet is fine, provided you look back far enough in the history of computers.
Before personal computers became common, people got a lot of their work done by renting time on mainframes. People that wanted cheap CPU cycles had their jobs wait for spare cycles. Those that needed immediate answers paid more and their jobs got a higher priority.
In essence some people paid more for lower latency while others that could wait got a discount.
Re:Neato (Score:5, Interesting)
Re:Improve how? (Score:3, Interesting)
If I run 50 processes that are spinning, each one of them will get just as much CPU time as the realtime process. How is CFS going to protect that realtime process from starvation?
Re:crap (Score:5, Interesting)
Oh, and the abusive app that likes to make X servers choke? Firefox. Ugh. Hate that thing.
This is politics, not programming (Score:4, Interesting)
This shows the black side of open source. Con developed SD in the open and Igno stole his ideas. It was only after people started pointing out that CFS looked _very_ similar to SD that Igno even admitted that the design was based on Con's SD work.
The only reason CFS is in the kernel and not SD is politics.
Re:CFS vs. O(1) (Score:4, Interesting)
Re:how it's possible? (Score:2, Interesting)
> that sleeps/runs 50% of the time - both will get 50% of the CPU in CFS. Under the strict 'runner
> fairness' approach (which for example SD is following), the 100% CPU hog would get ~66% of CPU time,
> the sleeper would get ~33% of CPU time.
Just a thought - have you considered using the golden ratio instead of basic proportions? Is it feasible/viable?
(http://en.wikipedia.org/wiki/Golden_ratio)
Disclaimer: I haven't the first clue about kernel internals, let alone scheduling.
However, my complete lack of knowledge of such things, this problem seems somewhat analogous to location of maxima/minima in real data. In that application, bracketing & bisection via golden ratio provides the fastest convergence (faster than equal bisection).
If CFS proves to be good, then perhaps such an approach (i.e. phi-weighting, in *favour* of sleeping processes?) would provide the optimal solution.
I'd be interested in your thoughts.
Conrad
Re:crap (Score:3, Interesting)
Well, maybe you just need to learn how to code write efficient Qt code then... Qt is not the fastest UI library on earth, but it is *not* 'slow as molasses'. We use it on hardware ranging from Pentium-II@500Mhz, to UltraSparcII@400Mhz to dual Opterons, and even on the lowest-end hardware it works fine.
Why, by the way, would you want to log data into a Qt table a few times a second? Do you seriously expect people to 'read the table' *a few times a second*. Don't you think data aggregation and lazy posting to the table would be a better idea for *any* GUI toolkit. You just sound like blame your own incompetence in GUI programming on Qt.
Re:Cool (Score:3, Interesting)
I do hope this scheduler will make things even better: gracefull degrading and responsiveness in one. Might make it the ideal OS for my needs (I now have Linux on the desktop and FreeBSD on the servers).
Re:Ok, here's your Microsoft bash (Score:2, Interesting)
I've found Cygwin and PuTTYcyg [gccaz.edu] configured with Consolas 11pt [imageshack.us] gives a quite usable CLI on Windows. My favourite terminal emulator is definitely Terminal.app [imageshack.us] though.
Re:how it's possible? (Score:2, Interesting)
Re:crap (Score:3, Interesting)
"In this version, Inkscape starts using the cairo library for rendering. It is now used for outline mode display which, thanks to using cairo and other optimizations, redraws faster by about 25%. More impressive are memory savings: thanks to cairo, in outline mode Inkscape now takes only about 50% of the memory used by 0.45 for the same file."