CS 3733 Operating Systems
Lecture 3 [1/16/98]: Processes in Unix
Reading: Chapter 2.3, 2.4 and 2.5 of PUP
- Relationships between processes
- Independent:
- Can affect or be affected by other processes.
- State not shared by other processes.
- Execution is reproducible.
- Execution can be stopped and restarted without causing ill effects.
- Cooperating:
- State may be shared.
- Result of execution can not be predicted in advance.
- Nondeterministic.
- Operations on Processes
- Creation
- A process may create other processes.
- The creating process is called the parent
- The created process is called the child
- Resources of the parent may be shared among children or
the children may get completely new resources.
- Parent might execute concurrently or might wait for all
children to complete.
- Destruction
- Changing State of Process
- Processes in Unix
- Child processes are created with the
fork
system call.
- The new process has a copy of the address space of parent.
- Both processes continue execution after the
fork
- The
fork
returns 0 to the child and the Child's PID
to the parent.
- Code Examples
- Example 2.3 PUP: What is the value of
x
for each
process?
- Example 2.4 PUP: Parent and child print different messages.
- Example 2.5 PUP: A chain of processes, the parent always breaks.
- Example 2.6 PUP: A fan of processes, the child breaks.
- Example 2.7 PUP: A tree of processes, only break when error.
SKILL: Understand the basics of process creation in Unix
Revision Date: 1/15/98