GATE CS 2024 Set 2 — Question 25
Go beyond PYQs with Success TrackerAI-powered personalised practice and doubt support. Unlimited practice on eligible plans; AI usage limits apply.MSQ+1 / -0MediumContext SwitchingProcesses & ThreadsOperating SystemProcess States & PCB
Operating System → Processes & Threads → Context Switching
Last updated
Question
Consider a process P running on a CPU. Which one or more of the following events will always trigger a context switch by the OS that results in process P moving to a non-running state (e.g., ready, blocked)?
Correct answer
(A) P makes a blocking system call to read a block of data from the disk; (B) P tries to access a page that is in the swap space, triggering a page fault
Solution
A context switch that moves process P to a non-running state (Blocked or Ready) occurs when P cannot continue execution or is preempted.(A) TRUE: When P makes a blocking system call (like reading from disk), it must wait for the I/O to complete. The OS moves P to the Blocked state and switches to another process.
(B) TRUE: When P accesses a page in swap space, a page fault occurs. The OS must fetch the page from disk, which is a slow I/O operation. P is moved to the Blocked state, and a context switch occurs.
(C) FALSE: When an interrupt occurs for another process, the CPU pauses P to run the Interrupt Service Routine (ISR). After the ISR, the scheduler decides which process to run. If P still has the highest priority (or its time slice hasn't expired), P may resume running immediately. Thus, a context switch to a non-running state is not guaranteed.
(D) FALSE: A timer interrupt typically signals the end of a time slice. While this often leads to preemption (moving P to Ready), it is not always guaranteed. For example, if P is the only runnable process, the scheduler may immediately select P again, or in non-preemptive systems, P might continue. Therefore, it does not "always" result in a move to a non-running state in the context of a switch to a different process.
(B) TRUE: When P accesses a page in swap space, a page fault occurs. The OS must fetch the page from disk, which is a slow I/O operation. P is moved to the Blocked state, and a context switch occurs.
(C) FALSE: When an interrupt occurs for another process, the CPU pauses P to run the Interrupt Service Routine (ISR). After the ISR, the scheduler decides which process to run. If P still has the highest priority (or its time slice hasn't expired), P may resume running immediately. Thus, a context switch to a non-running state is not guaranteed.
(D) FALSE: A timer interrupt typically signals the end of a time slice. While this often leads to preemption (moving P to Ready), it is not always guaranteed. For example, if P is the only runnable process, the scheduler may immediately select P again, or in non-preemptive systems, P might continue. Therefore, it does not "always" result in a move to a non-running state in the context of a switch to a different process.
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…