next up previous contents
Next: Process Scheduling Up: Process Management Previous: Process Management   Contents

Process [40]





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:




\begin{picture}(520,260)(-35,560)
\thicklines\put(260,590){\oval(120,60)}
\put(3...
...t(-20,590){\makebox(0,0)[lb]{\raisebox{0pt}[0pt][0pt]{completed}}}
\end{picture}



state changes



Visual OS (VOS): A Process Manager [44]




\begin{picture}(485,494)(80,340)
\thicklines\put(260,400){\framebox (125,20){}}
...
...put(280,805){\makebox(0,0)[lb]{\raisebox{0pt}[0pt][0pt]{READING}}}
\end{picture}



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 $\rightarrow$ suspended
resume (pid) : suspended $\rightarrow$ ready
suspend (pid) : ready $\rightarrow$ suspended
      running $\rightarrow$ suspended
set_prio (pid,prio) : ready $\rightarrow$ running
      running $\rightarrow$ ready
resched () : ready $\rightarrow$ running
      running $\rightarrow$ ready
wait (sem) : running $\rightarrow$ waiting
signal (sem) : waiting $\rightarrow$ ready
receive (&pid) : running $\rightarrow$ receiving
send (pid,msg) : receiving $\rightarrow$ ready
sleep (delay) : running $\rightarrow$ sleeping
wakeup (pid) : sleeping $\rightarrow$ ready
putline (str) : running $\rightarrow$ writing
(console) () : writing $\rightarrow$ ready
getline (str) : running $\rightarrow$ reading
(keyboard) () : reading $\rightarrow$ ready
destroy (pid) : any $\rightarrow$ 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:


next up previous contents
Next: Process Scheduling Up: Process Management Previous: Process Management   Contents
Ted Billard 2001-11-17