Possible Duplicate:
Advantage of using Thread.Start vs QueueUserWorkItem
If i want to execute a method through a thread ,so i usually use System.Thread like this
Thread th = new Thread(Test_Progress);
th.Start();
but my colleague told me that using the ThreadPool.QueueUserWorkItem like the following is better
ThreadPool.QueueUserWorkItem(new WaitCallback(Test_Progress),(object)true );
So is there any difference like performance and how the it’s handled ??
ThreadPoolis pool (collection) of threads and using it will pick a thread from this pool and execute your method inside that thread where as Thread object created new Thread.This is a general concept around Object pooling i.e when in your application you need to use several objects one option is to create a pool of those object and pick object from this pool use it and then put back it in pool, this is done in those cases where the object creation is expensive and this also leads to better scalability. In case of threads if your application creates many threads then it will crawl very slowly because of context switching hence it is prefered to use Thread pool. Another example of same concept is SQL Connection pool.