3.2 Process Scheduling
Objectives
We would like to :
- Discuss topics related to scheduling
Notes
- The process scheduler or simply scheduler selects the next process to run from a set of ready processes.
- We know that each CPU can run one process at a time.
- They discuss two different types of processes
- Figure 3.2 page 113 shows a series of queues.
- This is called a queuing diagram.
- ready or runtime queue for tasks that are ready to be executed.
- wait queue for tasks that are waiting on something.
- The life of a process
- It starts and is added to the ready queue.
- At some point it is removed from the ready queue and allowed to execute
- It uses the allotted time
- It is placed back into the ready queue.
- It needs something.
- It is placed in the appropriate queue for the need
- The need is fulfilled
- The process is placed into the ready queue
- At some time the process is finished executing
- The PCB and all other data is released.
- The CPU scheduler is responsible for selecting a ready task to run.
- It must
- Remove the currently running process from the CPU
- Save the state
- registers, stack, heap, ...
- Move the PCB to the correct queue.
- Move the new process into the CPU
- This is called a context switch.
- See the picture page 114.
- It is supported at various levels by the hardware
- And may or may not involve writing to the hard drive.
- If we write to hard disk, this is known as swapping
- The old process is swapped out
- The new process is swapped in.
- Memory management is involved in this process