Context-Switching
Question 1 |
Which of the following actions is/are typically not performed by the operating system when switching context from process A to process B?
Saving current register values and restoring saved register values for process B.
| |
Changing address translation tables. | |
Swapping out the memory image of process A to the disk. | |
Invalidating the translation look-aside buffer. |
Question 1 Explanation:
A) True.
B) True.
C) False, because swapping is done when the process is suspended and not during context switching.
D) True, Invalidation of TLB is necessary because, if the TLB is not invalidated then the new process might end up using the translation of old process. Note that Invalidation of TLB is necessary but saving and reuse of TLB is not necessary.
B) True.
C) False, because swapping is done when the process is suspended and not during context switching.
D) True, Invalidation of TLB is necessary because, if the TLB is not invalidated then the new process might end up using the translation of old process. Note that Invalidation of TLB is necessary but saving and reuse of TLB is not necessary.
Question 2 |
Which of the following need not necessarily be saved on a context switch between processes?
General purpose registers | |
Translation look-aside buffer | |
Program counter | |
All of the above |
Question 2 Explanation:
We don't need to save TLB or cache to ensure correct program resumption. They are just bonus for ensuring better performance. But PC, stack and registers must be saved as otherwise program cannot resume.