OSC

Last updated on January 15, 2024 pm

Process 1

Memory Image

flowchart TD
    Process --> Code["Code (Text)"]
    Process --> Data
    Process --> Stack
    Process --> Heap

    Code --> MemoryImage[Memory Image]
    Data --> MemoryImage
    Stack --> MemoryImage
    Heap --> MemoryImage
  • Process
  • Memory Image

Process Control Block

flowchart LR
    ProcessId[Process Identification] --> PCB
    PCtrl[Process Control Information] --> PCB
    PState[Process State Information] --> PCB

    PCB --> ProcessTable[Process Table]
  • Process Identification
  • Process Control Information
  • Process State Information
  • Process Control Block (PCB)
  • Process Table
  • Process States

Process Status

flowchart TD

New(New)
Ready(Ready)
Running(Running)
Blocked(Blocked)
Terminated(Terminated)

    New-- Admit the process and commit to execution -->Ready
    Running-- Wait for input or syscall -->Blocked
    Ready-- Chosen by process scheduler -->Running
    Blocked-- Waited event finished -->Ready
    Running-- Surrender the processor -->Ready
    Running-- Finish or exception occurred -->Terminated
  • New
  • Ready
  • Running
  • Blocked
  • Terminated
  • Suspended

Interrupts and syscalls drive the transitions of process status.

Context Switching & Time Slices

The system saves the state of the old process and loads the state of the new process. (Overhead)

Time Slices

  • Short
    • good response time
    • low effective
  • Long
    • poor response time
    • better effective utilization
  1. Save process registers
  2. Update PCB (Running -> Ready / Blocked)
  3. Move PCB to queue accordingly
  4. Run scheduler to select next process
  5. Update new PCB to Running state
  6. Update memory manage unit (MMU)
  7. Restore process

OSC
https://lingkang.dev/2024/01/15/osc/
Author
Lingkang
Posted on
January 15, 2024
Licensed under