Wednesday, November 13, 2013

Linux Process Management



Linux Process Management

  • Linux is a multitasking system
  • Multiple programs can be executed at the same time
  • Ultimately, a program needs to be executed by a CPU
  • If there is only one CPU, how multiple programs can be executed at the same time? By time sharing
  • That is, all programs are claimed to be executing. In fact, most of them are waiting for the CPU
  • A program that is claimed to be executing is called a process


For a multitasking system, a process has at least the following three states

Linux Process Management

Ready state
 – All processes that are ready to execute but without the CPU are at the ready state
 – If there is only 1 CPU in the system, all processes except one are at the ready state
Running state
 – The process that actually possesses the CPU is at the running state
 –If there is only 1 CPU in the system, at most there is only one process is at the running state
Sleeping state
 – The process that is waiting for other resources, e.g. I/O, is at the sleeping state
 - Processes will alternatively get into the CPU one after the other (called the round robin scheme)
 - process will be “in” a CPU for a very short time (quantum)
 - For Linux, each quantum is about 100msec
At the time that a process is selected to be “in” the CPU
 – It goes from ready state to running state
After that, it will be swapped out
 – It goes from running state back to ready state
Or it may due to the waiting of an I/O device, e.g. mouse
 – It goes from running state to sleeping state
When obtaining the required resource
 - It goes from sleeping state to ready state 

Linux Process Management

No comments:

Post a Comment

Linux Tips and tricks,Online Linux Helpers