Which of the following need not necessarily be saved on a context swit...
The values stored in registers, stack pointers and program counters are saved on context switch between the processes so as to resume the execution of the process. There's no need of saving the contents of TLB as it is invalidated after each context switch. So, option (B) is correct
Which of the following need not necessarily be saved on a context swit...
Explanation:
Context Switch:
A context switch refers to the process of saving the current state of a process and restoring the saved state of another process. This is necessary for multitasking operating systems, where multiple processes are executed concurrently. During a context switch, the operating system saves the state of the currently running process and loads the saved state of another process.
Contents saved on a context switch:
When a context switch occurs, certain contents need to be saved and restored to ensure that the process can resume execution correctly. These contents include:
1. General Purpose Registers:
General purpose registers (GPRs) are registers used by the processor to hold temporary data, operands, and addresses during program execution. These registers need to be saved and restored during a context switch to ensure that the values stored in them are preserved. If the values were not saved, the process would lose its current state and may not be able to resume execution correctly.
2. Translation Look-Aside Buffer (TLB):
The Translation Look-Aside Buffer (TLB) is a cache used to accelerate virtual address translation. It stores the mappings between virtual addresses and physical addresses. The TLB is specific to each process and contains entries for the virtual pages currently in use by the process. Since the TLB is specific to a process, it does not need to be saved on a context switch. When a context switch occurs, the TLB entries are invalidated, and the TLB is reloaded with the mappings for the new process.
3. Program Counter (PC):
The Program Counter (PC) is a special register that holds the memory address of the next instruction to be executed. The value of the PC needs to be saved and restored during a context switch to ensure that the process can resume execution from the correct instruction.
Conclusion:
Among the given options, the Translation Look-Aside Buffer (TLB) is the only content that need not necessarily be saved on a context switch between processes. The TLB is specific to each process and is invalidated and reloaded with new mappings when a context switch occurs. The General Purpose Registers (GPRs) and Program Counter (PC) are essential for preserving the state of a process and are saved and restored during a context switch.