You can also introduce slow sleep into the main loop that binds the processor.
For example, this is often done by game loops - calling Thread.CurrentThread.Sleep(1); once per frame will force most games to use a 100% processor to use a 1-2% processor and still allow reasonable access.
----- Edit ------
There are potential advantages to hibernation while lowering the priority of a process or thread. The main two:
- Sleep mode allows you to control how much CPU time you are giving up. If you lower your priority, and there are other processes of processor starvation, you can refuse more processor time than you want. [This is why I did not do Sleep (0) either, since this does not always refuse CPU time, although it does refuse some. I did this on embedded systems with longer dreams to reduce CPU usage.]
- If your goal is to reduce overall CPU usage, lowering the priority of the process will not help if nothing works. You will still have a 100% processor. This can potentially be useful if you are trying to reduce power consumption (save energy costs) or try to reduce heat depending on the architecture of your system.
----- From the original -----
For other style apps (UIs), another option is to reorganize your procedure as asynchronous, partition your processing and process it in blocks in a call, subscribing to something like Application.OnApplicationIdle. This may allow your user interface to remain somewhat responsive, as it will work in pins.
If this is a mathematical procedure, and it performs a lot of calculations, then reducing the priority of the thread and the ability to use most of the available processors may be better.
source share