Pergunta de entrevista da empresa Microsoft

How is a context switch handled by the operating system?