Book Image

Linux Shell Scripting Essentials

Book Image

Linux Shell Scripting Essentials

Overview of this book

Table of Contents (15 chapters)
Linux Shell Scripting Essentials
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Process scheduling priorities


During a process lifetime, it may need CPU and other resources to keep executing normally. We know that multiple processes are running simultaneously in a system and they may need a CPU to complete an operation. To share the available CPUs and resources, process scheduling is done so that each process gets a chance to make use of the CPU. When a process gets created, an initial priority value is set. Depending upon the priority value, the process gets the CPU time.

The process scheduling priority range is from -20 to 19. This value is also called a nice value. The lower the nice value, the higher is the scheduling priority of a process. So, the process with -20 will have the highest scheduling priority and the process with the nice value 19 will have the lowest scheduling priority.

To see the nice value of a process, the ps or top command can be used. The corresponding nice value of a process is available in the NI column:

$ ps -l

In the ps output, we can see...