Process Table and Process Control Block
Context Switching in Operating System
• A context switch is the mechanism to store and restore the state or context of a CPU in Process Control block so that a process execution can be resumed from the same point at a later time.
Context Switching Triggers:
There are three major triggers for context switching.
Multitasking: In a multitasking environment, a process is switched out of the CPU so another process can be run.
• The state of the old process is saved and the state of the new process is loaded.
• On a pre-emptive system, processes may be switched out by the scheduler.
Interrupt Handling: The hardware switches a part of the context when an interrupt occurs. This happens automatically. Only some of the context is changed to minimize the time required to handle the interrupt.
User and Kernel Mode Switching: A context switch may take place when a transition between the user mode and kernel mode is required in the operating system.
Process Hierarchies
• when a process creates another process, then the parent process and child process continue to be associated in certain ways. The child process can itself creates more processes that forms a process hierarchy.
• In Unix system, a process group formed by a process and all of its children and further descendants (related process).
• Individually, each process can catch the signal, ignore the signal, or take the default action, windows systems doesn't have any concept of a process hierarchy.
• fork() returns a positive value, the process ID of the child process, to the parent.
•A child process uses the same pc(program counter), same CPU registers, same open files which use in the parent process.
Operating system maintain separate pointers chain to link the related PCB
• Every child processor maintain the separate PCB
Super sir...
ReplyDeleteNice sir...
ReplyDeleteuseful sir thank you..
ReplyDeletegood concept... sir..
ReplyDeleteThank you for sharing your vision sir.
ReplyDeleteuseful and easy way to understand....
ReplyDeleteConcepts of context switching and its three major triggers and also works of process hierarchy - these are clearly explained and easily understandable Sir... Thank you Sir
ReplyDeleteSir, please explain elaborately.
ReplyDeleteit is more confusing to understand
Thank you so much
ReplyDeletehttp://www.islamiduniya.com/blog/2020/03/28/what-is-operating-system/