- Asked 2/19
- 2071 Magh · 8 marks
- 2073 Bhadra · 5 marks
Preemptive priority scheduling with P4 (6 ms)
Short answer
Preemptive priority (0 highest). Schedule: P1(0-5), P4(5-11), P1(11-16), P3(16-23), P2(23-28). Waiting times: P1=6ms, P2=23ms, P3=16ms, P4=0ms; average=11.25ms. Turnaround times: P1=16ms, P2=28ms, P3=23ms, P4=6ms; average=18.25ms.
In priority based (preemptive) scheduling, three processes IDs P1, P2, P3 with estimated completion time 10, 5, 7 msec. and priorities 1, 3, 2 (0-highest and 3-lowest priority) respectively enter the ready queue together. A new process P4 with estimated completion time 6 ms and priority 0 enters the ready queue after 5 ms of start of execution of P1. Calculate the waiting time and turn around time for each process and the average waiting time and average TAT. Assume all the processes contain only CPU operation and no I/O operations are involved.
Preemptive priority scheduling (0 = highest priority): the CPU always runs the highest-priority ready process; a newly arrived higher-priority process pre-empts the running one. WT = TAT - burst; TAT = completion - arrival.
| Process | Arrival | Burst | Priority |
|---|---|---|---|
| P1 | 0 | 10 | 1 |
| P2 | 0 | 5 | 3 |
| P3 | 0 | 7 | 2 |
| P4 | 5 | 6 | 0 |
Schedule
- 0 to 5: P1 (priority 1, best of P1/P2/P3) runs; 5 ms remain.
- t = 5: P4 (priority 0) arrives and pre-empts P1. P4 runs 5 to 11.
- 11 to 16: P1 resumes, finishes its remaining 5 ms (priority 1).
- 16 to 23: P3 (priority 2) runs 7 ms.
- 23 to 28: P2 (priority 3) runs 5 ms.
| P1 | P4 | P1 | P3 | P2 |
0 5 11 16 23 28
| Process | Completion | TAT | WT |
|---|---|---|---|
| P1 | 16 | 16 - 0 = 16 | 16 - 10 = 6 |
| P2 | 28 | 28 - 0 = 28 | 28 - 5 = 23 |
| P3 | 23 | 23 - 0 = 23 | 23 - 7 = 16 |
| P4 | 11 | 11 - 5 = 6 | 6 - 6 = 0 |
Average WT = (6 + 23 + 16 + 0) / 4 = 45 / 4 = 11.25 ms Average TAT = (16 + 28 + 23 + 6) / 4 = 73 / 4 = 18.25 ms
✓ Answer checked by Claude Opus 5.5 (high effort)
Related questions
- Non-preemptive priority scheduling (10, 5, 7 ms) · Embedded System, chapter 6 · asked 2×
- Priority scheduling (7, 8, 5 ms) with P4 · Embedded System, chapter 6 · asked 2×
- Preemptive priority scheduling (4, 10, 5 ms) · Embedded System, chapter 6 · asked 2×
- Preemptive priority scheduling (4, 6, 5 ms) · Embedded System, chapter 6
- Priority and SJF scheduling with P4 and P5 · Embedded System, chapter 6 · asked 2×
- Preemptive SJF/SRT scheduling (10, 5, 7 ms) · Embedded System, chapter 6
- Preemptive priority and SRTF Gantt · Operating System, chapter 2
- RR, preemptive priority, preemptive SJF · Operating System, chapter 2