Linux nice command: Run Process With Modified Scheduling Priority ( nicenesses )

Linux nice command: Run Process With Modified Scheduling Priority ( nicenesses )

The nice command is a Linux utility that allows you to run a process with a modified scheduling priority, also known as a niceness. By default, processes in Linux are assigned a niceness of 0, which means that they are given equal priority to other processes. The nice command allows you to increase or decrease the niceness of a process, which can affect how much CPU time the process receives relative to other processes.

To run a process with a modified niceness using the nice command, follow these steps:

  1. Open a terminal.

  2. Enter the nice command followed by the command you want to run and any arguments. For example, to run the sleep command with a niceness of 10, you would use the following command:

refer ‮tual:ot‬turi.com
nice -n 10 sleep 60

This will run the sleep command with a niceness of 10, which means that it will have a lower priority than processes with a higher niceness.

You can also use the -n option to specify a negative niceness, which will increase the priority of the process relative to other processes. For example:

nice -n -10 sleep 60

This will run the sleep command with a niceness of -10, which means that it will have a higher priority than processes with a lower niceness.

Keep in mind that the nice command can only modify the scheduling priority of a process, and it does not guarantee that the process will receive a certain amount of CPU time. The actual amount of CPU time that a process receives is determined by the operating system's scheduling algorithm.

Created Time:2017-10-16 14:38:53  Author:lautturi