Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Thread.Start() vs BackgroundWorker

what is the difference between create thread using thread.start and using background worker ?

like image 801
muthukumarm Avatar asked Dec 16 '09 08:12

muthukumarm


2 Answers

Assuming you are talking about .NET a BackgroundWorker uses a thread from the thread pool (it doesn't create a new thread but it might block if there are no threads available in the pool) while Thread.Start starts a new managed thread.

like image 82
Darin Dimitrov Avatar answered Oct 24 '22 01:10

Darin Dimitrov


A background worker uses a thread from the thread pool. Thread pool threads are regular threads but as they are reused the cost of starting them is amortized. As the cost of starting a thread may be significant the thread pool is ideal for short running tasks.

like image 40
Brian Rasmussen Avatar answered Oct 24 '22 01:10

Brian Rasmussen