Documente Academic
Documente Profesional
Documente Cultură
event
occurs event
wait
blocked
Figure from Operating Systems, 2nd edition, Stallings, Prentice Hall, 1995
Original diagram from The Design of the UNIX Operating System, M.
Bach, Prentice Hall, 1986
1 Fall 1998, Lecture 06 2 Fall 1998, Lecture 06
or Ready to Run, Swapped (Out) if there The original process is called the parent
isnt room in memory for the new process The new process is called the child
Ready to Run, in Memory is basically The child is an (almost) identical copy of
same state as Preempted (dotted line) parent (same code, same data, etc.)
n Preempted means process was returning
The parent can either wait for the child to
to user mode, but the kernel switched to
another process instead complete, or continue executing in
parallel (concurrently) with the child
n When scheduled, go to either:
n In UNIX, a process creates a child
User Running (if in user mode) process using the system call fork( )
or Kernel Running (if in kernel mode) In child process, fork( ) returns 0
Go from U.R. to K.R. via system call In parent process, fork( ) returns process
id of new child
n Go to Asleep in Memory when waiting
for some event, to RtRiM when it occurs n Child often uses exec( ) to start another
completely different program
n Go to Sleep, Swapped if swapped out
3 Fall 1998, Lecture 06 4 Fall 1998, Lecture 06
Example of UNIX Process Creation Context Switching