Reputation: 753
I am having C# run a process in a new thread. The process takes 95 - 100% of my CPU. Is there a way I can tell the process to use less CPU? Do I need to tell the thread to do less CPU or the process?
Upvotes: 1
Views: 311
Reputation: 2882
There's no direct way to say "use less CPU". It seems like your operation is CPU Bound
The best way to keep the CPU from being constantly burning at 100% utilization, is to invoke some direct threading control. Put your main unit of work in a thread and call Thread.Sleep after a unit of work has been executed. As part of setting up a thread you can also use Thread.Priority to set the priority (as you would via Task Manager).
Upvotes: 3