What is the difference between context switching and interrupt handling?

Context switching involves storing the context or state of a method or thread in order that it will be reloaded once needed and execution will be resumed from constant purpose as earlier. This can be a feature of a multitasking software system and permits one computer hardware to be shared by multiple processes.

When Associate in Nursing interrupt happens, the hardware mechanically switches a region of the context. The handler could save further context, counting on details of the actual hardware and software package styles. Typically, solely a minimal part of the context is modified so as to reduce the quantity of one time spent handling the interrupt. The kernel does not spawn or schedule a special method to handle interrupts, however, instead the handler executes within the (often partial) context established at the start of interrupt handling. Once interrupt conjugation is complete, the context in impact before the interrupt occurred is improved in order that the interrupted method will resume execution in its correct state.