How to increase the priority for a task in linux machine?
What I've Done So Far: After small research i found that we can increase the priority to a task using NICE command and if we want to increase the priority for an existing task, then we can also use RENICE command
But my problem:
-
In some tutorials its mentioned that, NICE values vary from 0 to 99, But in some tutorials states that NICE values vary from -20 to 19. Which one is correct?
-
How to increase the NICE value for an GUI task? If we are doing copy using terminal then I can increase its priority using NICE command But How to increase the priority of a task done using GUI(for ex: copying files from USB to System through GUI)
-
Is that possible to set the priority of a task for the life time? I want to set highest priority for "COPYING FILES IN SYSTEM(using GUI) permanently
Is there anyone who can help me to set the highest priority for a task(task done through GUI)?
Best Answer
I think you should ask in Unix & Linux but in any case, the ones that say that NICE values for CPU in Linux vary from 0 to 99 are just for Real Time OS. The nice values are between -20 to 20, being -20 the higher priority, in normal (the one that most of users uses) *NIX kernels for CPU. Which is for most cases.
Also, the file copying wouldn't need actually that much CPU (depending the filesystems) but the I/O priority. From kernel 2.6.26 the ionice values are determined by the CPU nice values using the following formulae:
Also, all process (unless modified source code) starts with "Best effort" priority class which uses the formulae above. But, in any case, you probably don't need to set this as default.
A way to set the I/O priority to start a process is doing:
Process that would like to set/get their own I/O scheduling class and priority should use the ioprio_set and ioprio_get functions.
Also a nice warning from Linux Poison:
Sources: