Click here to Skip to main content
15,890,282 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
I'm being afraid if a mass usage of BackgroundWorker control in a C# program will make the program slow and poorly responsible. So tell me if there is any such or any other problem if BackgroundWorker control used massively?
Posted
Comments
BillWoodruff 3-Nov-11 22:24pm    
You have two excellent answers here; my one comment is that: to really reply to your question you need to explain what "massively" and "mass usage" mean.

"Mass usage" could mean using a lot of different threads via BackGroundWorker(s). "Massively" could mean using one BackGroundWorker that made heavy demand on CPU bandwidth.

Please specify the scenario.
[no name] 4-Nov-11 3:16am    
Its "Mass usage" scenario from your comment. Otherwise, if a BGW that made heavy demand on CPU bandwidth, it will make the program slow indeed.

I believe that BackgroundWorkers (and .Net 4 Tasks) use a thread pool, and will make appropriate use of threads. Of course, if you're trying to do too much at once the program will become slow – that's true however you divide up the work. But I don't think BackgroundWorkers will give you massive overhead problems.
 
Share this answer
 
Comments
[no name] 3-Nov-11 8:39am    
Agreed. There is a point when adding more threads doesn't give you any returns and starts to have negative impacts on performance
DaveyM69 3-Nov-11 10:39am    
Correct - 5.
The main reason a background worker would have a bad effect on performance would be too much communication between the background process and the main thread (for ex. calling ReportProgress too often or locking objects too much).
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900