Le Jul 12, 2012 à 8:26 AM, Tobias Oberstein email@example.com a écrit :
As far as I know, all of the implementations of POSIX AIO are relatively low quality. They include a number of tricky, low-level constraints (eg, char* to write must be page aligned) as well as some sad functional limitations such as blocking instead of being asynchronous if too many AIOs are started concurrently (with this limit applying to AIOs *system wide* in some cases).
If there are any good implementations, or prospects of thes implementations getting good sometime in the near future, it might be worth exploring, but I don't think it's something we can rely on now.
I have been looking into "libuv" a little .. it not only provides wrappers around epoll/kqueue/IOCP for networking, but also provides a unified API for asynchronous File I/O .. I _think_ on Posix it uses the usual background thread pool approach to work around flaky AIO (and also to provide asynch _open_ and everyhting else from Posix File IO), but it also on Windows uses Overlapped IO when possible (which is the right thing to do there, since asynch File IO works since Windows NT 3.5 using that). It also does asynch DNS lookup etc.
libuv is a giant pile of new, unaudited C code that didn't even have a passing test suite until a month or two ago. Please feel free to write a reactor for it; better interop with node.js would be great, but it's definitely not a place we should go looking for new core features.
The tricky part of this is not implementation; on today's OSes (except maaaaybe solaris?), you just have to use threads or subprocesses, end of story. The tricky part is finding an interface for things that is nice and general and isn't just a Deferred that fires with a Deferred with a Deferred on top.
So, http://tm.tl/1956, probably. If we're all lucky I'll have some time to move the ball on that on Saturday.