Which of the following need not necessarily be saved on a context switch…

2008

Which of the following need not necessarily be saved on a context switch between processes?

  1. A.

    General purpose registers

  2. B.

    Translation look-aside buffer

  3. C.

    Program counter

  4. D.

    All of the above

Attempted by 383 students.

Show answer & explanation

Correct answer: B

During a context switch, the operating system must preserve enough information to resume the previous process later. General-purpose registers (Option A) and the program counter (Option C) are critical parts of a process's CPU state. If these were not saved, the process would lose its current computation and execution point, leading to incorrect behavior. Therefore, they must be saved.\nThe Translation Look-aside Buffer (TLB) (Option B), however, caches virtual-to-physical address translations specific to a process's page tables. Since different processes have distinct memory mappings, the TLB contents become invalid when switching contexts. Instead of saving and restoring TLB entries, the system simply flushes (clears) the TLB. This makes it unnecessary to save the TLB state, making Option B the correct answer.

A video solution is available for this question — log in and enroll to watch it.

Explore the full course: Isro