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)?
P makes a blocking system call to read a block of data from the disk
P tries to access a page that is in the swap space, triggering a page fault
An interrupt is raised by the disk to deliver data requested by some other process
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
Explanation
A blocking disk read and a page fault on a swapped-out page both force P to wait for I/O, so P is blocked. A disk interrupt for another process or a timer interrupt does not always deschedule P.
More System Calls, Processes, Threads and IPC questions
GATE 2023 CS Q22– Which one or more of the following need to be saved on a context switch from one thread…
GATE 2023 CS Q23– Which one or more of the following options guarantee that a computer system will…
GATE 2021 CS (CS1) Q24– Which of the following standard C library functions will always invoke a system call when…
GATE 2020 CS Q22– Consider the following statements about process state transitions for a system using…
GATE 2019 CS Q27– The following C program is executed on a Unix/Linux system: The total number of child…