Linux Gets Completely Fair Scheduler
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."
just finished make xconfig;make from 2.6.22!
For the really touchy-feely OS out there!
Engineering is the art of compromise.
What sort of gain can the typical linux user expect because of this?
I had always been impressed with Linux's scheduler. The fact that it is getting better, just makes me happy.
--Insert Microsft Bash Here... not the CLI
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.
[
I've sort of gazed for a few seconds at the CFS articles and the following phrase caught my attention the most
But more importantly, I think the factor which'll probably sway me the most is /proc/sys/kernel/sched_granularity_ns. Except I've been salting my config options with one true test ... that kind of thing makes you paranoid about random tune-ups :)
Quidquid latine dictum sit, altum videtur
If you really want a rough time, see how long it takes to rebuild a different OS.
Engineering is the art of compromise.
Steal your insightful comments from http://linux.slashdot.org/article.pl?sid=07/04/22/ 1335255
Slashdot: news for Apple. Stuff that Apple.
Why does this sound like the title of a Monty Python Skit?
"Why isn't my process getting more CPU time?"
"Well, Sir, it's a Completely Fair Scheduler."
Computers are useless. They can only give you answers.
-- Pablo Picasso
really? and how it's suppose to do that wonderful thing?
ps: i'm just curious and noob, so please don't smash me...
Slashdot ya no es que lo era!
We saw crazy performance improvements implementing kqueue in bsd, would love to see something that great at handling many sockets standard linux.
I thought Linux used Cron as a scheduler ?
Computers are useless. They can only give you answers.
-- Pablo Picasso
This isn't really the same kind of component.
On the other hand, Linux has epoll, which fills the same role as kqueue.
In my experience, epoll is at least as good.
http://www.kegel.com/c10k.html#nb.epoll
Now MacOS X needs to fix their kqueue bugs, and the world will be a happy place.
Is there a default scheduler in the linux kernel? If so, which is it? Are there several schedulers to choose from? If so, which one(s) do the major distros use? Will the new CFS be the new default or just another choice?
CFS has been available for some time in Andrew Morton's -mm branch of the kernel. If you really want it now, just download his latest patch and there you go.
I've reen running with it for some time, and I really like it. I'm still not sure if it is better than Con Kolivas' SD scheduler in his patchset, but we'll see.
http://blindscribblings.com - Tasty pop-culture in conceptual fashion.
I thought Linux used Cron as a scheduler ?
You know, there is a difference between trolling and pointing out the flaws in your reasoning. Just saying.
I thought the design was pretty elegant. although in practice we've been having huge problems getting Linux to scale past 32 or so CPUs. partially the locking and partially because the scheduler is not smart enough to schedule complex workloads effectively that you see on huge SMP systems.
“Common sense is not so common.” — Voltaire
The only way to make it completely fair is to let one thread slice the time up, and let the other thread choose which slice it wants. ;-)
no, not the NT scheduler... "NT" stands for "no text," silly!
This comment intentionally left blank (except for this bit... and the bit above)
There's a shitty site called digg and several look-a-likes out there for people like you to feel power in the news others post. Go troll there.
You can't take the sky from me.
If you want an intelligent discussion, read the Linux Kernel mailing list. If you want infantile and sophomoric prattle, stay here.
I believe to expose multiple tasks to as much bandwidth as possible, fairly.
Isn't that kooky?
So does Linux reached the computer's communist's holy grail?
The new CPU scheduler should improve the desktop Linux experience, and will be part of the upcoming 2.6.23 kernel.
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.
"I had always been impressed with Linux's scheduler. The fact that it is getting better, just makes me happy."
I like the "No task left behind" scheduler too.
Of course, the next one will be the Completely Amazing Scheduler, followed by the Completely Wonderful Scheduler, followed by the Absolutely Perfect Scheduler, followed by the Even More Perfect Scheduler...
What version of KDE are you running?
I fear the Y2038 bug
What is it about us nerds/geeks that we like things to be completely fair?
Also, lately I've found that life is a lot less stressful when you stop worrying about things being fair or not; and stop worrying that you might have gotten the short end of the stick. Another thing-- all those dreams of grandiosity every nerd/geek has (wooing the beautiful girl, or being the life of a party, etc; but just can't seem to accomplish), you feel far more empowered to do them when you get a full night's sleep, as opposed to staying up running that instance again for the loot, and then being tired the next day. If you treat your school/college work like a game that you want to master (for a very real benefit I might add-- sure, being the best at Fourier transforms might not net you a top NSA job because the government network was brute-forced in 15 seconds by Megatron's minions, but there are more subtle ep33n enhancements that can add up to something similarly lofty in enough time) the point becomes to learn the material not just finish the problems and turn it in. Then you start getting 100's on tests and it feeds back into itself and you know if you want to accomplish something, you can. Then you have fun and try updating your clothing and hair style, and then when you're really cooking you start walking around like a badass because you know you are one. Quite fun actually. But you never get there if you don't learn to give up the petty things (fairness) that get under your skin for the bigger picture of learning to control your charisma.
I think I'll wait for the unbelievably fair scheduler, or perhaps the ridiculously fair scheduler.
Last time I looked, execution could not be preempted when in kernel mode. Has this changed yet?
So little credit is given to Con Kolivas, whose Staircase Deadline scheduler (a more mature and refined design than CFS) spurred Ingo to finally improve his scheduler (which he wrote on the spot because, apparently, Con's scheduler wasn't good enough for him).
And all Con gets is a minor footnote.
grey wolf
LET FORTRAN DIE!
A complete fair scheduler for geeks? I can just see it:
Crumb's Corollary: Never bring a knife to a bun fight.
This update seems to have come relatively soon after the O(1) scheduler (about a year?) which is relatively quick for changes to really important low-level parts of an operating system. Does this mean that the Linux community was relatively unhappy with the O(1) scheduler which was touted as a very good thing at the time?
(disclaimer, i'm the main author of CFS.)
I'd like to point out that CFS is O(1) too.
With current PID limits the worst-case depth of the rbtree is ~15 [and O(15) == O(1), so execution time has a clear upper bound]. Even with a theoretical system that can have 4 million tasks running at once (!), the rbtree depth would have a maximum of ~20-21.
The "O(1) scheduler" that CFS replaces is O(140) [== O(1)] in theory. (in practice the "number of steps" it takes to schedule is much lower than that, on most platforms.)
So the new scheduler is O(1) too (with a worst-case "number of steps" of 15, if you happen to have 32 thousand tasks running at once(!)), and the main difference is not in the O(1)-ness but in the behavior of the scheduler.
I think I speak for geeks everywhere when I say that I'd rather have the beautiful girl wooing me!
Good, inexpensive web hosting
Lets move the timeslices to ring 0 for graphics.. yeah yeah.. then all of the robust file sharing and stuff will slow down, but hey! we can make the gui more responsive..
On a more serious note, this could be cool, especially if system tasks get lower priority in favor of user defined ones, for HPC this could be alright..
The Ludicrously Fair Scheduler!
http://outcampaign.org/
"start checking on the cd writing process more frequently than the taskbar process..."
So how many nanoseconds does it take to ask the taskbar if it wants any CPU?
I can't imagine it making a "very noticable" difference. More like 0.1%
No sig today...
Complete rewrite of scheduler, again? Check.
Catchy new name? Check.
Promises that it's much better than the last scheduler? Check.
What, you're trying to tell me that complex heuristics to try to determine the "interactiveness" of processes wasn't the peak of scheduler technology?
I eagerly await the next grand rewrite when something else comes up that they didn't think through. My bets are that it will be the interdependency of I/O scheduling and CPU scheduling: what good is giving a process the CPU if it's swapped out? The VM system is going to immediately try to swap it back in, and switch to another task when this happens, and if memory is short to begin with this will just thrash, thrash, thrash (I'm sure everyone has experienced this at one time or another).
Can't wait for the "Completely Awesome Knows-About-I/O Scheduler."
"All process are equal, but some are more equal than others."
As an amd64 owner who's been taken aback by the very long-standing disk IO crisis:
http://bugzilla.kernel.org/show_bug.cgi?id=7372
I'm curious how this new scheduler may help/hurt me?
Deadline appears to help the problem, albeit not fix the root cause.
And is there any kind of disk IO scheduling work going on to help this in the future?
I'm really not sure why amd64 would be so broken while x86 is not. (IOMMU?)
Next up: equal time for processes that produce no tangible result. Soon Linux will run like the bloated bureaucratic nightmare that is the USA.
Anti-Globalism
Ingo Molnar is the worst kind of loser: an attention whore. His O(1) scheduler turned out to be a piece of crap and Con Kolivas spent a considerable amount of time implementing a better solution: Staircase Deadline (SD). The SD scheduler is a well tested, good performing scheduler and just when you think its going to be merged into Linus' kernel and replace Ingo's O(1) turd (and remove Ingo's name from some "important" files), Igno spends a couple of days reimplementing SD. I guess he wont be getting his name deleted after all!
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.
You can download it here. Screenshots here.
Weaselmancer
rediculous.
Too bad that the NIH syndrome hit Linux Kernel development too, and Ingo Molnar, after blocking all the attempts to merge SD into mainline because "it couldn't be done", uses the same idea, whips out his own scheduler calling it "Completely Fair", and woosh it gets merged (easily, given that Ingo Molnar himself is the maintainer of that part of the kernel).
Con Kolivas is (obviously and justifiably) disgruntled, to say the least, he stops working on the SD project, and Linux loses an excellent developer because of politics.
"I'm never quite so stupid as when I'm being smart" (Linus van Pelt)
You, sir, are trolling. You are trying to bring up a GNOME vs KDE flamewar by posting "facts" that are exactly the opposite of what happens in reality. In most Linux distributions, GNOME outperforms KDE. The only exception might be SuSE that has a bloated version of GNOME and a bloated but slightly more optimized version of KDE. But if you compare other distributions like Ubuntu, Fedora, Red Hat, Debian and others, you will probably find that GNOME is more responsive than KDE. Thanks for the troll!
Then there's the American Dream sheduler where you get priority if you work hard at it. You can't just inheret your priority like some rich child process.
Engineering is the art of compromise.
First off, let's state that the typical Linux user is using Linux in an embedded form and does not even know they are running Linux. The hardware they are using probably will get no benefit from this new scheduling policy. A lot of systems will get far more benefit from the realtime patches that provide priority inheretance etc (ie a decidely unfair scheduler).
Engineering is the art of compromise.
More responsive and still very 'thinclient-like'
Well, given that he is the maintainer, Ingo Molnar's code is presumably more maintainable. It happens all the time in free software projects, someone submits a patch, the idea in the patch is good, but the section of the code is important enough that the maintainer must be certain he understands it. Rewriting it is a good way to gain such understanding.
Back when I was a maintainer, I guess I rewrote half the patches I got. Most submitters are just happy to see the functionality in there, but there was a few people with fragile egos take it as a personal insult That happens, life goes on, and usually the fragile egos grow more robust with time, and learn that developing what amounts to a prototype of the final code is also a valuable contribution.
Suppose that tasks are placed in a linked list, and there are two lists: the runnable tasks and the blocked tasks.
Now suppose that we have two tasks: task A that consumes the CPU 100% and task B which is I/O bound and consumes 50% of the CPU (as per your example).
In the round-robin algorithm, each scheduled task is placed at the end of the list of runnable tasks, so other tasks get a fair chance of running.
When Task B is ready to run (because its data arrived from the network or hard disk, for example), it is removed from the list of blocked tasks and placed at the end of the list of runnable tasks.
Under the above setup, Task B will consume 50% of the CPU time, forcing task A to consume 50% as well, because ready tasks are placed at the end of the runnable queue.
Here is an example (assuming T is a scheduler time step):
step 1: task A runs for T; task B becomes ready at T/2
step 2: task B runs and becomes blocked at T/2; task A is ready
step 3: task A runs for T; task B becomes ready at T/2
step 4: task B runs and becomes blocked at T/2; task A is ready
step 5: task A runs for T; task B becomes ready at T/2
etc
So under this simple round-robin setup, each task gets 50% of the CPU, with one of the tasks waiting for 50% of the time and the other task not waiting at all.
So why isn't a round-robin algorithm fair like CFS?
Harsh as it may sound, this comment is really insightful.
His approach for years was to knock all contributions that improved on his earlier code so that they didn't get into the kernel. And now suddenly he sees the light and gathers up all those ideas of others into a new version as if it were novel, totally forgetting that he had rejected them before. And to compound the problem, his quick rehash then immediately gets merged in despite being effectively untested.
If this were business or politics, "corrupt" would describe this state of affairs quite adequately.
For all the talk of code merging based on merit, what we really have in the kernel is an old boys' club in which the inner circle get a free pass even when they deliver crap, as in this case.
Ingo's CFS code is utterly immature and bug-ridden, and should not have been merged. Since he accepts that Con's SD is a great idea, and as it has the benefit of a lot of testing and code maturity, Ingo should have backed its incorporation into the kernel, instead of opposing it.
But no, then it wouldn't bear Ingo's name on it, which would be total anathema to Ingo.
This is a bad state of affairs folks.
$ iokctrl -set-sched=ingo /proc/system/sched/policy /proc/system/sched/policy
$ cat
ingo
Bad interactivity!!!
$ iokctrl -set-sched=ckolivas
$ cat
ckolivas
Good interactivity!!!
Maybe... but be nice, because chances are you work for one of us.
Instead of fixing the software for "emerging" hardware, why not fix the system for the hundreds of millions of installed systems! Until problems such as these are fixed Linux is a toy from a power desktop user standpoint.
Redhat/fedora at least are reknowned for crippling their KDE packages in one way or another (usually with their own "bluecurve" theme that is dog-slow and other idiocies). Debian's KDE packages are alright (and on my system at least on a par with GNOME in speed).
Rejecting someone else's idea for years and then turning around and implementing it yourself is textbook move I've seen for years and years in a research environment. I hope you understand how vile that is, you arrogant son of a bitch. You are overly protective of the code you write and refuse to listen to other smart people's views until it is overwhelming, then you go around and make your own version, and stick it in the main codeline because you have total control over it.
Really classy. No wonder everyone thinks you're an asshole.
"Hello. My name is Ingo Molnar. You killed my task. Prepare to die."
Is this scheduler aware of disk hog processes, so such processes will get throttled enough to share the disk with more important activity (such as swap activity)?
Just curious what sort of bugs are present in OS X's kqueue?
Again just curious. No flaming intended.
The big ones that come to mind are broken support for TCP_NOPUSH:a rch/002024.html
..and the fact that it can't be used with stdin:p r/msg00072.html
http://lists.danga.com/pipermail/memcached/2006-M
http://lists.apple.com/archives/darwin-dev/2006/A
The latter in particular is super irritating, at least to me.
I have to see any decent-sized project using events that didn't need Mac OS-specific configuration.
Because when you prelink the binaries the wrong way, apps get faulty and SLOW. Like they take minutes to load. (Then we have to update glibc, so everything gets revdep-rebuilt anyway...)
Making laws based on opinions that stem up from false informations leads to witch hunts.
Smily time! :) =) :) =)
;) :*
Also: