Friday 20 June 2014

Context Switch


Context Switch


A running process may be interrupted and the operating system assigns another process to the running state and turns control over that. Switching of CPU to another process requires saving the state of old process and loading the saved state for new process this task is known as context switch.
The context of a process is represented in the PCB of a process. It includes the value of a CPU registers, process state, memory management information etc.
Context switch time is pure overhead because system does not do any useful work while switching.
The possible events that may cause switching are-
·        Interrupt
                  It is due to some event that is external to process. For example
1.       Clock interrupt
2.       I/O interrupt
3.       Memory interrupt

·        Trap
            It relates to an error or exception condition generated within currently running process such as illegal file access attempt.
·        Supervisor call
                                  A supervisor call may marked from the program being executed .this call generates system call use of system call places the process in blocked state.

No comments: