CONTEXT SWITCH
Switching the CPU to another process requires saving the state of current process and
loading the saved state for new process. This process is known as a context switch.
The context of a process is represented in the PCB of the process, it includes the value of
the CPU registers the process state and memory management information.
When a context switch occurs, the kernel saves the context of the old process in its PCB
and loads the saved context of the new process scheduled to run.
The context switching time is an overhead time. During switching time system does not
do any useful work. Context switch times are highly dependent on hardware support. Its
speed varies
from machine to machine, depending on the memory speed, the number of registers that
must be
copied and the existence of special instructions. Typically, the speed ranges from 1 to
1000
microseconds. Context-switch times are highly dependent on hardware support.
, Some hardware systems employ two or more sets of processor registers to reduce the
amount of context switching time.
When the process is switched, the following information is stored.
o Program Counter
o Scheduling Information
o Base and limit register value
o Currently used register
o Changed State
o I/O State
o Accounting
Operation on Process
The process in the system can execute concurrently and different operation can be
perform on the process
Process can be created and deleted dynamically. Here, we can focus on to main
operations i.e. creation of process and deletion of process.
Process creation
Create Process Operating system creates a new process with the specified or default
attributes and identifier. A process may create several new subprocesses.
Syntax for creating new process is: CREATE (processed, attributes)
Two names are used in the process they are parent process and child process.
Parent process is a creating process. Child process is created by the parent process. Child
process may create another subprocess. So it forms a tree of processes.
When operating system issues a CREATE system call, it obtains a new process control
block from the pool of free memory, fills the fields with provided and default parameters,
and insert the PCB into the ready list. Thus it makes the specified process eligible to run
the process.
When a process is created, it requires some parameters.
These are priority, level of privilege requirement of memory, access right, memory
protection information etc.
Process will need certain resources, such as CPU time, memory, files and I/O devices to
complete the operation.
When process creates a subprocess, that subprocess may obtain its resources directly
from the operating system. Otherwise it uses the resources of parent process.
When a process creates a new process, two possibilities exist in terms of execution.
Switching the CPU to another process requires saving the state of current process and
loading the saved state for new process. This process is known as a context switch.
The context of a process is represented in the PCB of the process, it includes the value of
the CPU registers the process state and memory management information.
When a context switch occurs, the kernel saves the context of the old process in its PCB
and loads the saved context of the new process scheduled to run.
The context switching time is an overhead time. During switching time system does not
do any useful work. Context switch times are highly dependent on hardware support. Its
speed varies
from machine to machine, depending on the memory speed, the number of registers that
must be
copied and the existence of special instructions. Typically, the speed ranges from 1 to
1000
microseconds. Context-switch times are highly dependent on hardware support.
, Some hardware systems employ two or more sets of processor registers to reduce the
amount of context switching time.
When the process is switched, the following information is stored.
o Program Counter
o Scheduling Information
o Base and limit register value
o Currently used register
o Changed State
o I/O State
o Accounting
Operation on Process
The process in the system can execute concurrently and different operation can be
perform on the process
Process can be created and deleted dynamically. Here, we can focus on to main
operations i.e. creation of process and deletion of process.
Process creation
Create Process Operating system creates a new process with the specified or default
attributes and identifier. A process may create several new subprocesses.
Syntax for creating new process is: CREATE (processed, attributes)
Two names are used in the process they are parent process and child process.
Parent process is a creating process. Child process is created by the parent process. Child
process may create another subprocess. So it forms a tree of processes.
When operating system issues a CREATE system call, it obtains a new process control
block from the pool of free memory, fills the fields with provided and default parameters,
and insert the PCB into the ready list. Thus it makes the specified process eligible to run
the process.
When a process is created, it requires some parameters.
These are priority, level of privilege requirement of memory, access right, memory
protection information etc.
Process will need certain resources, such as CPU time, memory, files and I/O devices to
complete the operation.
When process creates a subprocess, that subprocess may obtain its resources directly
from the operating system. Otherwise it uses the resources of parent process.
When a process creates a new process, two possibilities exist in terms of execution.