Stories
Slash Boxes
Comments

News for nerds, stuff that matters

Slashdot Log In

Log In

Create Account  |  Retrieve Password

Anticipatory Scheduler in Kernel 2.5+ Benchmarked

Posted by timothy on Wed Feb 26, 2003 06:22 PM
from the knew-you-were-going-to-say-that dept.
gmuslera points to this article at KernelTrap comparing available benchmarks for schedulers available for the 2.5 kernel, with the 2.4's scheduler as a reference poin. "In some cases, the new Anticipatory Scheduler performs several times better than the others, doing a task in a few seconds instead minutes like the others."
+ -
story
This discussion has been archived. No new comments can be posted.
The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More
Loading... please wait.
  • by daeley (126313) on Wednesday February 26 2003, @06:23PM (#5390964) Homepage
    Somehow, I just *knew* this was coming. ;)
    • by nairnr (314138) on Wednesday February 26 2003, @06:27PM (#5391007)
      Just like they couldn't anticipate the Slashdotting they were about to receive...
        • by bill_mcgonigle (4333) on Wednesday February 26 2003, @07:58PM (#5391687) Homepage Journal
          I totally agree, but do find it sad that Apple spent all the time and effort only to find that creating an OS was beyond them, so they chucked it all out and went for Unix. And Unix had been there for them all along.

          C'mon, try grounding your trolling in reality next time. Scheduling on OSX is handled by Mach [apple.com], which was developed at CMU by Avi Tevanian [apple.com], developed at NeXT and brought up to 3.0 at Apple.

          Apple uses BSD for its UNIX compatibilty layer, but that doesn't handle scheduling, which is what this article is about.

          Now, if you want to say Apple was dumb for chucking A/UX [faqs.org] in the early nineties, then that'd make a much better troll.
  • by Sayten241 (592677) on Wednesday February 26 2003, @06:29PM (#5391025)
    The anticipation is killing me .
  • by ChangeOnInstall (589099) on Wednesday February 26 2003, @06:30PM (#5391033)
    If only kerneltrap.org were running the new schedu... oh, never mind.
  • by DonkeyJimmy (599788) on Wednesday February 26 2003, @06:33PM (#5391065)
    In some cases, the new Anticipatory Scheduler performs several times better than the others, doing a task in a few seconds instead minutes like the others.

    The task in question was anticipating things, so the test might not be all that fair.
  • by huhmz (216967) on Wednesday February 26 2003, @06:33PM (#5391068)
    I have a multithreaded perl app (yes perl has descent thread support in 5.6 and later) which does a lot of mixed write/read I/O to and from a database. With 2.4 and 40 threads I can hardly use the system (of course I dont have to abuse my computer with 80 threads but Im trying to prove a point here).
    Switching to a new tabbed terminal in fluxbox it takes ages to redraw and switching between virtual desktops is an act of futility.
    With 2.5 It get good interactive performance and don't see this effect much at all. For sure this is also a bit due to the new VM code.
    Of course I would probably get the best interactivity with the SFQ scheduler but thats secondary in this case. At least xmms doesn't skip with this during very heavy I/O. I do not use the new NPTL code which would help further I suppose.
  • Poin..... (Score:5, Funny)

    by akiy (56302) on Wednesday February 26 2003, @06:38PM (#5391117) Homepage
    "with the 2.4's scheduler as a reference poin."

    I'm still anticipating the "t" in "point" myself...

  • by Mr. Sketch (111112) <[mister.sketch] [at] [gmail.com]> on Wednesday February 26 2003, @06:39PM (#5391122)
    Too many connections
  • by Dark Lord Seth (584963) on Wednesday February 26 2003, @06:41PM (#5391143) Journal
    Too many connections

    You know, you can ALMOST feel an admin over there just itching to type in "Fuck you Taco! And your site!" instead of the connection stuff...

  • by DonkeyJimmy (599788) on Wednesday February 26 2003, @06:47PM (#5391198)
    Me: Computer, I would like to open Netscape
    Computer: I have anticipated you would like to open IE and have already opened it for you.
    Me: Ok, then I would like to go to the game review site to see what I want to buy.
    Computer: I have already begun the download of the new Age of Empires game, your account has been charged.
    Me: Can I at least go to the bathroom?
    Computer: No.
    • by Anonymous Coward on Wednesday February 26 2003, @06:59PM (#5391288)
      Me: I would like to upda...
      Computer: I have already run auto update. all your warez are belong to us.
    • by Trogre (513942) on Wednesday February 26 2003, @10:16PM (#5392679) Homepage
      iptables: "Httpd, we've lost our port 80 packet deflectors"
      httpd: "Intensify the firewall, I don't want anything to get through."
      iptables: "Httpd, look!"
      httpd: "INTENSIFY THE FIREWALL!"
      iptables: "Too late!"

  • by FyRE666 (263011) on Wednesday February 26 2003, @06:50PM (#5391224) Homepage
    ... the Mozilla developers added a special "Slashdotted" plugin you know. So you could launch a special tab that would keep hammering away at a site in the background until it did bloodywell load ;-)
    • by ottffssent (18387) on Wednesday February 26 2003, @07:22PM (#5391452)
      I know that's Score:5 Funny but there's a serious note here.

      If a site is down, Mozilla could pretty easily grab the google cache instead. Or, if there's no google cache or if the cache matches the current page, check archive.org. Mozilla could auto-generate a page offering the user some options. Think about it - it would be the end of 404 errors. Instead of

      404 The requested page could not be found.

      you could get

      The site you requested is currently down. Would you like to use Google's cache [216.239.51.100] instead? I also have a snapshot of the page you requested from August 12, 2002 [archive.org] but older ones are available here [archive.org].
  • how it works (Score:5, Informative)

    by diegocgteleline.es (653730) on Wednesday February 26 2003, @07:09PM (#5391355)
    Given that kerneltrap has "Too many connections", i don't know if they have this link: http://www.cs.rice.edu/~ssiyer/r/antsched [rice.edu]

    where it explains what anticipatory scheduling does.


    (btw, it seems that freebsd had it for ages)
  • by fr2asbury (462941) on Wednesday February 26 2003, @07:10PM (#5391361)
    I see you shiver with antici - - - - (Say it!) - - - (Consti!) - - - pation!

    ;-)

  • by !Xabbu (1769) on Wednesday February 26 2003, @07:11PM (#5391369) Homepage
    What does it do for kernel performance? Or does it do anything for performance? ...I haven't run Linux on a desktop for almost a year. It hurts mommy.. please make the bad man go away!
    • by Caoch93 (611965) on Wednesday February 26 2003, @07:21PM (#5391445)
      In this case, they're talking about an I/O Scheduler, which is in charge of planning I/O through some resource so that activities on that resource correctly complete as quickly as possible. To be specific, this scheduler is for the hard disk I/O Scheduler, which plans reads and writes from/to your hard disks.

      The Anticipatory Scheduler is designed to optimize your disk I/O based on the assumption that reads of related material tend to happen in short succession, while writes tend to be singular and larger. As a result, when the scheduler encounters a read, it anticipates that there will be other reads in short succession, so it waits and then checks for them and, if they're there, they move to the front of the line. The name comes from the tiny waiting period when it anticipates future reads.

      This is, of course, a condensed version of what I think I've learned from reading KernelTrap for the last few months. Someone's bound to tell you I'm talking arse.

    • by RainbowSix (105550) on Wednesday February 26 2003, @10:32PM (#5392778) Homepage
      Other forms of disk scheduling are a little more simple. Assume that the disk is really slow, and lots of requests are coming in that are buffered somewhere. Obviously you want to handle requests that are close to where the disk head currently is since it is faster and you won't have your head going all over the place.

      FCFS (first come first serve) - easy stupid way. Take requests as they come. If you need front end front end, performance suffers because obviously you want to do front front end end.

      SSTF (shortest seek time first) - do the request that is shortest to the head first. The problem with this is if you keep asking for stuff at the front of the disk and have a lone request for the end of the disk, the lone request could get ignored for a long time (starved) since the scheduler does the stuff at the front since seek times are much lower.

      SCAN - the head starts at one end of the disk and goes to the end, servicing requests along the way, but never going back so that that lone request from the previous method does get serviced. When it gets to the end the head moves back toward the front, servicing requests along the way. It keeps going back and forth.

      C-SCAN -Variant of SCAN where it doesn't go back and forth. It goes from front to back servicing requests then goes all the way back to the front before it starts servicing again. It gives more uniform times because if you're using SCAN and your request at the beginning is just missed by the head, you have to wait until it goes all the way to the other end and comes all the way back. In this method it goes to the end and then you're the next request to be serviced if you are at the beginning.

      LOOK - The same as CSCAN and SCAN except it doesn't blindly go to the end of the disk; it stops and turns around when there aren't any more requests in the direction. Of course, if you show up right after the head changes direction, sucks to be you :)
  • by Wesley Felter (138342) <wesley@felter.org> on Wednesday February 26 2003, @07:21PM (#5391444) Homepage
    The blurb didn't mention that the article is comparing disk schedulers, not CPU schedulers.
  • Good stuff, but... (Score:5, Informative)

    by Corbet (5379) on Wednesday February 26 2003, @07:35PM (#5391540) Homepage
    ...of course, LWN readers knew about the anticipatory scheduler back in January [lwn.net]. We also looked at the SFQ and CFQ I/O schedulers two weeks ago [lwn.net].
  • by Miles (79172) on Wednesday February 26 2003, @07:56PM (#5391673) Homepage
    If you're really curious, you can check out the mailing list for more info. Try searching for "IO scheduler benchmarking" or "iosched". To save the mailing lists, here's a few interesting benchmarks:

    Parallel streaming reads:
    Here we see how well the scheduler can cope with multiple processes reading
    multiple large files. We read ten well laid out 100 megabyte files in
    parallel (ten readers):

    for i in $(seq 0 9)
    do
    time cat 100-meg-file-$i > /dev/null &
    done

    2.4.21-pre4:

    0.00s user 0.18s system 2% cpu 6.115 total
    0.02s user 0.22s system 1% cpu 14.312 total ...(up to)
    0.01s user 0.16s system 0% cpu 37.007 total

    2.5.61+hacks:

    0.01s user 0.16s system 0% cpu 2:12.00 total
    0.01s user 0.15s system 0% cpu 2:12.12 total ...(up to)
    0.01s user 0.19s system 0% cpu 2:13.51 total

    2.5.61+CFQ:

    0.01s user 0.16s system 0% cpu 50.778 total
    0.01s user 0.16s system 0% cpu 51.067 total ...(up to)
    0.01s user 0.18s system 0% cpu 1:32.34 total

    2.5.61+AS

    0.01s user 0.17s system 0% cpu 27.995 total
    0.01s user 0.18s system 0% cpu 30.550 total ...(up to)
    0.01s user 0.16s system 0% cpu 34.832 total

    streaming write and interactivity:
    It peeves me that if a machine is writing heavily, it takes *ages* to get a
    login prompt.

    Here we start a large streaming write, wait for that to reach steady state
    and then see how long it takes to pop up an xterm from the machine under
    test with

    time ssh testbox xterm -e true

    there is quite a lot of variability here.

    2.4.21-4: 62 seconds
    2.5.61+hacks: 14 seconds
    2.5.61+CFQ: 11 seconds
    2.5.61+AS: 12 seconds

    Streaming reads and interactivity:
    Similarly, start a large streaming read on the test box and see how long it
    then takes to pop up an x client running on that box with

    time ssh testbox xterm -e true

    2.4.21-4: 45 seconds
    2.5.61+hacks: 5 seconds
    2.5.61+CFQ: 8 seconds
    2.5.61+AS: 9 seconds

    copy many small files:
    This test is very approximately the "busy web server" workload. We set up a
    number of processes each of which are reading many small files from different
    parts of the disk.

    Set up six separate copies of the 2.4.19 kernel tree, and then run, in
    parallel, six processes which are reading them:

    for i in 1 2 3 4 5 6
    do
    time (find kernel-tree-$i -type f | xargs cat > /dev/null ) &
    done

    With this test we have six read requests in the queue all the time. It's
    what the anticipatory scheduler was designed for.

    2.4.21-pre4:
    6m57.537s ...(up to)
    6m57.916s

    2.5.61+hacks:
    3m40.188s ...(up to)
    3m56.791s

    2.5.61+CFQ:
    5m15.932s ...(others)
    5m50.602s

    2.5.61+AS:
    0m44.573s ...(up to)
    0m53.087s

    This was a little unfair to 2.4 because three of the trees were laid out by
    the pre-Orlov ext2. So I reran the test with 2.4.21-pre4 when all six trees
    were laid out by 2.5's Orlov allocator:

    6m12.767s ...(up to)
    6m13.085s

    Not much difference there, although Orlov is worth a 4x speedup in this test
    when there is only a single reader (or multiple readers + anticipatory
    scheduler)
  • by AxelTorvalds (544851) on Wednesday February 26 2003, @09:40PM (#5392430)
    They should really call it 3.0...

    When I first started hacking on Linux, I was working with a seasoned Linux kernel hacker who my company hired as a consultant. He helped us with some I/O issues and such, did some other tweaks and gave us a ton of inspiration to go get after it ourselves. (You be amazed at how many people are afraid to just start making changes to kernel code) He is a wickedly cool individual and as someone whose had a lot of schooling and experience it was one of the best learning experiences I can remember.

    The first thing I started dorking with after that experience was the scheduler because I, like all other hakers, know how to schedule stuff. At the time, (early 2.x) the scheduler was also a fairly easy to digest piece of code that could have impacts on the system in great ways.

    Well all my stuff got bit bucketed. I called up our consultant guy who my friend by now, "what's the deal? Linus doesn't like my stuff. How do you mail him stuff?" And his answer was that pretty much every body wants to tweak the scheduler, everybody sends stuff in. Linus is sage in his wisdom, schedulers are freaking hard because there is always a pedantic worst case that sucks and actually shows up in the real world. Linus has always done fairly simple things that aren't best but certainly aren't worst. So 2.0 had pretty straight round robin. 2.2 and 2.4 they started to add queuing schedulers with niceness. 2.5 we're going to get a pretty killer scheduler that has taken a ton of effort to tweak and there are still discussions to expose parameters to the user via /proc or something because you can find cases were it doesn't perform as well.

    Now this IO scheduler is opening up a whole new can of worms, it's a new chunk of code called "scheduler" and all hackers know scheduling. In the past it has been fairly simple. It should be fun to watch and the kernel is going to kick mucho ass in the end. There will be a lot of talk and debate about this stuff. It's also distilled down to the trusted set that Linus will let play with things called "scheduler"

  • File I/O primitives (Score:4, Informative)

    by anonymous cupboard (446159) on Wednesday February 26 2003, @10:56PM (#5392895)
    It seems that the main problem is that the file I/O primitives in Linux are a little too primitive. On some operating systems, there is another layer sitting between the file system and the user which provides record and block management. If I open a file for sequential read or write then the record/block manager knows that it could use read-ahead or write-behind.

    The problem is that such I/O layers need to be implemented at least partially outside user-space in the case where the file is being simultaneously accessed to allow interprocess coordination. Also, to get best use, everything should use it.

    • Re:Great! (Score:5, Funny)

      by Xunker (6905) on Wednesday February 26 2003, @06:57PM (#5391270) Homepage Journal
      Quoeth the driver:

      * These chips are basically fucked by design, and getting this driver
      * to work on every motherboard design that uses this screwed chip seems
      * bloody well impossible. However, we're still trying.
      • Re:Great! (Score:5, Informative)

        by DeeKayWon (155842) on Wednesday February 26 2003, @08:37PM (#5392004)
        The snippet you quote is from the cmd640 driver, which covers only the chipset by the same name. Subsequent CMD chips, including the 649, use the cmd64x driver and are not fucked.
        • Re:Great! (Score:4, Interesting)

          by CoolVibe (11466) on Wednesday February 26 2003, @09:35PM (#5392393) Journal
          I'd love to try 2.5, but the closed nvidia drivers is the only thing that's keeping me grounded to 2.4.

          Although I _suspect_ they will run fine on 2.5, I don't want to risk it. It's still a little too bleeding edge for me. They call it bleeding edge for a reason, because you _will_ bleed and get hurt from time to time.

          I guess I am a big fat ninny when it comes to bleeding edge stuff (although I do lust for all the new toys, the waiting just increases my contentness when such cool stuff gets part of stable stuff) :-)

          Speaking of avoiding the bleeding edge, it would be sooo cool if this IO scheduler was backported to 2.4.

      • by norton_I (64015) <hobbes@utrek.dhs.org> on Wednesday February 26 2003, @07:57PM (#5391685)
        GCC (and I assume others) can do this. Basically, you compile with -fprofile-arcs, run the executable enough to generate sufficient data, then compile with -fbranch-probabilities. This will try to order basic blocks so that the CPU predicts branches correctly most often.

        I have never done it, but it is supposed to work. Unfortunately, it is pretty much limited to static analysis -- it doesn't allow for programs whose usage patterns change with time. For that you need some kind of dynamic recompilation, such as provided by HP's Dynamo, Transmeta's code morphing, or perhaps some Java JITs (I don't know if any of them implement this).

        Personally, I think profile directed optimization done by a static compiler is a waste of time. All optimizations should be done at the best place, and for many optimizations, that is the static compiler, but many others can be better done by run time optimizers, or the CPU, and this is one of them.
    • Re:Finally (Score:5, Interesting)

      by psamuels (64397) on Thursday February 27 2003, @08:26AM (#5395047) Homepage
      Windows simply handles multithreading better.

      Nah, it handles certain start-up costs for complex applications better. This may or may not have anything to do with multithreading per se.

      And you can tell the I/O is crap just by looking at KDE's performance when compared to Win2k. Windows just flies.

      I don't run KDE, but I understand that it has had speed issues in the past because it uses a lot of interconnected C++ shared libraries, which really tax the dynamic loader. The Windows link scheme, by the way, is much more primitive (read: fast at runtime). Microsoft also uses a hack (disk layout profiling) to speed up load time further. (Not that "hack" is necessarily a bad thing - after all it does get the job done.)

      A couple of years ago, Jakub Jelinek came up with a utility similar to IRIX Quickstart for ELF binaries / libraries, which does "prelinking" to dramatically reduce relocation overhead at runtime in the common cases (without sacrificing flexibility, for the uncommon cases). A side effect is reducing memory usage due to COW. I never heard what happened to that project - anyone know if it is considered production-quality yet, or if binutils / glibc will be shipping it any time soon? Apparently it helped KDE quite a bit.