Pregunta de entrevista de Microsoft

How is a context switch handled by the operating system?