C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML
Non Preemptive Priority SchedulingIn the Non Preemptive Priority scheduling, The Processes are scheduled according to the priority number assigned to them. Once the process gets scheduled, it will run till the completion. Generally, the lower the priority number, the higher is the priority of the process. The people might get confused with the priority numbers, hence in the GATE, there clearly mention which one is the highest priority and which one is the lowest one. ExampleIn the Example, there are 7 processes P1, P2, P3, P4, P5, P6 and P7. Their priorities, Arrival Time and burst time are given in the table.
We can prepare the Gantt chart according to the Non Preemptive priority scheduling. The Process P1 arrives at time 0 with the burst time of 3 units and the priority number 2. Since No other process has arrived till now hence the OS will schedule it immediately. Meanwhile the execution of P1, two more Processes P2 and P3 are arrived. Since the priority of P3 is 3 hence the CPU will execute P3 over P2. Meanwhile the execution of P3, All the processes get available in the ready queue. The Process with the lowest priority number will be given the priority. Since P6 has priority number assigned as 4 hence it will be executed just after P3. After P6, P4 has the least priority number among the available processes; it will get executed for the whole burst time. Since all the jobs are available in the ready queue hence All the Jobs will get executed according to their priorities. If two jobs have similar priority number assigned to them, the one with the least arrival time will be executed. From the GANTT Chart prepared, we can determine the completion time of every process. The turnaround time, waiting time and response time will be determined. Turn Around Time = Completion Time - Arrival Time Waiting Time = Turn Around Time - Burst Time
Avg Waiting Time = (0+11+2+7+12+2+18)/7 = 52/7 units
Next TopicPreemptive Priority Scheduling
|