What is nice value? How to change the priority of a linux process

What is nice value? How to change the priority of a linux process

Nice value is a value that increment and decrements the priority of process. The nice value is come from nice () system calls. To calculate the nice value of a process use this equation

Priority = (“recent CPU usage”/constant) + (base-priority)+(nice value)

The nice value is supplied by only administrator. The system call of nice() is applied for on process that are running. The one process’s nice value is not affect the another process’s nice value. A process that are waiting and running for execute has own priority to run. You can change the priority of nice value below the management of sever processor. The nice value of process is determines the priority of a process.

Nice value is a value that is integer and range start from -20 to 19. The default range of nice value is “0”. The high priority of nice value to CPU is -20.

If you want to find the nice value of process then you can use the TOP and PS commands following command.

If you want to see the process of nice value with their process ID then you can use the following commands. The difference between TOP and PS command is that TOP command display the dynamic output and PS command displays the static command.

Syntax:

# top

# ps -0 comn,nice –p PID.

If you want to set and reset the nice value of a process then you can use the nice and renice command. With the help of nice command you can start the process with your own nice value.

Syntax:

# nice $NI command

This command will set the nice value to process.

For Instance:

# nice -20 ping localhost

The ping command is used to show the nice.

Reset the Priority of Existing Process:

If you want to reset the nice value of existing process then you can use the following command

Syntax:

# renice $NI – p PID

For Instance:

# renice 0 – p 25678

25930: old priority 19, new priority 0

# ps – o comm, nice – p 25678

COMMAND NI

Ping 0
Author
Jaishree
Views
3,308
First release
Last update
Rating
0.00 star(s) 0 ratings
Top