Which of the following actions is/are typically not performed by the operating system when switching context from process to process ?
View worked solution
Answer: C
A context switch is the mechanism of saving the state (context) of a running process so that it can be resumed later, and loading the saved state of another process. It needs to be extremely fast to maintain system responsiveness.
Let us analyze the given actions during a context switch from process to process :
- Option A (Saving and restoring registers): This is the core task of a context switch. The CPU registers (including the program counter, stack pointer, and general-purpose registers) of process must be saved to its Process Control Block (PCB), and those of process must be restored.
- Option B (Changing address translation tables): Since different processes have distinct virtual address spaces, the operating system must update the page table base register (e.g., CR3 in x86) to point to process 's page table.
- Option C (Swapping out the memory image to disk): Swapping a process's entire memory image to disk is a heavy I/O operation managed by the medium-term scheduler. It is not performed during a standard context switch, as doing so would make context switching prohibitively slow.
- Option D (Invalidating the TLB): Because the virtual-to-physical address mappings change when switching to a new process, the Translation Look-aside Buffer (TLB) must be invalidated (flushed) to prevent process from accessing cached translations belonging to process (unless address space identifiers/tags are used).
Therefore, swapping out the memory image to disk (Option C) is typically not performed during a context switch.
Free practice · Your answers on this page are not saved.
