linux-aio icon indicating copy to clipboard operation
linux-aio copied to clipboard

Lack of new threads.

Open twopieman opened this issue 6 years ago • 1 comments

Please correct me if I am wrong since I am basically transitioning over from windows to linux and am slowly building my mental model around Linux.

This application seems to in a loop submit an IO request and then try and reap the completion on that same thread, this seems counter-intuitive to how i think async IO is meant to be used. Ideally you would have a thread\ bunch of threads perform I/O's or submit I/O's (in Linux AIO jargon) and then have a separate pool of threads reaping the I/O completions. The way this sample application is written it simply performs the I/O in a very synchronous manner even though it is using Linux AIO under the covers.

I am interested in your thoughts around this.

twopieman avatar Dec 26 '19 22:12 twopieman

I believe Linux AIO is threadsafe: you can submit requests from several threads on the same io_context_t. However, you can also use just one thread, and the I/O will be done in parallel. Both are valid patterns.

littledan avatar Feb 17 '20 14:02 littledan