program
process
thread
CPU
Process: Definitions [41]
running
concurrent
cooperating
state
suspended
Process: Definitions [42]
ready
waiting
device queue
Process: State Changes [43]
Figure 4.1:
state changes
Visual OS (VOS): A Process Manager [44]
VOS: States [45]
| free: | not in the system - unused PID's |
| suspended: | waiting for admittance to ready queue |
| see long-term scheduler in Memory Management | |
| ready: | waiting for the CPU |
| running: | executing on the CPU |
| waiting: | for a semaphore signal (synchronization) |
| receiving: | waiting for a message send |
| sleeping: | waiting for a wakeup timer |
| writing: | output to console |
| reading: | input from keyboard |
VOS System Calls [46]
| process | (pid,prio) | : | free | suspended | |
| resume | (pid) | : | suspended | ready | |
| suspend | (pid) | : | ready | suspended | |
| running | suspended | ||||
| set_prio | (pid,prio) | : | ready | running | |
| running | ready | ||||
| resched | () | : | ready | running | |
| running | ready | ||||
| wait | (sem) | : | running | waiting | |
| signal | (sem) | : | waiting | ready | |
| receive | (&pid) | : | running | receiving | |
| send | (pid,msg) | : | receiving | ready | |
| sleep | (delay) | : | running | sleeping | |
| wakeup | (pid) | : | sleeping | ready | |
| putline | (str) | : | running | writing | |
| (console) | () | : | writing | ready | |
| getline | (str) | : | running | reading | |
| (keyboard) | () | : | reading | ready | |
| destroy | (pid) | : | any | free |
Process Control Block (PCB) [47]
Figure 4.2:
| pointer |
| process state |
| process number |
| program counter |
| registers |
| memory limits |
| list of open files |
| ... |
Program Counter (pc) [48]
| | | \
\ / pc-> | /
| \ | /
| | \ pc-> \
/ | / \
pc-> | / / /
/ \ / /
| \ / \
| pc-> \ \ \
\ / \ /
Context Switch by Dispatcher [49]
executing | .
v --------------> dispatcher . idle
. SAVE: PCB 1 .
. LOAD: PCB 2 ------------> |
idle . executing |
. |
. dispatcher <------------ v
. SAVE: PCB 2 .
| <-------------- LOAD: PCB 1 . idle
executing v .
Interrupts [50]
Interrupts [51]
software interrupts:
hardware interrupts: