The scheduler dispatches the process to CPU to run the process. Once the execution is completed, there will be deallocation of memories which was allocated run the program, so the process gets terminated.
There are two major cause for preemption from running state
- Arrival of high priority job which will lead to sending of current executing process back to run state .
- if a process requests for I/O during it's running state, CPU will move it to wait/bock state and continues the execution with another one, and the process in the block state which may send back to run state if it completes the I/O.
Arrival of an higher priority job/process when main memory is full, causes for the suspension of less important existing job.
If a process in suspend wait completes it's I/O, and if it does not find any fittest place with reference to any criteria for getting back to run state, it will shift into suspend ready state.
- Jobs are represented as queues in each state(ready queue, block queue...) which are implemented using data structure linked list
- Burst Time, Arrival Time, Priority, size of process... are the common criteria used by the schedulers
- I/O requests, events, timers, priority and fork() command are the common cause for preemption from CPU.
- Transitions among various states are done by different schedulers
- NEW to READY : Long Term Scheduler(LTS)
- READY to SUSPEND READY : Medium Term Scheduler(MTS)
- READY to RUN : Short Term Scheduler(STS)