Slashdot Mirror


The Insidious Creep of Latency Hell

Twinbee writes "Gamers often find 'input lag' annoying, but over the years, delay has crept into many other gadgets with equally painful results. Something as simple as mobile communication or changing TV channels can suffer. Software too is far from innocent (Java or Visual Studio 2010 anyone?), and even the desktop itself is riddled with 'invisible' latencies which can frustrate users (take the new Launcher bar in Ubuntu 11 for example). More worryingly, Bufferbloat is a problem that plagues the internet, but has only recently hit the news. Half of the problem is that it's often difficult to pin down unless you look out for it. As Mick West pointed out: 'Players, and sometimes even designers, cannot always put into words what they feel is wrong with a particular game's controls ... Or they might not be able to tell you anything, and simply say the game sucked, without really understanding why it sucked.'"

47 of 297 comments (clear)

  1. I noticed this by GeorgeMonroy · · Score: 2

    I thought things were supposed to get faster with newer technology but it does indeed look like the newer devices run slower becuase of bloated apps and firmware. Maybe this has to do with programming being "bestshored" =D nowadays.

    --
    You got the touch!
    1. Re:I noticed this by man_of_mr_e · · Score: 2

      It's fine to write lean and high performant code in a small application with a single developer. Once you have teams of people working on something, then you have to worry about something called "Maintainability". According to various studies, 80% of a piece of softwares total lifetime cost is maintenance and support costs. Nobody wants that to be come 90 or 95 or even 99% because people wrote code that others coudn't understand very easily.

      Standardized frameworks, patterns, and components improve codes maintainability, often times at the cost of decreased performance. The idea is that hardware gets faster over time anyways, so you can write more features in less time with lower support costs.

    2. Re:I noticed this by Nerdfest · · Score: 4, Insightful

      For business development (not tools like FireFox, etc) it's not about being 'as fast as possible', but rather 'as maintainable as possible' while trying to be fast enough. When you write code to wring every clock cycle out of a CPU, the code tends to be difficult to maintain. Sometimes you need to do this, but in general you don't. People still write absolute crap in both situations of course.

    3. Re:I noticed this by cpu6502 · · Score: 4, Insightful

      I'm not buying those excuses.

      Why is it Microsoft Word 97 fits into my 8 megabyte 386 laptop, and has 99% of the same functions as modern Word, plus is quick and responsive. Why can't they bring that level of efficiency for today's Word 2010?

      Because they aren't trying.
      Because they don't care.
      Because it's easier for management to tell users, "Go buy a new computer with 8x more RAM," than to pay programmers to make the code more efficient/responsive.

      --
      My AC stalker: " I personally agree with your posts most of the time, but that won't keep me from modding you troll"
    4. Re:I noticed this by pankajmay · · Score: 2

      This issue is exactly why it is worth paying attention in those academic classes that are frequently labelled as out-of-touch with real world. (refer -- countless /. news articles on this).
      Introduction to Algorithms, Data structures and advanced algorithms; and the math behind them. Unfortunately since the barrier to entry is so low in today's environment (Hey look I can code --- that is enough) and that coupled with the quest to recruit brute force programmers and not thinkers have led to this mess today where even though we have faster machines, the end result is actually a degraded experience.
      Couple this with (to some extent artificially created by programming environments...) trade-off between maintainability and performance, and the situation gets even worse.
      And of course combine this with legacy code -- even when written with best intentions, might have faster solutions today OR the legacy code worked well for a few hundred datasets, but you have millions of them today -- scalability issues and the reluctance to leave behind what works.

      Finally -- in today's world -- we have an explosion of data -- it's data, data everywhere, but a lot of our tools and programming constructs still have an antiquated view of data -- processing it serially chunk by chunk.
      So, it is a lot of factors that have come together to create this issue. The resolution: Computer Scientists need to go back to basics and build concepts of data storage, access, and processing from scratch. And the realization that there is a difference between people who can code, and people who can look at a solution holistically.
      For example -- not every representation of a solution of a problem captures the solution space well. Choosing a solution representation as opposed to a naiive approach can make orders of magnitudes difference between hitting the target within well defined bounds, versus having unbounded solutions that never approach a significantly better phase.

    5. Re:I noticed this by Bourdain · · Score: 3, Insightful
      While I agree with your criticism of the parent comment regarding his lack of empiricism, if he were to change his assumption from

      Why is it Microsoft Word 97 fits into my 8 megabyte 386 laptop, and has
      99%
      of the same functions as modern Word, plus is quick and responsive. Why can't they bring that level of efficiency for today's Word 2010?

      to

      Why is it Microsoft Word 97 fits into my 8 megabyte 386 laptop, and has
      75%
      of the same functions as modern Word, plus is quick and responsive. Why can't they bring that level of efficiency for today's Word 2010?

      It all of a sudden holds more merit

      While I'm not claiming to hunt down statistics to prove my point, I think it's safe to say there's absolutely some truth to lazy programming becoming more the norm than the exception in certain areas.

      Do you really think some ratio of perceived/available functionality over ram usage has remained constant or significantly decreased?

      Don't you hesitate when you're about to download an application for a simple task but the first one you find is, inexplicably, 100 megabtyes, compressed, whereas the 2nd one you find (and download) is 10 or 15? :)

      I know I do

    6. Re:I noticed this by man_of_mr_e · · Score: 2

      Actually, it's closer to 50%. Which means that Office 2010 contains around twice as many features, and those features are almost certainly more complex than the first 50%. Consider a feature like Live Preview. This single feature touches most of the other features, and likely requires significantly more overhead than version of Office that did not have live preview.

      As computers get more capable, the software that uses them is written to do more.

    7. Re:I noticed this by Bourdain · · Score: 4, Interesting

      Okay, let's say it's 50%

      The only personal experience I have with this is that, among many other things I do professionally, usually at any organization I'm at (as a consultant or otherwise), I'm embarrassingly the "Excel guru".

      Using Excel a moderate amount, I do try to use VBA pretty sparingly given its obvious slowness compared to other methods of calculation, but on occasion, it's markedly more efficient than other designs (e.g. testing for a series of involved conditions which would otherwise process extremely slowly using a formulas, etc.)

      I've found that even on modern hardware, Excel 2007 VBA execution, of identical code, is much slower than Excel 2003.

      For that reason, along with the sheer inefficiency of the ribbon design in terms of responsiveness and usage of screen real estate, I keep all Office 2007 usage relegated to a VM which I rarely even need.

      To further clarify the issue, I have developed a personal library of macros I use in simply navigating spreadsheets efficiently. Even on modern hardware, Excel 2007 cannot keep up with my usage of these macros and throws errors repeatedly whereas I never see such errors in Excel 2003. Keep in mind, this is on modern hardware.

      My interpretation of this is that speed and efficiency were low priorities for the Office development team. Given that their interface redesign was, I believe admittedly, largely geared towards novice users, these alleged low priorities make more sense.

      To appeal to your sense of empiricism, which I appreciate, please see (perhaps not of the greatest quality...)
      http://www.wilmott.com/messageview.cfm?catid=10&threadid=81967
      http://www.excelbanter.com/showthread.php?t=137875
      http://www.ozgrid.com/forum/showthread.php?t=78673&page=1

      for what it's worth, I always disable screen refresh and calculation during a macro (except in rare circumstances when that behavior is necessary)

  2. Changing TV channels by Anonymous Coward · · Score: 5, Interesting

    And here I thoguht I was the only one complaining that changing channels gets slower and slower with every new receiver box.
    On analog it was basically instant, less than 100ms.
    First digital box took half a second. Full HD box sometimes takes a whole second or more (and it's not even deterministic anymore)

    That SUCKS big time!

    1. Re:Changing TV channels by Dr_Barnowl · · Score: 5, Interesting

      That's down to compressed stream buffering. An analog box could be instant because every frame was transmitted uncompressed. With digital TV, you have to wait for a keyframe at least.

    2. Re:Changing TV channels by JordanL · · Score: 2

      This does not explain the > 500ms delay when trying to use the guide.

    3. Re:Changing TV channels by El_Isma · · Score: 2

      That's due to how digital cable works. I'll speak of DVB since that's what I know (I don't know what USA is using, but surely it will be similar). DVB sends a big stream composed of several smaller streams, some of those are video/audio streams, some are channel information (the guide, the streams IDs (audio/video/cc) of the channel, etc), others are info on the stream itself (carrier frequencies) or general information (time).

      For the video stream, as the parent poster said, you'll have to wait to get a keyframe to start to view it (sending more keyframes means less efficient coding, means more bandwith per channel).

      For some of the channel information, like the guide, you have a tradeoff between bandwidth and latency. Sure, you can stream the guide with almost 0 latency, but that means using a lot of BW to be able to send all the channel guides all the time. You have less available BW for channels, which means having to use more carrier freqs which means more money on hardware to send those signals (and possibly repeaters...). So, cable operators send the guide with a "reasonable" BW. The problem gets worse the more channels you have, since the channel guide has to be sent on all carriers.

    4. Re:Changing TV channels by Omnifarious · · Score: 3, Informative

      Since many of these technologies transmit the data for all channels simultaneously, why not just scan for key frames and store the last key frame received for each channel? It might be that even just scanning for key frames might be too CPU intensive to do for all channels. But most people, when channel flipping, do so in a fairly predictable order. You could start doing this for the most likely targets for channel flipping when channel flipping behavior is detected.

    5. Re:Changing TV channels by TapeCutter · · Score: 5, Interesting

      When I was a kid I had to wait for the B&W TV to warm up, now I'm an old fart I have to wait just as long for the digital set top box to boot up. Somewhere in between I had a TV that came on instantly.

      --
      And did you exchange a walk on part in the war for a lead role in a cage? - Pink Floyd.
    6. Re:Changing TV channels by Omnifarious · · Score: 2

      In my opinion, showing just a still keyframe, or a keyframe with weird corruption is still preferable to channel switching taking a full 500-2000ms. Though the weird corruption would probably be a customer education issue.

    7. Re:Changing TV channels by JonySuede · · Score: 4, Interesting

      it is the encryption technique utilized that introduce this lag. There is a key change at about 1s so it must wait until the next key to decode the stream.

      --
      Jehovah be praised, Oracle was not selected
    8. Re:Changing TV channels by tibit · · Score: 2

      A cable box needs one wideband tuner and an SDR that can demodulate all the channels at once. There's obviously no need to do video decoding (decompression), just buffering of some subset of channels (say most often recently used). One QAM channel brings about 34.5 Mbit/s. A modern ASIC should have no problem easily dealing with demodulating and buffering twenty such channels (700 Mbit/s) when presented with a wideband IF output. The buffering only needs 90 Mbytes/s for 20 channels. That's not much if you ask me. Again: there's no need for 20 physical tuners. There's just one tuner that doesn't do much besides amplifying and prefiltering the signal, and then feeding it into an very fast A/D. The output of that A/D goes into the ASIC and there the individual QAM channels are demodulated and dumped to external RAM. When you switch channels, it's trivial to scan the buffered stream for a given channel to find the most recent keyframe and immediately feed it to the MPEG decoder, so that you get video output with minimal latency.

      For implementation reasons, and due to economics, the cable spectrum may need to be split up in a couple subbands (say 4), and those would be individually digitized, so you end up with "4 tuners", but those tuners are somewhat simpler than a regular tuner: their heterodynes all run at fixed frequencies. The IF can be likely directly digitized for all of the subbands.

      --
      A successful API design takes a mixture of software design and pedagogy.
  3. N900 by Dr_Barnowl · · Score: 5, Interesting

    The N900 suffers from this, alas.

    I can't comprehend why the phone app isn't in memory on boot. It's a PHONE. Instead, when the phone rings you have to wait several seconds for the phone application to load.

    In contrast, my wife's new HTC Z snaps and zings along with Android, even though it's "bloaty" Java / Davlik.

    1. Re:N900 by Microlith · · Score: 3, Informative

      I can't comprehend why the phone app isn't in memory on boot. It's a PHONE.

      As Nokia put it, it's a device designed around "mobile computing." The phone app is entirely secondary (unlike on most Symbian devices, which have physical buttons) and is mostly there as a convenience thing. The primary reason the circuitry for it is even there is for 3G data.

      Instead, when the phone rings you have to wait several seconds for the phone application to load.

      Which lies totally outside my experience, where it comes up instantly.

      90% of the lag on the N900 is if you've just done something memory intensive (notably the browser) that caused stuff to be paged out to the eMMC, which isn't exactly fast. But the crippling problems that used to cause were resolved back in September or so with the PR1.3 update.

      In contrast, my wife's new HTC Z snaps and zings along with Android, even though it's "bloaty" Java / Davlik.

      That's because it's a phone, and not a more general purpose sort of device. In fact, they don't even want you messing with it which is why you have to root the damned thing.

    2. Re:N900 by maxume · · Score: 2

      That's a hell of an argument, it's not a phone, it is just a shitty computer with some cellular and audio hardware built in.

      But at least they made a computer with a shitty phone application, and not a just a shitty phone.

      --
      Nerd rage is the funniest rage.
  4. iReport by RichardJenkins · · Score: 2

    Whenever I use iReport there is about a sixth of a second delay between interacting with it and it doing what I asked. It's barely noticeable but still drives me insane.

  5. RTFA by Dog-Cow · · Score: 5, Funny

    I was going to read the article, but it took too long to load.

    1. Re:RTFA by mikael_j · · Score: 2

      Oh, Windows has antialiasing, it's just that it tries too hard to force fonts into the pixel grid so while it does make them readable it also makes them look sort of ugly and broken (unless specifically designed for ClearType).

      Then of course as you pointed out there is the weird window tearing thing going on, which for some reason will happen even on a top-of-the-line Windows machine with no software running except the one explorer.exe window you're moving around.

      And finally there's the general UI design where your choices boil down to "whatever crazy translucent shiny MS is making the current version default to" or "Windows Classic" which is grey and boring to say the least (and not in a minimalist way, in the "this must have been designed by an accountant" way).

      --
      Greylisting is to SMTP as NAT is to IPv4
  6. Worst Offender: Satellite Receivers by omnichad · · Score: 2

    I don't personally have Satellite, but it seems that almost every satellite receiver is underpowered to run the GUI.

  7. slashdot by Anonymous Coward · · Score: 5, Insightful

    Slashdot's Javascript.

    1. Re:slashdot by snowraver1 · · Score: 2

      ^^ this

      Any popular story, such as the recent Bin Laden killing story, opens SSLLOOWWLLYY... It takes maybe 2-3 minutes to open, and during that time, the browser is unresponsive. (I have a single core HT laptop with 3 gigs of ram). Once the page loads, actually scrolling is a joke. The lag there is in the 5-10 second range. C'mon /.

      --
      Copyright 2010. All rights reserved. This comment may not be copied in any way including, but not limited to caching.
    2. Re:Slashdot by tepples · · Score: 2

      The 10-second preview wait is to port scan your IPv4 address for open proxies. I compose long replies in Gedit or Notepad while I wait for Slashdot to catch up.

    3. Re:slashdot by Hatta · · Score: 2

      Then block it. I use NoScript. Set your discussion preferences to "Classic Discussion System (D1)" for best effect.

      --
      Give me Classic Slashdot or give me death!
  8. the olden days. by radioteeth · · Score: 2

    I miss the days where manually compensating for lag in games like Quake was unquestionable and accepted as a part of the multiplayer gaming experience. It's hard to imagine trying to cope with such a thing these days.

  9. same as it ever was by decora · · Score: 2

    Linus Torvalds has rejected patch after patch after patch that would make Linux into BeOS style latency. He has rejected them all. Why?

    because he wants to goose the server performance numbers. thats basically the story of the last 20 years of linux.

    1. Re:same as it ever was by Twinbee · · Score: 2

      Hi, I wrote the article in the story.

      Can you give me some verification and links to your comment, and I might see if I can fit it into the article. As you say, there should always be a sensible balance between latency and throughput.

      --
      Why OpalCalc is the best Windows calc
  10. The new slashdot interface by nu1x · · Score: 5, Insightful

    It actually drives me insane, it is markedly worse, I read less stories because of it (because I do not like the feel of the site so much).

    I would bet most of the actual slashdot users feel (think ?) the same way. Why is there no mass appeal to change it back / forward in a more reasonable (i.e., simpler) direction ?

    --
    I have nothing to lose but my bindings.
    1. Re:The new slashdot interface by Culture20 · · Score: 3

      I turned it off and went with the old style. I'll take a 5 minute wait between posts any day before trying to
      r
      e
      a
      d
      t
      e
      x
      t
      l
      i
      k
      e
      t
      h
      i
      s
      And yes, the posts lower in the chain would often look like that with the most recent javascript fiasco. I have no idea whether it's still that ugly.

    2. Re:The new slashdot interface by Teckla · · Score: 2

      It actually drives me insane, it is markedly worse, I read less stories because of it (because I do not like the feel of the site so much).

      The "Many more" button (to get more stories) has never worked for me. This is across multiple computers and operating systems. I read less Slashdot because I simply can't easily get to the older stories.

      I'm sure it has something to do with my account setup, but -- bah. The new Slashdot is a train wreck.

    3. Re:The new slashdot interface by Evtim · · Score: 2

      Strange! /. always worked for me smooth as silk except very long threads can take some time to open. I am a lame Windows user and it worked just fine with XP+Firefox and now 7+Firefox.

      BUT, on the phone (HTC desire) - tragedy!! Stock browser does not scale the text properly. Opera mini scales OK, but refuses to display more than the 250 comments. Nothing helps - open in new tab, open in new window, the same window - it just does not work. View more stories sometimes works sometimes not but never works from the first try. The Dolphin mini browser - almost impossible to log in and I have the feeling it is often because of the ads disable function - somehow the Dolphin does not like it so after log in I am back at the main page but not logged in. Even more strange - the issue is gone if I am on WiFi but on 3G it is back. It really sucks because I get quite some mod points and do take the responsibility seriously - I read ALL comments and try to pick the good posts that went under the radar. Since I spend 2 hours a day commuting with train, that was a golden opportunity to exercise the mod points. Alas, I tried once giving mod points via the phone and that also went bad.

      I am not very good with computers and programming - am I missing something?

    4. Re:The new slashdot interface by Teckla · · Score: 2

      Strange! /. always worked for me smooth as silk except very long threads can take some time to open. I am a lame Windows user and it worked just fine with XP+Firefox and now 7+Firefox.

      My computer is a single core 1.66 GHz Atom, so I'm somewhat used to things being kind of slow, but Slashdot takes the cake. (Running Windows 7)

      I am not very good with computers and programming - am I missing something?

      I don't think you're missing anything. The new Slashdot is just poorly written.

  11. VS2010 and smartphones by MetalliQaZ · · Score: 2

    I have definitely noticed addition latency in the UI with VS2010, and it has always bugged me. I can't be certain if it is VS itself or if the underlying WPF is to blame. My current belief, and I have no facts to back this up, is that the VS UI is simply much more complicated than the "typical" use case that was targeted for WPF, and as a result, low-to-mid range computers fail to meet a human's expectations of UI latency.

    On a separate beef, why is it that so many people put up with the AWFUL latency on smartphones? Especially when browsing the web, it can sometimes become unusable. The phones get more and more powerful, but instead of making the last UI work, the designers just add more and more flashy crap instead. UI is just as slow but it looks cool in the ads.
    When I don't have a real computer nearby, I can use the android browser when I need to, because I recognize the flaws and can patiently work around them. It kills me to watch my girlfriend attempt to navigate the interface of her nook color. Usually goes something like this...
    1. press UI element
    2. no response, press harder (because that's what humans do when a button doesn't work)
    3. harder has no effect, start tapping repeatedly
    4. UI finally changes, menu pops up and immediately goes away, having tapped on an unknown selection.
    5. human gets mad, claims unit is broken, goes to check email on 5 year old PC.

    As an added bonus, the PC doesn't require you to put your fingers in the way of what you're trying to look at.

    -d

    --
    "Here Lies Philip J. Fry, named for his uncle, to carry on his spirit"
  12. Slashdot by Bobfrankly1 · · Score: 5, Insightful

    I had an incredibly insightful comment, but I forgot it while waiting 2ms for the comment interface to load. I remembered and forgot it again during the 10 seconds it took the preview to render.

  13. What the h&*)) is going on here? by rickb928 · · Score: 3, Insightful

    I read about this right here in January. And February.

    Seriously, how many times can you recycle the same story with slightly (and I mean slightly) different nuances, but the same frakking story?

    Next thing you know, I'll be reading another story on this with the angle 'women and children affected the most'.

    Slashdot is becoming the USA Today of the Internet. Isn't it time for another site upgrade?

    --
    deleting the extra space after periods so i can stay relevant, yeah.
  14. Skytopia article by MobyDisk · · Score: 2

    The first article in the summary has some silly ideas on how to fix this:

    What can we do reverse the onslaught of latency in all its forms? ... First off, we can make LCD (or future OLED/QLED) monitors run at 120 or even 240 frames per second.

    What?!?! 1) That is not possible and 2) That would not help. There are so many reasons for this I can't even list them all.

    First, there isn't an LCD panel in existence that actually responds that fast. Those phony 240 hz screens don't actually change the pixels 240 times per second. We don't need faster displays to solve a software problem.

    If the software provided a 1/60 second delay, that would be just fine. The issue is that we are not taking advantage of the refresh rates we have no - so increasing those rates doesn't help. Heck -- that's probably faster than the debouncing circuits in the controller!

    Compensating for a longer pipeline by increasing clock speed doesn't help anyway, because to get the higher rate you need to increase the pipeline more...

  15. Re:Java or Visual Studio 2010 anyone? by nomel · · Score: 2

    I believe they were talking about the Visual Studio 2010 interface. If you've used something from some years back, you'll understand how insanely slow doing they've managed to draw text. I think it's all incredibly hilarious watching everyone squirm. It makes me feel better when I think I must be getting old because people seem to program without any thought involved...just library calls.

  16. Lightning by formfeed · · Score: 2

    Sometimes in a thunderstorm you see lightning, but it can take several seconds till you hear thunder.

    Pretty bad design, imho.

    1. Re:Lightning by linear+a · · Score: 2

      Good design. They are pretty much simultaneous to the intended "user" of the lightning.

  17. Re:Java or Visual Studio 2010 anyone? by lgw · · Score: 3, Insightful

    Wow, I've seen no input lag on VS2010 at all - and I run it in a VM which is hosted on my slow-ass laptop, so it's pretty starved for resoruces. I wonder what I'm doing right here?

    --
    Socialism: a lie told by totalitarians and believed by fools.
  18. Really by geekoid · · Score: 4, Informative

    "(Java or Visual Studio 2010 anyone?"
    Really? do you even know what the hell you are talking about? OR did these two think pop into your skull and you use your meaty finger to pound out some sort of text in a vain effort to stay relevant?

    Replace:
    Java or Visual Studio 2010 anyone?
    With:
    Crappy programmers.

    And has anyone documented a repeatable real world test for 'bufferbloat' or is this still an academic issue?

    --
    The Kruger Dunning explains most post on /. http://en.wikipedia.org/wiki/Dunning%E2%80%93Kruger_effect
  19. Impatience... by MaWeiTao · · Score: 2

    This is one of the reasons why on all the devices and computers I use I disable animations when I'm permitted.

    I think the real problem, however, is that we've grown increasingly impatient. I notice it in myself. Some application takes over 3 seconds to open and I start getting agitated, wondering what the hell is taking so long.

    Think back to the earlier days of computing when it might take 30 seconds or more to get an application started. I recall on my PCjr booting up games and sitting there for a good minute while the drive ground away. That said, some games nowadays have some rather appalling load times. But look at what has to be loaded compared to those games from the 80s.

    I also recall trying to play games that were more demanding than my computer could handle. I'd hit a key and get an action a fraction of a second later. I got used to it, but it's something that would be intolerable today.

    Even using early versions of Windows and Mac OS was an exercise in patience, especially if something was going on in the background. And what about waiting for a simple website to load, especially over 56kbps? Hell, what about loading up text-only menus on your favorite BBS via 2400 baud?

    The simple fact is that we've been spoiled and as such have grown increasingly impatient over shrinking timescales. That said, given all the computing power at the tips of my fingers I do expect everything to be instant.

  20. It's all in engineering by tibit · · Score: 3, Informative

    The latency problem in non-networked applications is ultimately caused by poor software engineering, starting with system-provided APIs. Most of "bog standard" system libraries were designed for something entirely different than what they end up used for. The "normal" C I/O paradigm is used everywhere, yet it was really designed for batch applications, not for interactive use. The only way to do almost any filesystem and network interaction should be to submit a request, then react when the results come back, all the while being receptive to other "results" (events) coming in. Unfortunately, designing things this way requires a certain discipline and a mindset, and default APIs and "industry practices" simply don't encourage it at all.

    A correctly engineered system API should not have any blocking calls apart from the "wait for events" call, it's as simple as that. It's very rare that an application is only waiting for one thing to happen. Even something as simple as a UNIX cat has two file descriptors open, and simultaneously waits for stuff to come and and for stuff to finish going out, with a buffer in-between (I'm ignoring no-copy APIs for a moment). Coding it up as a read followed by a write is, at best, wishful thinking. Of course event-based programming is something that seems like a lot of extra work, but it's just a matter of getting used to doing things the right way.

    In fact, if you decide to code up your whole system in an entirely reactive way, you gain other benefits. By reactive I mean you could reduce every application thread's interface to a single processEvent(event), run-to-completion function that you implement. As it turns out, it becomes almost natural to get the guts of the processEvent() function implemented as a state machine. The state machine formalism often helps in producing better quality code, and it certainly makes it very easy to trace interaction with the outside world. Miro Samek shows a striking example: the supposedly "so simple it couldn't possibly go wrong" calculator example from old Visual Basic has several bugs that stem from its bug-prone yet commonplace design. The calculator's state is spread out in an ad-hoc manner in various variables, and the tests done on those variables in response to external UI events pretty much amount to a buggy reconstruction of a single state variable to drive a state machine.

    The state machine paradigm is in somewhat stark contrast to the way a typical GUI application is designed, where you have on_fooBar methods that get invoked when fooBar event happens. In the fooBar method it's up to you to verify that the application is in the correct state to do whatever fooBar calls for. This requires forethought, and status quo indicates that it's easy to get it wrong. Perhaps that's the reason: the de-facto mode of implementing reactions to external events is so broken that it's not used for much besides the GUI. Perhaps this is why "quick" system calls are usually done in line and end up blocking the whole application, or at least one thread, and those are not free either so why waste them with blocking APIs?! Apart from perhaps querying the current time or current username, there are really no "quick" system calls. Simple things like listing a directory or getting a key's value from the registry can potentially take seconds if your drive is thrashing around due to high I/O demand, or if the network happens to be slow.

    Of course the line has to be drawn somewhere, so let's assume that paging of code, libraries and heap is something we should not worry about because it cannot be helped much. At that point one realizes that indiscriminate memmapping of data files can be problematic in itself: a memory-mapped file is, after all, supposed to hide the fact that you are doing a request-response that can be either very fast or very, very slow. The latter is something you should explicitly handle, and with memmap it's at best cumbersome: you have to use some API to check if given page is av

    --
    A successful API design takes a mixture of software design and pedagogy.