Slashdot Mirror


Con Kolivas Returns, With a Desktop-Oriented Linux Scheduler

myvirtualid writes "Con Kolivas has done what he swore never to do: returned to the Linux kernel and written a new — and, according to him — waaay better scheduler for the desktop environment. In fact, BFS appears to outperform existing schedulers right up until one hits a 16-CPU machine, at which point he guesses performance would degrade somewhat. According to Kolivas, BFS 'was designed to be forward looking only, make the most of lower spec machines, and not scale to massive hardware. i.e. [sic] 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.'"

36 of 333 comments (clear)

  1. BFS is the Brain Fuck Scheduler. by Anonymous Coward · · Score: 5, Interesting

    Why would the summary omit this precious bit of information?

    1. Re:BFS is the Brain Fuck Scheduler. by Fizzl · · Score: 4, Informative

      from the dare-not-speak-its-name dept.

    2. Re:BFS is the Brain Fuck Scheduler. by Swizec · · Score: 4, Funny

      Great, now when someone mentions BFS I won't be able to just assume Breadth First Search.

      Another one for the Geeks-are-great-at-naming-things wall.

  2. great news by amn108 · · Score: 5, Interesting

    Great news :-) Now, will the kernel people with Mr. Torvalds at their head, restart the whole debate on pluggable schedulers. Since his scheduler, as he says, degrades beyond 16 CPUs, better options already exists for servers where I am guessing CFS is used. So, he may be back, but the road ahead is still as steep?

    1. Re:great news by s4m7 · · Score: 5, Insightful

      I think that's only going to be a good thing, because IMO the arguments against pluggable schedulers are weak. "we need the few people working on this to just make the core better for ALL CASES" is about the most valid i've heard, but linux is too broadly applied to force it to meet all cases. realtime, embedded, servers, desktop: i just don't think one scheduler can be shoehorned to maximize performance for all those. You wind up with a crippled scheduler that really only achieves maximum performance in at most one of those four domains. And the question of there being enough developer minds working on it? you can bet that more commercial enterprise will start throwing money at it when they can customize it for their domain.

      It's like the dynamic syscall argument in a way. without dynamic syscalls, the argument goes, all the 'fringe functionality' people have to think harder and have to integrate their stuff into the current syscalls/drivers/subsystems. (apologies ingo) however, without dynamic syscalls, all the "middle of the road" functionality people like hardware manufacturers, are unwilling to release drivers that they essentially have to ask customers to compile as a supported option.

      Both, IMO are cases of cutting off your leg to spite your foot.

      --
      This comment is fully compliant with RFC 527.
    2. Re:great news by MrNaz · · Score: 5, Insightful

      I think anyone who cares and knows anything about this debate is hoping Linus sees the light and allows work to begin on pluggable schedulers. There are no definitive arguments against having pluggable schedulers, and plenty of formidable ones for them. I never really understood Linus' handling of Con in the past, I really hope that, this time round, the new BFS is given a fair assessment, and if it's found to be better under desktop use patterns, adopted for use in desktop distros.

      The idea that the Nokia N900 smartphone uses the same process scheduler as my now-dated laptop as well as my 8 core server is just silly.

      --
      I hate printers.
    3. Re:great news by TheRaven64 · · Score: 4, Interesting

      Why does Linux not have pluggable schedulers already? You can choose the scheduler in FreeBSD by changing a compile-time option and in OpenSolaris and Xen by changing a boot-time parameter. I think HURD can swap them out at run time, but I only know one person who actually runs HURD, and he also runs other systems for real work. If your system already has clean interfaces for the scheduler, then making them pluggable at compile time is trivial and making them pluggable at boot time is only a small amount of effort (although a bit more to make sure this has no performance side-effects). If it doesn't already have clean interfaces to the scheduler, then it probably has more serious problems than the lack of plug-support.

      --
      I am TheRaven on Soylent News
    4. Re:great news by gbjbaanb · · Score: 4, Interesting

      OOh. I've just seen the 'thought for the day' at the bottom of the page:

      "One size fits all": Doesn't fit anyone.

      Even the gods of slashdot are getting in on the debate.

    5. Re:great news by macshit · · Score: 4, Interesting

      I never really understood Linus' handling of Con in the past

      Linux kernel development is all about "playing well with others": a very important part of the process is being able to handle criticism constructively and fix the problems it addresses, or show that it is wrong; that's the way progress is made. You need to do this again and again and again. Most criticism is very technical and can be quite insightful, but can also be strong and relentless -- people will point out every single little flaw, and possible flaws, and unclear points, and whitespace inconsistencies, and... To be a successful linux developer you need to be able to deal with this constructively, and the more important and core the area you're dealing with, the more important this becomes.

      The impression I've gotten from reading various past "Con threads", is that while he tries in the beginning, Con doesn't deal well with this process; he can't keep his ego submerged, gets frustrated, and everything (perhaps including Con himself last time I read one of these threads) ends up unravelling. The same thing has derailed other big projects too (i.e., reiser4, when Reiser himself was still involved).

      It's a shame when this happens, but basically the process is more important that specific pieces of technology -- technology can be replaced, but the process is what makes linux as good as it is.

      --
      We live, as we dream -- alone....
    6. Re:great news by Anonymous Coward · · Score: 3, Funny

      The sic is forward looking...

      - Peder

    7. Re:great news by pthisis · · Score: 4, Informative

      The impression I've gotten from reading various past "Con threads", is that while he tries in the beginning, Con doesn't deal well with this process; he can't keep his ego submerged, gets frustrated, and everything (perhaps including Con himself last time I read one of these threads) ends up unravelling.

      Agreed; Con seems not to be able to work well in the process.

      e.g. Ingo ran a bunch of benchmarks on BFS and made a long post to LKML explaining his results, that, while critical of its performance on a series of benchmarks, bent over backwards to be very polite in tone, with things like:

      First and foremost, let me say that i'm happy that you are hacking the Linux scheduler again. It's perhaps proof that hacking the scheduler is one of the most addictive things on the planet ;-) ...

      General interactivity of BFS seemed good to me - except for the pipe test when there was significant lag over a minute. I think it's some starvation bug, not an inherent design property of BFS, so i'm looking forward to re-test it with the fix. ...
      I hope to be able to work with you on this, please dont hesitate sending patches if you wish - and we'll also be following BFS for good ideas and code to adopt to mainline.

      And Con responded with a very defensive and confrontational tone:
      I'm not interested in a long protracted discussion about this since I'm too busy to live linux the way full time developers do, so I'll keep it short, and perhaps you'll understand my intent better if the FAQ wasn't clear enough.

      Do you know what a normal desktop PC looks like? No, a more realistic question based on what you chose to benchmark to prove your point would be: Do you know what normal people actually do on them?

      Feel free to treat the question as rhetorical.

      Full exchange here:
      http://thread.gmane.org/gmane.linux.kernel/886319

      --
      rage, rage against the dying of the light
  3. Glory! by CAIMLAS · · Score: 5, Interesting

    May I be the first to say "amen"? I've been very dissatisfied with the 2.6 kernel and its schedulers on the desktop, CFS in particular. CFS seems entirely braindead for desktop use compared to the older schedulers in 2.4 and yes, even 2.2.

    A desktop machine needs to be, first and foremost, responsive. If it isn't, it's comparable to the cursor freezing and input taking several seconds to appear: on today's hardware, one might start to think "hey, did it freeze on me?" - completely unacceptable.

    Maybe it can be chalked up to the non-priority of X and video at the kernel level; I don't know. Whatever it is, it used to be better, on very pathetic (133MHz) hardware, while doing a lot more (and when such hardware was not all that powerful anymore, as well).

    My question is: is it in the kernel tree yet? Is this that 2.6.31 scheduler change I heard about earlier yesterday, or is it something Completely Different?

    Oh yeah, and which other scheduler's, if any, did this guy write?

    --
    ~/ssh slashdot.org ssh: connect to host slashdot.org port 22: too many beers
    1. Re:Glory! by kav2k · · Score: 5, Interesting

      Citing the FAQ:

      Are you looking at getting this into mainline?

      LOL.

      No really, are you?

      LOL.

      Really really, are you?

      No. They would be crazy to use this scheduler anyway since it won't scale to
      their 4096 cpu machines. The only way is to rewrite it to work that way, or
      to have more than one scheduler in the kernel. I don't want to do the former,
      and mainline doesn't want to do the latter. Besides, apparently I'm a bad
      maintainer, which makes sense since for some reason I seem to want to have
      a career, a life, raise a family with kids and have hobbies, all of which
      have nothing to do with linux.

    2. Re:Glory! by Trepidity · · Score: 4, Informative

      My question is: is it in the kernel tree yet? Is this that 2.6.31 scheduler change I heard about earlier yesterday, or is it something Completely Different?

      No, and probably won't ever be, though perhaps some ideas will be borrowed.

      From his FAQ:

      Are you looking at getting this into mainline?

      LOL.

      No really, are you?

      LOL.

      Really really, are you?

      No. They would be crazy to use this scheduler anyway since it won't scale to
      their 4096 cpu machines. The only way is to rewrite it to work that way, or
      to have more than one scheduler in the kernel. I don't want to do the former,
      and mainline doesn't want to do the latter. Besides, apparently I'm a bad
      maintainer, which makes sense since for some reason I seem to want to have
      a career, a life, raise a family with kids and have hobbies, all of which
      have nothing to do with linux.

      Can it be made to scale to 4096 CPUs?

      Sure I guess you could run one runqueue per CPU package instead of a global
      one and so on, but I have no intention whatsoever at doing that because it
      will compromise the performance where *I* care.

      The "bad maintainer" part is referring to bad blood over the adoption of Ingo Molnar's CFS over Kolivas's own RSDL, in particular at least one LKML poster suggesting that, all else being equal, it'd be better to merge Molnar's code, as he was more likely to be a reliable maintainer (Molnar's more tied into the workings of the mainline kernel development/merging/etc.).

    3. Re:Glory! by kav2k · · Score: 5, Informative

      Oh yeah, and which other scheduler's, if any, did this guy write?

      SD scheduler

    4. Re:Glory! by BiggerIsBetter · · Score: 5, Insightful

      No. They would be crazy to use this scheduler anyway since it won't scale to
      their 4096 cpu machines. The only way is to rewrite it to work that way, or
      to have more than one scheduler in the kernel. I don't want to do the former,
      and mainline doesn't want to do the latter. Besides, apparently I'm a bad
      maintainer, which makes sense since for some reason I seem to want to have
      a career, a life, raise a family with kids and have hobbies, all of which
      have nothing to do with linux.

      Which is not to say that it might not find it's way into the Ubuntu Desktop mainline patchset, for example. Sure it might not make sense for the mainline kernel, but it surely makes sense for a user focused distro like Ubuntu - they already have patched base and server kernels, so why not a genuine desktop targeted kernel?

      --
      Forget thrust, drag, lift and weight. Airplanes fly because of money.
    5. Re:Glory! by blind+biker · · Score: 4, Insightful

      I wonder what BeOS had, that was so good. I mean, was it a scheduler thing? Or was it the pervasive multithreadedness that the OS almost forced upon the developers? Whatever it is, it worked like black magic: BeOS would always listen to the user input, no matter what the heck it was doing in the background, no matter what insane load was on the CPU - your mouseclicks were always reacted upon immediately, your drags were always reacted upon immediately, your typing, resizing, brushstrokes, midi-signals, whatever, always, under any circumstance, were immediately and smoothly followed by the correct response.

      I was hoping Windows 2000 would achieve that, then I was hoping Windows XP would achieve that, then I was hoping some of the newer 2.6 kernels in Linux coupled with innovations in X would achieve that - but I was always deeply, utterly disappointed. Then I kinda hoped Vista would get somewhat close to what BeOS did. Oh yeah, now that was a hope decisively smashed.

      --
      "The agriculture ministry is not in charge of Gundam" - Japanese ministry official.
    6. Re:Glory! by Trepidity · · Score: 4, Informative

      Yeah, that makes sense, but he seems to have taken it personally. It sounds like part of it stems from his feeling that Molnar unnecessarily wrote a replacement using his ideas and got credit for it, instead of helping out to turn one of Kolivas's fair-scheduling proposals into something that could be merged. Though from what I can tell Molnar's replies are all pretty friendly, and he seemed keen to provide appropriate credit.

    7. Re:Glory! by mwvdlee · · Score: 4, Insightful

      The whole point is moot. Relying on a single maintainer is just plain stupid. "All things being equal" they should choose the code which OTHER people can maintain easier.

      --
      Slashdot social media options: AIM, ICQ, Yahoo, Jabber and Mobile Text. Why no MySpace?
    8. Re:Glory! by Hurricane78 · · Score: 5, Informative

      What is that? You don't have the choice of scheduler in your kernel? I'm using the Zen sources, and I get to choose between least half a dozen schedulers, including other settings. I am certain that this scheduler will make it into that patchset, and that I will enable it, as soon as zen-sources-2.6.31 get installed on my system.

      After all this is Linux! Not some one-company-one-kernel monoculture!

      --
      Any sufficiently advanced intelligence is indistinguishable from stupidity.
    9. Re:Glory! by Blakey+Rat · · Score: 4, Insightful

      No normal user cares about their video encoding being 2 seconds slower (over a 3 hour process) because they wanted to answer their email. If that's really important to you, you are probably doing your video encode overnight or during some time when nobody's using the computer, anyway, and then it doesn't matter.

      Instant response is *always*, *always* more important than all other tasks. Always. One of the many, many things BeOS got right.

    10. Re:Glory! by Simetrical · · Score: 3, Interesting

      Anyway, Windows has had 2 schedulers for ages - you can select desktop or server style processing (and cache strategy) since NT4.

      That's not two schedulers, it's just some tunables. See pages 391 to 444 of Windows Internals, 5th Edition (or comparable pages in earlier editions). For instance, on Vista the default quantum is two clock intervals (a "clock interval" is usually about 10 to 15 ms), while on Windows Server it's twelve clock intervals. Similarly, on desktops an extra boost is given to the currently focused application. You can adjust this at runtime in the GUI on Vista under Advanced System Settings -> Advanced -> Performance -> Settings -> Advanced (yes, apparently scheduler adjustments are very advanced in Microsoft's view). It can be controlled with slightly more granularity with the registry key HKLM\SYSTEM\CurrentControlSet\Control\PriorityControl\Win32PrioritySeparation (a six-bit bitfield).

      Linux currently offers scheduler tunables both at compile-time and runtime. Try ls /proc/sys/kernel/sched_*. It has more than Windows, apparently. I expect there are some compile-time options too, but I'm not an expert in anything related to kernels or systems programming.

      --
      MediaWiki developer, Total War Center sysadmin
    11. Re:Glory! by shutdown+-p+now · · Score: 4, Informative

      The same is pretty much true of .Net's Windows.Forms. It's a bit faster than Swing, although not by much (some parts are actually slower - System.Drawing vs Java2D, for example), so it's a little more forgiving of doing work in the UI thread. It will still bite you in a non-trivial application. Of course, the framework provides absolutely no help in writing a multithreaded application, and all of the tools, examples and documentation make writing a multi-threaded application far more difficult than it should be.

      Yes, and things like Control.Invoke to marshal invocations from background threads to UI, and especially BackgroundWorker, which are there specifically to provide a high-level (i.e. without locks) API for worker threads, with progress reporting and cancellation, must be just figments of my imagination?

      Have you actually written any WinForms code in .NET 2.0+?

  4. *sniff* by s4m7 · · Score: 4, Funny

    I smell another LKML flamewar coming....

    --
    This comment is fully compliant with RFC 527.
    1. Re:*sniff* by tpgp · · Score: 3, Funny

      I smell another LKML flamewar coming....

      A flamewar on the LKML? Pfffffffffffft. Impossible. Never happened, never will happen.

      --
      My pics.
  5. forward looking by Trepidity · · Score: 5, Informative

    Took me a while to figure out what "forward looking" means in this context, since "forward-looking scheduler" doesn't seem to be common terminology, and I assumed he wasn't talking about his grand forward-looking vision for schedulerdom.

    Based on some previous arguments he's had, it sounds like he opposes the common heuristic of upping interactive process priority by keeping track of how long processes sleep--- processes that sleep a lot are probably I/O bound, and should get a priority boost so they can run on the (less frequent than for CPU-bound processes) occasions when they're ready. Kolivas wants schedulers to be forward-looking in the sense that they decide how to schedule without looking at process run history, by looking purely at who's ready to run, available timeslices, priorities, etc.

  6. Re:Cool, but what does that spec mean? by Trepidity · · Score: 5, Informative

    He means something different by it--- that the scheduler should only look forward, not look back to per-process history in making its scheduling decisions. A common hack/heuristic to improve interactive performance is to boost the priority of processes that sleep a lot, since CPU-bound jobs sleep rarely, while interactive processes sleep a lot. Kolivas think that's a hack that obscures the real problems with interactive performance, and leads to unpredictable performance since it doesn't fix the underlying issues. So wants to design schedulers with good interactive performance that make decisions based purely on the current set of running processes and priorities, and the upcoming timeslices.

  7. 4096 cpu machines by boldie · · Score: 4, Interesting

    Still some grudge towards Torvalds and Molnar? From the FAQ:
    Are you looking at getting this into mainline?
    LOL.

    No really, are you?
    LOL.

    Really really, are you?

    No. They would be crazy to use this scheduler anyway since it won't scale to their 4096 cpu machines. The only way is to rewrite it to work that way, or to have more than one scheduler in the kernel. I don't want to do the former, and mainline doesn't want to do the latter. Besides, apparently I'm a bad maintainer, which makes sense since for some reason I seem to want to have a career, a life, raise a family with kids and have hobbies, all of which have nothing to do with linux.


    Reminds me of this XKCD.

    I don't have 4096 CPUs, good job Con Kolivas!

    1. Re:4096 cpu machines by TheRaven64 · · Score: 4, Insightful

      Having read flames from both Theo and Linus, it's difficult to make a fair comparison. Linus is a bit more gentle than Theo, but he is much more likely to be wrong when he flames someone. Neither of them is any good at admitting when they are wrong, but Linus has had a lot more practice at being wrong and not admitting it.

      --
      I am TheRaven on Soylent News
  8. He ain't kidding. by Ant+P. · · Score: 4, Insightful

    CFS can't even cope with a CPU-bound application.

    Who here runs Linux on anything with more than 16 cores? Why should everyone else get the shitty end of the stick just because of maybe a dozen institutes with deep pockets?

    1. Re:He ain't kidding. by gbjbaanb · · Score: 4, Insightful

      I think what you want is not a single scheduler designed for the desktop, but one designed for server processes. That's probably the whole argument here - there isn't a single scheduler that can work efficiently for the 2 wildly different types of work a user put a machine to, but currently you don't have a choice. This is all about giving users choice of what kind of scheduler they'd like to run. You might even find that a scheduler designed for lots of CPUs (at the expense of interactivity probably) would suit you much more than the current system, especially when you buy more cores.

  9. 16... okay for the desktop for 12 months by MosesJones · · Score: 4, Interesting

    16 sounds like a ridiculously high number for a desktop but is it?

    Already we have 4 core processes which have "soft" additional threads (Intel's HT for instance) and some people already have dual CPU desktop machines meaning they are already at the 16 CPU limit.

    Roll on 12-18 months and we'll be seeing 8 core CPUs with 8 soft-cores as coming in on top end desktops. Roll forwards 3 years and you'll be seeing 32 core CPUs with 32 soft-cores which is where the scheduler breaks down.

    So the problem here is that this is a brilliant optimisation for today and for pieces like the netbook market but won't be good for the desktop market long term.

    With Linux looking to be strong in the netbook market however it does say that having a more efficient scheduler for that market would be a better idea than just optimising everything for the server side.

    --
    An Eye for an Eye will make the whole world blind - Gandhi
    1. Re:16... okay for the desktop for 12 months by SpinyNorman · · Score: 3, Insightful

      I guess you didn't read TFA:

      Can it be made to scale to 4096 CPUs?

      Sure I guess you could run one runqueue per CPU package instead of a global
      one and so on, but I have no intention whatsoever at doing that because it
      will compromise the performance where *I* care.

      In the meantime if you care about CPU utilization and latency then use this. Tomorrow will take care of itself. It's not like if you buy one computer or graphics card, or build one kernel, that you're tied to it for the rest of your life. You use this year what's available and update when the situation warrants it.

  10. Re:Linux on the Desktop/Linux on the Server by TheRaven64 · · Score: 4, Interesting

    From what I understood from the kernel discussion last time, this would probably have to be #ifdefs galore.

    No, it really wouldn't. Take a look at how Xen and FreeBSD implement pluggable schedulers. Each scheduler in Xen is identified by a struct which contains pointers to its state and all of the functions related to actions the scheduler needs to take. These are called from the rest of the code (most commonly the timer interrupt handler). The total extra cost is one extra load instruction per call, which is tiny compared to the amount of work that the scheduler does. In FreeBSD, it's even simpler. The functions that implement the scheduler are declared in a header and implemented once in each scheduler's .c file(s). At compile time, you simply compile in the scheduler you want. Total run time cost is zero. FreeBSD cares about stability, so they've retained the old 4BSD scheduler all through the transition to the ULE scheduler (which, by the way, was outperforming the CFS in the last set of benchmarks I saw, although not by as large a margin as it outperformed the old Linux scheduler). This allows people operating servers that would rather sacrifice a little performance than use relatively new code to select the old one. Xen is designed for a variety of workloads, and so it has several schedulers that you can choose between.

    Of course, these are only possible if the interface between the scheduler and the rest of the kernel is clean already. If it isn't, however, then you almost certainly have bigger problems than not being able to choose between two schedulers.

    --
    I am TheRaven on Soylent News
  11. Kudos Con by amightywind · · Score: 3, Interesting

    Welcome back Con! I wonder how long it is before Ingo "Kudos Con" Molnar rips of the new design? The kernel team has developed a very bad case of "not invented here." http://kerneltrap.org/node/8059

    --
    an ill wind that blows no good
  12. Re:Who cares? by TheRaven64 · · Score: 3, Informative

    If you're interested, the clang team have done a lot of profiling of exactly what takes time when compiling. It's particularly interesting how much of a bottleneck preprocessing is with gcc and, more importantly, distcc (which sends the preprocessed sources over the network for compilation). Most of the results are on the web site, with a few in the mailing list archives.

    --
    I am TheRaven on Soylent News