Question
Download Solution PDFConsider following process details scheduled for execution. Consider pre-emptive shortest job first scheduling strategy. Find average waiting time.
Process | Arrival Time | Burst time |
P0 | 0 | 8 |
P1 | 1 | 4 |
P2 | 2 | 9 |
P3 | 3 | 5 |
Answer (Detailed Solution Below)
Detailed Solution
Download Solution PDFThe correct answer is: option 1: 6.5 ms
Concept:
We are using the Preemptive Shortest Job First (SJF) scheduling algorithm, also known as Shortest Remaining Time First (SRTF). In this approach, the process with the shortest remaining burst time is scheduled next, even if it means preempting the currently running process.
Given process data:
Process | Arrival Time | Burst Time |
---|---|---|
P0 | 0 | 8 |
P1 | 1 | 4 |
P2 | 2 | 9 |
P3 | 3 | 5 |
Step-by-step execution using Gantt Chart (Preemptive SJF):
Timeline:
- 0–1: P0 runs (remaining 7)
- 1–5: P1 arrives (shortest), so preempts P0 and finishes
- 5–10: P3 (shorter than P0 & P2)
- 10–17: P0 resumes (remaining 7) and finishes
- 17–26: P2 runs and finishes
Completion Times:
- P0: CT = 17
- P1: CT = 5
- P2: CT = 26
- P3: CT = 10
Turnaround Time (TAT) = Completion Time – Arrival Time
- P0: 17 – 0 = 17
- P1: 5 – 1 = 4
- P2: 26 – 2 = 24
- P3: 10 – 3 = 7
Waiting Time (WT) = TAT – Burst Time
- P0: 17 – 8 = 9
- P1: 4 – 4 = 0
- P2: 24 – 9 = 15
- P3: 7 – 5 = 2
Total Waiting Time = 9 + 0 + 15 + 2 = 26
Average Waiting Time = 26 / 4 = 6.5
Hence, the correct answer should be: option 2: 6.5 ms
Last updated on Jul 3, 2025
-> NIELIT Scientific Assistant answer key 2025 has been released at the official website.
-> NIELIT Scientific Assistant admit card 2025 has been released.
-> NIELIT Scientific Assistant city intimation slip 2025 has been released at the official website.
-> NIELIT Scientific Assistant exam 2025 is scheduled to be conducted on June 28.
-> A total number of 113 revised vacancies have been announced for the post of Scientific Assistant in Computer Science (CS), Information Technology (IT), and Electronics & Communication (EC) streams.
-> Online application form, last date has been extended up to from 17th April 2025.
->The NIELT has revised the Essential Qualifications for the post of Scientific Assistant. Candidates must possess (M.Sc.)/ (MS)/ (MCA) / (B.E.)/ (B.Tech) in relevant disciplines.
-> The NIELIT Scientific Assistant 2025 Notification has been released by the National Institute of Electronics and Information Technology (NIELIT).