GATE CS 2024 Set 2 — Question 37
Go beyond PYQs with Success TrackerAI-powered personalised practice and doubt support. Unlimited practice on eligible plans; AI usage limits apply.MCQ+2 / -0.67MediumFCFS & SJFProcess SchedulingOperating SystemSRTF (Preemptive SJF)Scheduling Numericals
Operating System → Process Scheduling → FCFS & SJF
Last updated
Question
Consider a single processor system with four processes A, B, C, and D, represented as given below, where for each process the first value is its arrival time, and the second value is its CPU burst time.A (0, 10), B (2, 6), C (4, 3), and D (6, 7).Which one of the following options gives the average waiting times when preemptive Shortest Remaining Time First (SRTF) and Non-Preemptive Shortest Job First (NP-SJF) CPU scheduling algorithms are applied to the processes?
Correct answer
(B) SRTF = 6, NP-SJF = 7.5
Solution
We calculate the average waiting time for both algorithms.1. Preemptive Shortest Remaining Time First (SRTF):Processes: A(0, 10), B(2, 6), C(4, 3), D(6, 7)
- t=0: A arrives (burst 10). A starts.
- t=2: B arrives (burst 6). A has run for 2 units, remaining 8. B(6) < A(8), so preempt A. B starts.
- t=4: C arrives (burst 3). B has run for 2 units, remaining 4. C(3) < B(4), so preempt B. C starts.
- t=6: D arrives (burst 7). C has run for 2 units, remaining 1. C(1) < D(7), so continue C.
- t=7: C finishes. Remaining: A(8), B(4), D(7). Shortest is B(4). B resumes.
- t=11: B finishes. Remaining: A(8), D(7). Shortest is D(7). D starts.
- t=18: D finishes. Remaining: A(8). A resumes.
- t=26: A finishes.
- C: 7
- B: 11
- D: 18
- A: 26
- A:
- B:
- C:
- D:
- A:
- B:
- C:
- D:
- t=0: A arrives. Only A is available. A starts.
- t=10: A finishes. Available processes: B(2, 6), C(4, 3), D(6, 7). Shortest is C(3). C starts.
- t=13: C finishes. Available: B(2, 6), D(6, 7). Shortest is B(6). B starts.
- t=19: B finishes. Available: D(6, 7). D starts.
- t=26: D finishes.
- A: 10
- C: 13
- B: 19
- D: 26
- A:
- B:
- C:
- D:
- A:
- B:
- C:
- D:
Continue learning with Success Tracker
A step still unclear? Work through it with support
Use Success Tracker to ask about the reasoning, then try another GATE CS question to check your understanding.
AI-powered practice· Unlimited practice on eligible plans
- PYQs with solutions
- Attempt available previous-year questions, then compare your reasoning with the worked solution. Coverage varies by stream.
- Practice that adapts
- Choose a topic, work on weaker areas and bookmark questions to revisit. Your attempts feed your progress tracking.
- AI doubt support
- Ask follow-up questions about a step or concept while practising, instead of stopping at the final answer.
Unlimited practice is available on eligible plans. Free practice and AI usage have limits; check the current plan allowances before choosing.
This page stays readable without an account. AI responses can be wrong; check them against the solution and source material.
More questions on Process Scheduling
2026 Set 2 Q23Which one of the following CPU scheduling algorithms cannot be preemptive?2026 Set 1 Q29With respect to deadlocks in an operating system, which of the following statements is/are FALSE?2026 Set 1 Q31In the context of relational database normalization, which of the following statements is/are true?2026 Set 1 Q35Consider a system consisting of instances of a resource , being shared by 5 processes.…2026 Set 2 Q51Consider three processes P1, P2, and P3 running identical code, as shown in the pseudocode below. A…