News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Thread Pool anyone ?

Started by James Ladd, May 26, 2006, 02:39:10 AM

Previous topic - Next topic

James Ladd

Im working on an implementation of a Thread Pool for my project and will post
the code when done.

Im following some excellent work done here
http://www.cs.rochester.edu/u/michael/PODC96.html
which promises to maximize the concurrency of the pool.

I recommend reading the work done by these gents as it's very good.

If anyone has comments or suggestions then please send them through.
I hope to post the first cut of the code in the very near future.

Rgs, James.

James Ladd

Aawe, guess no one needs a thread pool.  :(

asmfan

Some time ago i was writing a multithreaded huge matrices multiplication in c++... The first version had a thread pool, the next one had a pool of tasks which is more correct because any attached thread could get its task... I distributed the tasks between any amount of threads and not vice versa... Conclusion - pool of tasks is more flexible. Any thread can attach to pool and have a task if pool isn't empty...
Russia is a weird place

sluggy

Quote from: James Ladd on May 29, 2006, 08:58:06 AM
Aawe, guess no one needs a thread pool.  :(
No, you will probably find that not many here are doing stuff complex enough to need a thread pool. Or they are not using modern design patterns like MVC which work best when used with threads. Personally i think a thread pool would be great  :wink

James Ladd

Thanks for the replies.

asmfan - Intertesting take on the pool idea.

sluggy

Quote from: asmfan on May 29, 2006, 11:05:21 AM
Conclusion - pool of tasks is more flexible. Any thread can attach to pool and have a task if pool isn't empty...
I have had to use this methodology before as well (in a notification system that was fed from a database). It isn't more flexible, it is just the solution you use when you have finite resources to handle an infinite number of regularly occurring tasks. The thread pool is what you have when you have a small number of tasks whose frequency cannot be predicted, or you have tasks that must be completed as quickly as possible (hence their use in some UI design patterns - the UI needs to make a transition that must take a short a time as possible but still not interfere with the rest of the UI).

A little too much detail maybe, but hopefully of some use to somebody  :U


James Ladd

My requirement for a thread pool is to handle lots of small but unpredictable
tasks that need to be done as a result of network IO using a
Non-blocking, Overlapped IO subsystem.

So I need a thread pool that is fast but also capable of handling more
than one type of task. Hence the pool will allow the user to submit
a task to be handled by the threads in the pool.

The API for the thread pool is being discussed here:
http://www.masm32.com/board/index.php?topic=4890.0