thread of pools

bridged with qnx.rtos
Post Reply
ouoguep jerome

thread of pools

Post by ouoguep jerome » Fri Jun 15, 2007 11:08 am

is what somebody can explain me how a thread of pool functions because I
will like to write a server code which makes it possible to communicate with
several clients

maschoen

RE: thread of pools

Post by maschoen » Fri Jun 15, 2007 5:50 pm

If you use a single threaded resource manager, then each of your
clients will be queued waiting for the resource manager to get to
them. Using a thread pool, a client will at most have to wait for
other clients of higher priority to finish.
If your resource manager has to block occasionally, for example
waiting for I/O or an event then having multiple threads can make it
much more efficient.

There is overhead in creating a thread, but also in having one ready,
so you configure your thread pool by indicating a minimum and maximum
of free threads you want available waiting, and the increment to
create when the number goes below the minimum. A multi-threaded
resource manager can be even more efficient if you have multiple
processors. If the work your resource manager is just a short cpu
bound piece of code that never blocks, then there is little gained by
having a thread pool.

Post Reply

Return to “qnx.rtos”