Microsoft Interview Question

How is a context switch handled by the operating system?