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
- Save process registers
- Update PCB (Running -> Ready / Blocked)
- Move PCB to queue accordingly
- Run scheduler to select next process
- Update new PCB to Running state
- Update memory manage unit (MMU)
- Restore process
OSC
https://lingkang.dev/2024/01/15/osc/