Question
Download Solution PDFComprehension
Consider the following set of processes with the arrival time and length of CPU burst time given in milli secends (ms)
Process | Arrival Time | Burst Time |
P1 | 0 | 5 |
P2 | 2 | 3 |
P3 | 2 | 2 |
P4 | 5 | 3 |
P5 | 6 | 1 |
Calculate the average response time for these processes with a nonpreemptive priority Scheduling algorithm? Priority of the process are as follows and consider that all the processes came at zero (0) time. (Note low numbers represent high priority).
Process | Arrival Time | Burst Time |
P1 | 5 | 3 |
P2 | 3 | 1 |
P3 | 2 | 5 |
P4 | 3 | 4 |
P5 | 1 | 2 |
Answer (Detailed Solution Below)
Option 1 : 5.8 ms
Detailed Solution
Download Solution PDFScheduling Algorithm: Non-preemptive Priority Scheduling (Low number = High Priority)
Gantt chart:
P5 |
P3 |
P2 |
P4 |
P1 |
0 2 7 8 12 15
Process Table:
Process | Priority | Arrival Time (AT) | Burst Time (BT) | Start Time (ST) | Completion Time (CT) | Response Time (RT) |
P1 | 5 | 0 | 3 | 12 | 15 | 12 |
P2 | 3 | 0 | 1 | 7 | 8 | 7 |
P3 | 2 | 0 | 5 | 2 | 7 | 2 |
P4 | 3 | 0 | 4 | 8 | 12 | 8 |
P5 | 1 | 0 | 2 | 0 | 2 | 0 |
Average response time = \(\frac{{12 + 7 + 2 + 8 + 0}}{5} = 5.8\) ms
Answer: The corrected average response time is 5.8 ms.
Note: The Priority column is essential to justify the scheduling order. The correct formula for response time is Response Time = Start Time − Arrival Time.