Q:
When there is a context switch from one process to another, the OS kernel invokes the function
ContextSwitch which saves the context of the currently executing process into its PCB and then
inserts the process to an appropriate queue (i.e., ready queue or a blocked queue). It is necessary that
ContextSwitch is atomic (i.e., unbreakable: either done or not-done; nothing in between). Explain the
following:
a) Why must ContextSwitch be atomic?
b) How can it be made atomic in practice?