osx - Using kqueue for simple async io -


how 1 use kqueue() doing simple async r/w's?

it's inception seems replacement epoll(), , select(), , problem trying solve scaling listening on large number of file descriptors changes.

however, if want like: read data descriptor x, let me know when data ready - how api support that? unless there complimentary api kicking-off non-blocking r/w requests, don't see way other managing thread pool myself, defeats purpose.

is wrong tool job? stick aio?

aside: i'm not savvy how modern bsd-based os internals work - kqueue() built on aio or visa-versa? imagine depend on whether os io subsystem system fundamentally interrupt-driven or polling.

none of apis mention, aside aio itself, has asynchronous io, such.

none of select(), poll(), epoll(), or kqueue() helpful reading file systems (or "vnodes"). file descriptors file system items "ready", if file system network-mounted , there network latency such read block significant time. choice there avoid blocking aio or, on platform gcd, dispatch io.

the use of kqueue() , other kinds of file descriptors such sockets, pipes, etc. kernel maintains buffers , there's "event" (like arrival of packet or write pipe) changes when data available. of course, kqueue() can monitor variety of other input sources, mach ports, processes, etc.

(you can use kqueue() reads of vnodes, tells when file position not @ end of file. so, might use informed when file has been extended or truncated. doesn't mean read not block.)

i don't think either kqueue() or aio built on other. why think were?


Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -