---
title: "Preemptive priority scheduling (4, 6, 5 ms)"
subject: "Embedded System"
chapter: 6
key: "semester_6/embedded_system:sched-priority-4-6-5"
source: https://www.bctengineer.com/q/semester_6/embedded_system/sched-priority-4-6-5
site: BCT Engineering
---

# Preemptive priority scheduling (4, 6, 5 ms)

Embedded System · Chapter 6: RTOS

- Asked in: 2071 Bhadra, 5 marks
- Video: [L-2.8: Pre-emptive Priority  Scheduling Algorithm with  Example | Operating System](https://www.youtube.com/watch?v=rsDGfFxSgiY) — Gate Smashers
- Answer checked by Claude Opus 5.5 (high effort) on 2026-10-14
- Page: https://www.bctengineer.com/q/semester_6/embedded_system/sched-priority-4-6-5
- Whole chapter: https://www.bctengineer.com/md/semester_6/embedded_system/chapter-6

## Question

Three processes with process IDs P1, P2, P3 with estimated completion times 4, 6, 5 milliseconds and priorities 1, 0, 3 respectively enter the ready queue together. Calculate the waiting time and turn-around-time for each process and the average waiting time and turn around time in preemptive priority based scheduling algorithm, by assuming zero is the highest priority and three is the lowest priority.

## Short answer

Using preemptive priority scheduling, execution order P2, P1, P3 gives waiting times: P1=6 ms, P2=0 ms, P3=10 ms; turnaround times: 10, 6, 15 ms. Average waiting time = 5.33 ms, average turnaround time = 10.33 ms.

## Answer

**Preemptive priority scheduling** (0 = highest): the CPU is always given to the ready process with the highest priority. All processes arrive at t = 0, so no pre-emption actually occurs. WT = TAT - burst; TAT = completion - arrival (0).

| Process | Burst | Priority | Order |
|---|---|---|---|
| P2 | 6 | 0 (highest) | 1st |
| P1 | 4 | 1 | 2nd |
| P3 | 5 | 3 (lowest) | 3rd |

```text
 |    P2    |   P1   |    P3     |
 0          6        10          15
```

| Process | Completion | TAT | WT |
|---|---|---|---|
| P1 | 10 | 10 | 10 - 4 = 6 |
| P2 | 6 | 6 | 6 - 6 = 0 |
| P3 | 15 | 15 | 15 - 5 = 10 |

Average WT = (6 + 0 + 10) / 3 = 16 / 3 = **5.33 ms**
Average TAT = (10 + 6 + 15) / 3 = 31 / 3 = **10.33 ms**

## Check yourself

The answer's key points as multiple-choice questions, with the correct option and why.

1. Why does no pre-emption occur in this problem?
   A. Priorities are equal
   B. Burst times are equal
   C. All processes arrive at t = 0
   D. The CPU is idle
   Answer: C. With all arrivals together, the highest-priority process simply runs first. (Key point: Pre-emption here)

2. What is the execution order?
   A. P1, P2, P3
   B. P2, P1, P3
   C. P3, P1, P2
   D. P2, P3, P1
   Answer: B. Priorities: P2 = 0, P1 = 1, P3 = 3. (Key point: Order)

3. What is P3's waiting time?
   A. 10 ms
   B. 15 ms
   C. 5 ms
   D. 6 ms
   Answer: A. P3 completes at 15, TAT = 15, WT = 15 - 5 = 10. (Key point: WT of P3)

4. What are average WT and TAT?
   A. 10.33 ms and 5.33 ms
   B. 5 ms and 10 ms
   C. 16 ms and 31 ms
   D. 5.33 ms and 10.33 ms
   Answer: D. WT = (6 + 0 + 10)/3; TAT = (10 + 6 + 15)/3. (Key point: Averages)

## Related in Embedded System

- [Preemptive priority scheduling with P4 (6 ms)](https://www.bctengineer.com/question.md?key=semester_6%2Fembedded_system%3Asched-priority-10-5-7-p4) — Embedded System, chapter 6, asked 2×
- [Non-preemptive priority scheduling (10, 5, 7 ms)](https://www.bctengineer.com/question.md?key=semester_6%2Fembedded_system%3Asched-priority-nonpreemptive-10-5-7) — Embedded System, chapter 6, asked 2×
- [Preemptive priority scheduling (4, 10, 5 ms)](https://www.bctengineer.com/question.md?key=semester_6%2Fembedded_system%3Asched-priority-4-10-5-p4) — Embedded System, chapter 6, asked 2×
- [Priority scheduling (7, 8, 5 ms) with P4](https://www.bctengineer.com/question.md?key=semester_6%2Fembedded_system%3Asched-priority-7-8-5-p4) — Embedded System, chapter 6, asked 2×
- [Preemptive SJF/SRT scheduling (10, 5, 7 ms)](https://www.bctengineer.com/question.md?key=semester_6%2Fembedded_system%3Asched-srt-10-5-7) — Embedded System, chapter 6
- [Priority and SJF scheduling with P4 and P5](https://www.bctengineer.com/question.md?key=semester_6%2Fembedded_system%3Asched-priority-and-sjf-5-process) — Embedded System, chapter 6, asked 2×

## Related in other subjects

- [RR, preemptive priority, preemptive SJF](https://www.bctengineer.com/question.md?key=semester_6%2Foperating_system%3Aprocess-rr-priority-preemptive-sjf) — Operating System, chapter 2
- [Preemptive priority and SRTF Gantt](https://www.bctengineer.com/question.md?key=semester_6%2Foperating_system%3Apreemptive-priority-srtf-gantt) — Operating System, chapter 2
- [Real-time scheduling; two-processor numerical](https://www.bctengineer.com/question.md?key=semester_6%2Foperating_system%3Arealtime-two-processor-fcfs-sjf-priority-rr) — Operating System, chapter 2
