Context switching between two threads of execution within the operating system is
usually performed by a small assembly language function. In general terms, what does this
small function do internally?
Answer:
-Saves the current registers on the stack, then stores the stack pointer in the current thread’s control block. We then load the stack pointer for the new thread’s control block and restore the registers it had saved, from its stack.