Processes


– Process state: new, ready, …


Download 0.8 Mb.
bet3/9
Sana16.06.2023
Hajmi0.8 Mb.
#1496696
1   2   3   4   5   6   7   8   9
Bog'liq
os eng

Process state: new, ready, …

Program counter: indicates the address of the next instruction to be executed for this program.

CPU registers: includes accumulators, stack pointers,

CPU scheduling information: includes process priority,pointers to scheduling queues.

Memory-management information: includes the value of base and limit registers (protection) …

Accounting information: includes amount of CPU and real time used, account numbers, process numbers, …

I/O status information: includes list of I/O devices allocated to this process, a list of open files, …


PROCESS CONTROL BLOCK

PROCESSES


The act of Scheduling a process means changing the active PCB pointed to by the CPU. Also called a context switch.
  • When CPU switches to another process, the system must save the state of the old process and load the saved state for the new process
  • Context-switch time is overhead; the system does no useful work while switching
  • Time dependent on hardware support

Scheduling Components
Context Switch

Two Types of Context Switch

  • Simple Mode Switch to process an interrupt without switching processes: user process is suspended but will be resumed immediately:
    • only save what is necessary to resume execution of the same process (e.g. program counter, couple of registers)
  • Full Process Switch: process is suspended and another process will get the CPU:
    • save entire context into PCB, load new context from other PCB, update process state.
    • A “heavier duty” operation

CPU Switch From Process to Process


queue. If CPU is executing process P0 and process P1 is in wait state. If an interrupt occurs for Process P0, the operating system suspends the execution of the first process, and stores the current information of Process P0 in its PCB and context to the second process namely Process P1. In doing so, the program counter from the PCB of Process P1 is loaded, and thus execution can continue with the new process.
Let us understand with the help of an example. Suppose if two processes P0 and P1 are in ready queue. Suppose if two processes P0 and P1are in ready

Download 0.8 Mb.

Do'stlaringiz bilan baham:
1   2   3   4   5   6   7   8   9




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling