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
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
No comments:
Post a Comment