K
K. Frank
Hello Group!
Now that C++11 offers an atomic / synchronization / threading model,
has
an IO-Completion-Port-like synchronization object been implemented?
IO Completion Ports are discussed in MSDN:
http://msdn.microsoft.com/en-us/library/aa365198(VS.85).aspx
As a reminder, the Windows IO Completion Port has the following
interesting
feature: The IO Completion Port (as I understand it) controls a LIFO
queue of worker threads that services a FIFO queue of "things to do"
(the so-called IO Completion Packets). The interesting point is that
the IO Completion Port has a "concurrency value" and will not release
a worker thread to service the "packet" queue unless the number of
actively running threads (controlled by the IO Completion Port) is
less than the concurrency value. That is, the IO Completion Port
tries to keep the number of actively running threads equal to the
concurrency value.
The point of this is that you can set the concurrency value equal to
the number of processors on the machine. Now you can keep each
processor busy running its own active thread, but you don't slow
things down by gratuitously context switching to other threads in
thread pool.
This seems like a very good approach to getting good performance out
of a multi-core machine if you can partition your workload into to
"things to do" that can naturally be serviced by a thread pool.
(I think Microsoft designed IO Completion Ports with asynchronous
I/O in mind, but I view them as offering a more generally useful
approach to thread pools.)
Does C++11 offer the ability to implement something similar in a
semi-portable way? Are there any implementations out there?
I'm pretty sure that there is nothing like this in std::thread.
I've also looked at Boost.Asio, and didn't see anything along
these lines. (The Windows implementation of Boost.Asio appears
to use native IO Completion Ports under the hood, but appears
not to expose this functionality.)
So, are there any IO-Completion-Port-like thingies in C++ land,
or anything on the horizon?
Thanks.
K. Frank
Now that C++11 offers an atomic / synchronization / threading model,
has
an IO-Completion-Port-like synchronization object been implemented?
IO Completion Ports are discussed in MSDN:
http://msdn.microsoft.com/en-us/library/aa365198(VS.85).aspx
As a reminder, the Windows IO Completion Port has the following
interesting
feature: The IO Completion Port (as I understand it) controls a LIFO
queue of worker threads that services a FIFO queue of "things to do"
(the so-called IO Completion Packets). The interesting point is that
the IO Completion Port has a "concurrency value" and will not release
a worker thread to service the "packet" queue unless the number of
actively running threads (controlled by the IO Completion Port) is
less than the concurrency value. That is, the IO Completion Port
tries to keep the number of actively running threads equal to the
concurrency value.
The point of this is that you can set the concurrency value equal to
the number of processors on the machine. Now you can keep each
processor busy running its own active thread, but you don't slow
things down by gratuitously context switching to other threads in
thread pool.
This seems like a very good approach to getting good performance out
of a multi-core machine if you can partition your workload into to
"things to do" that can naturally be serviced by a thread pool.
(I think Microsoft designed IO Completion Ports with asynchronous
I/O in mind, but I view them as offering a more generally useful
approach to thread pools.)
Does C++11 offer the ability to implement something similar in a
semi-portable way? Are there any implementations out there?
I'm pretty sure that there is nothing like this in std::thread.
I've also looked at Boost.Asio, and didn't see anything along
these lines. (The Windows implementation of Boost.Asio appears
to use native IO Completion Ports under the hood, but appears
not to expose this functionality.)
So, are there any IO-Completion-Port-like thingies in C++ land,
or anything on the horizon?
Thanks.
K. Frank