question about threadPool 
Author Message
 question about threadPool

I start learning C# not long ago.I have two questions about threadPool.

1.How does the threadPool manage threads?How different from don't use the
threadPool?Or it's similar with database connection pool?

2.What is the advantage of it?When do I use it?Should I use the threadPool
if the work items are not related to a wait operation?

thanks.



Sun, 21 Nov 2004 15:12:10 GMT  
 question about threadPool

Quote:
>1.How does the threadPool manage threads?

It manages about (processors*2+1) threads for start and
creates/removes threads dynamically due to needs.

How different from don't use the

Quote:
>threadPool?

You will need create/manage/remove threads handly

Quote:
>2.What is the advantage of it?

Automatization of thread management

When do I use it?

Anytime you have amount of independent work items that
consume external resources and can benefit from
parallelization(or you have more than one processors)

Should I use the threadPool

Quote:
>if the work items are not related to a wait operation?

Why not? Depend on your needs (look previous question)


Sun, 21 Nov 2004 15:59:31 GMT  
 question about threadPool
Thanks,Eliyahu.
But I have not understand completely.What can i get when i use the
threadPool instead of Thread ?Reduce coding of create/manage/remove threads
or coding of  manage external resources(or others need
synchronization),performance,or others?


Sun, 21 Nov 2004 17:16:54 GMT  
 question about threadPool
Actually, only reduce coding of create/manage/remove
threads
and a little simplify synchronization).
But not performance.


Sun, 21 Nov 2004 18:58:29 GMT  
 question about threadPool
Thread pools do increase performance in a lot of situations.  For example,
it's better to have a pool of say 10 threads processing 1000 client requests
as opposed to creating 1000 threads that process the requests independently.

Brian



Quote:
> Actually, only reduce coding of create/manage/remove
> threads
> and a little simplify synchronization).
> But not performance.



Mon, 22 Nov 2004 00:19:37 GMT  
 question about threadPool
The case you said is like pool of database connection,but I can't understand
how 10 threads process 1000 client requests.Or I create two thread that have
same process,threadPool create one actually?Just about it nonplus me.


Quote:
> Thread pools do increase performance in a lot of situations.  For example,
> it's better to have a pool of say 10 threads processing 1000 client
requests
> as opposed to creating 1000 threads that process the requests
independently.

> Brian



Mon, 22 Nov 2004 09:21:36 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. ThreadPool question

2. ThreadPool possible bug? [NUnit test included]

3. ThreadPool and workers

4. ThreadPool yes or no

5. What to do when ThreadPool.GetAvailableThreads==0?

6. Controls & threadpool

7. ThreadPool help

8. ThreadPool Class.

9. limiting workitems in the threadpool ?

10. Threadpool and application resource cleanup

11. Problems with threadpool/ISAPI/MFC!

12. Bug with ThreadPool and HttpRequest

 

 
Powered by phpBB® Forum Software