IO Completion port Linux equivalent

user3861866

Windows OS, A threading model where ThreadPool associated with an IO Completion, ~releasing~ a thread each time an Async IO is completed, the ~released~ thread is then used to deal with the IO completion.

While linux select can be used for async IO it doesn't seem to support the IO Completion / ThreadPool logic.

Is there any Linux equivalent to the IO Completion / ThreadPool above threading model ?

Wyzard

I don't know of anything that does that directly, but you can combine a select() loop with a thread pool of your own to get similar behavior. When select() returns and you examine your fd_sets to see which file descriptors are ready, push each of those descriptors to a thread pool for processing. You'll still need a main thread to run the select() loop, independent of the thread pool for processing the I/O events.

Most of the complexity in this approach will be in how you keep track of which descriptors need to be included in the select() call at each iteration, and in the thread pool itself (since POSIX provides threads but not a standard thread pool API).

You might be interested in using a library like GLib, which provides a modular main loop that helps with polling on a varying set of file descriptors, as well as a thread pool implementation.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related