Question-1 Explain Non Preemptive Priority scheduling algorithms with illustration.
The process, that has highest priority, is served first.
Decision Mode :
Non Preemptive: Once a process is selected, it runs until it blocks for an I/O or some event, or it terminates
This strategy can be implemented by using sorted FIFO queue. All processes in a queue are sorted based on their priority with highest priority process at front end. When CPU becomes free, a process from the first position in a queue is selected to run.
Consider the following set of four processes. Their arrival time, total time required completing the execution and priorities are given in following table. Consider all time values in millisecond and small values for priority means higher priority of a process.
|Process||Arrival Time (T0)||Time required for completion (∆T)||Priority|
Here, process priorities are in this order: P3 > P2 > P1 > P0.
Initially only process P0 is present and it is allowed to run. But, when P0 completes, all other processes are present. So, process with highest priority P3 is selected and allowed to run till it completes. This procedure is repeated till all processes complete their execution
|Process||Arrival Time(T0)||CPU Burst Time(∆T)||Finish Time(T1)||Turnaround Time(TAT=T1-T0)||Waiting Time (WT=TAT-∆T)|
Average Turnaround Time: (10+21+13+9) / 4 = 53 / 4 = 13.25 ms
Average Waiting Time: (0+15+11+5) / 4 = 31 / 4 = 7.75 ms
- Priority is considered. Critical processes can get even better response time.
- Starvation is possible for low priority processes. It can be overcome by using technique called ‘Aging’.
- Aging: gradually increases the priority of processes that wait in the system for a long time.
You may be interested in:
Operating System Short Descriptive Questions and Answers