Click here to Skip to main content
15,616,520 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Hi I wrote an application that is processing on a lot of variables so it takes a hole lot of time to finish it's job and only takes about %25 of my CPU i wounder if there's any way that i can increase it up to %80 or more.
thanks
Posted

The chances are that you have a four-core system: so one thread running flat out will only ever be able to use a maximum of 25% of your available CPU resources. To increase that and use further cores, you would have to break your task into 4 "chunks" and move each chunk to a separate thread. See the BackgroundWorker Class[^] for a simple way to do this.
 
Share this answer
 
To add to OriginalGriff's answer, I would prefer using Task[^] instead of Backgroundworker. Mainly because using tasks let's you handle more complicated situations.

You can read about the differences for both classes for example from http://blog.stephencleary.com/2013/05/taskrun-vs-backgroundworker-intro.html[^]
 
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