- Asked 2/19
- 2078 Poush · 6 marks
Non-preemptive priority scheduling (10, 5, 7 ms)
Short answer
Non-preemptive priority gives order P1, P4, P2, P3. Waiting times: P1=0, P2=16, P3=21, P4=4 ms. Average waiting time = 10.25 ms, average turnaround time = 17.25 ms.
Three processes with process IDs P1, P2, P3 with estimated completion time 10, 5, 7 ms and priorities 0, 2, 3 (0-highest, 3-lowest) respectively enter the ready queue together in order P1, P2, P3 (assume only P1 is present in the Ready queue when the scheduler picks it up and P2 & P3 enter ready queue after that). Now a process P4 with estimated completion time 6 ms and priority 1 enters the ready queue after 6 ms of execution of P1. Calculate waiting time and TAT for each process and average waiting time and average TAT. Assume there is no I/O waiting for the processes and priority-based non-preemptive scheduling.
In non-preemptive priority scheduling a running process is never interrupted; when it ends, the ready process with the highest priority (lowest number) is chosen. P1 is alone when picked, so it starts at 0 and P2, P3 join the queue just after. P4 arrives at 6 ms (6 ms into P1).
Gantt chart
| P1 | P4 | P2 | P3 |
0 10 16 21 28
Trace
- 0-10: P1 runs to completion (no preemption, although P4 arrives at 6).
- At 10 the ready queue holds P2 (priority 2), P3 (priority 3), P4 (priority 1). P4 is chosen: 10-16.
- 16-21: P2 (priority 2). 21-28: P3 (priority 3).
Calculation
TAT = completion time - arrival time; WT = TAT - burst time.
| Process | AT | BT | CT | TAT = CT - AT | WT = TAT - BT |
|---|---|---|---|---|---|
| P1 | 0 | 10 | 10 | 10 | 0 |
| P2 | 0 | 5 | 21 | 21 | 16 |
| P3 | 0 | 7 | 28 | 28 | 21 |
| P4 | 6 | 6 | 16 | 10 | 4 |
AWT = (0 + 16 + 21 + 4) / 4 = 41/4 = 10.25 ms
ATAT = (10 + 21 + 28 + 10) / 4 = 69/4 = 17.25 ms
Answer: AWT = 10.25 ms, ATAT = 17.25 ms.
✓ Answer checked by Claude Opus 5.5 (high effort)
Related questions
- Priority scheduling (7, 8, 5 ms) with P4 · Embedded System, chapter 6 · asked 2×
- Preemptive priority scheduling with P4 (6 ms) · 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
- Preemptive SJF/SRT scheduling (10, 5, 7 ms) · Embedded System, chapter 6
- Priority and SJF scheduling with P4 and P5 · Embedded System, chapter 6 · asked 2×
- Non-preemptive SJF with P4 arriving · Embedded System, chapter 6 · asked 2×
- Preemptive vs non-preemptive; real-time scheduling · Operating System, chapter 2
- Preemptive priority and SRTF Gantt · Operating System, chapter 2
- RR, preemptive priority, preemptive SJF · Operating System, chapter 2