Have you ever dreamed of running a command from terminal, limiting the amount of allocated resources to that command?
Well, the solution presented here can help you to continue working normally even moments after executing jobs that are usually "too heavy" for you. hardware and that they generally "hang" the system. |
Processor (CPU)
The nice command allows modifying the priority of a process over the rest within the system.
The Linux kernel is in charge of planning and allocating CPU time to each of the processes that run on the system. The available priority assignment range is -20 to 20, with -20 being the highest priority and 20 being the lowest.
Thanks to nice we can ensure that in times of high CPU usage the appropriate processes receive the highest% of it.
The syntax for the nice command is as follows:
nice -nCOMMAND
So, if we wanted to run a process with priority 10 we would do the following:
nice -n10 / usr / bin / convert file.gif file.jpg
Hard drive
Similar to nice is ionice, with the difference that the latter limits access to the hard drive.
An example of its use would be the following:
ionice -c2 -n7 / usr / bin / convert file.gif file.jpg
-c2 is "best effort", and -n7 is the lowest priority within "best effort". In this way, this command will have a lower priority within the I / O (input / output) queue than the rest of the running tasks.
ionice -c3 / usr / bin / convert file.gif file.jpg
-c3 (no need to clarify a priority level) means "inactive only". Jobs with -c3 assigned to them will only run when the disk is idle, which means that the activity will have no impact on the execution of the rest of the tasks, but will take much longer to execute itself.
I need to mention the renice command, which is used to modify the priority of the processes already running
Interesting! Thanks for the contribution!
Cheers! Paul.
And how is that done in win? d8-B