Re: aio_read/write versus O_NONBLOCK



On Tue, 27 May 2008 15:55:07 -0700 (PDT) David Schwartz <davids@xxxxxxxxxxxxx> wrote:
| On May 27, 11:49?am, William Ahern <will...@xxxxxxxxxxxxxxxxxxxxxxxxx>
| wrote:
|
|> > So what should waiting do in this case? Should it be required to start
|> > a read ahead, changing the state of the socket so that there is an
|> > asynchronous operation?
|
|> The same thing it has always done, return readiness.
|
| Which is what? Are you suggesting it should say that the file is not
| ready for reading (since the data is not available) and that it never
| should return ready no matter how long you wait, perhaps unless some
| other process coincidentally happens to cause the first few bytes of
| data to be resident in memory?

Being "ready to read" does not mean the actual data is in RAM. It just means
you can proceed to do the read call if your program has an interest in
reading something (which presumably it does if you included that descriptor
for reading in poll or select).


|> When an actual I/O
|> request blocks, the kernel then has a sufficient hint to queue a request;
|> it's the prior request that then gets polled on.
|
| Exactly. You want AIO, not non-blocking semantics. You want to issue a
| request and then know what happens to it, not wait for something
| external to happen.

AIO is not necessary outside of the small thinking box you use.


|> From then on, the kernel
|> follows in lock-step; we've swapped the producer-consumer ordering--so that
|> an open doesn't necessarily load a page on a whim--and alls well w/ the
|> world.
|
| Exactly. What you really want is AIO semantics, and you could possibly
| fake it in ugly and unsatisfying ways with non-blocking semantics.

Faked? Just follow the logic and it can work.

--
|WARNING: Due to extreme spam, googlegroups.com is blocked. Due to ignorance |
| by the abuse department, bellsouth.net is blocked. If you post to |
| Usenet from these places, find another Usenet provider ASAP. |
| Phil Howard KA9WGN (email for humans: first name in lower case at ipal.net) |
.



Relevant Pages

  • Re: readahead on directories
    ... Why create a new thread context, switch to it, put a request in the ... queue, then sleep, when you could just drop the request in the queue in ... Because tests have found that it's sometimes faster than AIO anyway! ... Evigny's concern about sequantially reading blocks one by one ...
    (Linux-Kernel)
  • Re: aio_read/write versus O_NONBLOCK
    ... The only actual difference is that you want to reap the request ... In the interests of purity AIO renders billions of lines of existing, ... worse--have trouble integrating IOCP into their portable applications, ... though w/o IOCP the scalability of networking apps in Win32 is nil.) ...
    (comp.unix.programmer)
  • RE: Profiling HttpListener app
    ... Generally string reading/manipulation operations is expensive especially ... Are the "reading request stream" ... the "ReadToEnd" method's reading loop may take the most time here. ... Any idea why the read would be such a big expense? ...
    (microsoft.public.dotnet.framework)
  • Re: Need help finding an underwater Baetis fly
    ... And he loves to stalk too. ... For some unexplained reason, Giles is actually endearing. ... my request and call me a "nitwit". ... the only way to ensure avoidance of unpleasant reading matter is ...
    (rec.outdoors.fishing.fly)
  • Re: [3/4] kevent: AIO, aio_sendfile() implementation.
    ... POSIX AIO. ... Here are the descriptions for the AIO completion notification and ... for use when the request completes. ... for signaling a thread along with ...
    (Linux-Kernel)