GATE CS 2022 Set 1 — Question 42
Go beyond PYQs with Success TrackerAI-powered personalised practice and doubt support. Unlimited practice on eligible plans; AI usage limits apply.MCQ+2 / -0.67HardRound RobinProcess SchedulingOperating SystemContext SwitchingProcesses & Threads
Operating System → Processes & Threads → Context Switching
Last updated
Question
Consider four processes P, Q, R, and S scheduled on a CPU as per round robin algorithm with a time quantum of 4 units. The processes arrive in the order P, Q, R, S, all at time . There is exactly one context switch from S to Q, exactly one context switch from R to Q, and exactly two context switches from Q to R. There is no context switch from S to P. Switching to a ready process after the termination of another process is also considered a context switch. Which one of the following is NOT possible as CPU burst time (in time units) of these processes?
Correct answer
(D) P = 3, Q = 7, R = 7, S = 3
Solution
We analyze the execution sequence based on the constraints and the Round Robin (TQ=4) policy. Order: P, Q, R, S.Constraints:
Seq: P(4, done) Q(4, rem 6) R(4, rem 2) S(2, done) Q(4, rem 2) R(2, done) Q(2, done).
Switches: P Q, Q R(1), R S, S Q(1), Q R(2), R Q(1). All constraints satisfied.
1.S Q: Exactly 1.
2.R Q: Exactly 1.
3.Q R: Exactly 2.
4.S P: 0.
Analysis of Option (D): P=3, Q=7, R=7, S=3- Round 1:
- P runs for 3 units (Finishes). Switch P Q.
- Q runs for 4 units (Remaining: 3). Switch Q R. (Count Q R = 1)
- R runs for 4 units (Remaining: 3). Switch R S.
- S runs for 3 units (Finishes). Switch S Q. (Count S Q = 1)
- Round 2:
- Queue has Q, R.
- Q runs for 3 units (Finishes). Switch Q R. (Count Q R = 2)
- R runs for 3 units (Finishes). Terminate.
- S Q: 1 (Satisfied)
- Q R: 2 (Satisfied)
- S P: 0 (Satisfied)
- R Q: In the sequence above, the switches involving R are: Q R (Round 1), R S (Round 1), Q R (Round 2). R terminates after the second run. There is NO switch from R to Q. The count is 0.
- The problem requires exactly one switch from R to Q.
Seq: P(4, done) Q(4, rem 6) R(4, rem 2) S(2, done) Q(4, rem 2) R(2, done) Q(2, done).
Switches: P Q, Q R(1), R S, S Q(1), Q R(2), R Q(1). All constraints satisfied.
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 Processes & Threads
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…