Posts

Showing posts from August, 2019

Context Switching in Operating System

Home

(PCB) or Task Control Block (TCB)

Home (PCB)   or   Task   Control   Block   (TCB) •   As   the   operating   system   supports   multi-programmin g ,   it   needs   to keep track of all the processes •   T he   process   control   block   (PCB)   is   used   to   track   the   proces s ’s execution status. •   Each   block   of   memory   contains   information   about   the   process   state,   program   counter,   stack   pointe r ,   status   of   opened   files, scheduling algorithms, etc. •   All   these   information   is   required   and   must   be   saved   when   the  process   is   switched   from one state to anothe r . •   The   process   table   is   an   array   of   PCB’s,   that   means   logically contains a PCB for all of the current processes in the system. (PCB) •   P rocess   table   is   an   array   or   linked   list •   The process table is an  a rray of PCB’s, that means logically contains a PCB for all of the current proce

Process Table and Process Control Block

Home 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   Trigger s : 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   tim

Preemptive and Non-Preemptive

Home Preemptive   and   Non-Preemptive The   scheduling   which   takes   place   when   a   process   switches   from   running state   to   ready   state   or   from   waiting   state   to   ready   state   is   called  Preemptive   Scheduling or   Pre-Emption In   Nonpreemptive   Scheduling,   once   the   resources   (CPU)   is   allocated   to   a process, the process   holds   the   CPU   till   it   gets   terminated. Processor   Types •   I n   a   single-processor   system,   therefore,   only   one   program   can   be running at any one time. •   Processors   can   have   a   single   core   or   multiple   cores.   A   processor with   two   cores   is   called a   dual-core   processo r ,   four   cores   is   quad   -cor e .. • Dual   core   processor   is   likely   to   be   about   one-and-a half   times   as powerful as a single core processor.   M ulticore   processors   that   enable   the   computer   to   execute m