It is not clear why people relate to programs that load the processor at 100%, as if these programs endlessly kick defenseless little puppies. It seems to them that the column in the Task Manager is a counter: how many puppies a second the program kicks.
Take it easy. If the program loads the processor at 100% and does nothing at the same time, then, perhaps, it can be attributed to shameless pincers puppies. But if the program works, and uses all 100% for its work, then, on the contrary, it is worth praising for its effective work!
Imagine: let your processor load never exceed 50%. It turns out that you use the computer only half; Does this mean that you just overpaid for him a double price? A task that would complete in five minutes with a full load, you have completed in ten minutes; but the precious download indicator never crosses an imaginary “red line”. (Note: there is no red line on this indicator in Windows.)
')
For example, one programmer asked how to change the program so that it would load the processor less, but at the same time it did the work “in a reasonable time”. Why should I reduce the load? Why, instead of finishing the work as quickly as possible, should the program worry about the digits in the Task Manager?
If you were in charge of a bank where ten clerks work, and a crowd of visitors would break in - would you let them in so that all ten clerks work, or leave visitors waiting in line to load the clerks no more than half?
“When the end would end all, - how simple! Cum all at once! ”If you have already taken the processor out of a power-saving mode, use it in full, otherwise it is like buying a bottle of water, drinking half and throwing half away, “to save the world's fresh water supply”. If you “save” the processor load, and the execution of your task takes two times, then you double the energy consumption.
If you have a low-priority task, and you do not want it to take up CPU time from more important tasks, simply set your task to low priority. As long as there are no high-priority tasks in the system, your processor will use full; and when high-priority tasks appear, your processor will yield to them.
Or, if your task is “normal”, and you want it to be performed simultaneously with other “normal” tasks, leave it to the usual priority. Now, from time to time, it will take away the processor from other tasks - only in this way can tasks be executed simultaneously. If you want your task to more often return the processor to the rest, interspersing your code with calls to
Sleep(0)
. If there are other tasks in the system, waiting until the processor is free, control will be transferred to them; and if there are no such tasks, then after you call
Sleep
, yours will immediately continue.
In all these cases, processor utilization will remain 100% until your task is completed. And this is great. Take care only that after the completion of the task the download returns to 0%. Continuing to use 100% even when the program does nothing already is the same as kicking puppies.
Comment 1: Similarly, other counters are misinterpreted, for example, the used memory counter. If the system uses only half the memory of the available volume, it means that you have overpaid for the memory twice. Use it all! What is the point to save after you have already bought it?
Comment 2: The unresponsiveness of the system is in no way connected with the programs that load the processor. Such programs fully use all the time that the OS provides them,
and no more . They do not "capture" the computer, taking it away from other programs.
If the OS "unfairly" distributes the processor time between programs, then these are its problems, and not the problem of programs involving all the resources allocated to them. Or, more often, the matter is in the wrong priorities of the processes.