by Christof
25. November 2009 22:52
If you deal with multithreaded programming in .net , you have the choice between ThreadPool and Thread. But what exactly is the difference between them?
ThreadPool
Server Applications (like the Windows Home Server) often use ThreadPools.
The Threadpool is suitable for short running work items and has a Thread limitation of 25 Threads per Application.
There is only one pool per process. You can't create a new one and you can't cancel the work items in the ThreadPool.
Threads
A Thread is the entity within a process that can be scheduled for execution. In comparison with ThreadPools, there is no managing of the remaining divided CPU time. You can start as many Threads as you like. A Thread has many functions/methods to start/stop and manage the Threads.
If you need a lot of Threads use a ThreadPool, otherwise you can take the easy way with a simple Thread.