CS476/576

Assignment #4

Due Midnight, Wednsday   Oct 30, 2002


Write a C/UNIX program with the following descriptions:

NAME

procTree - A  program that creates a tree of processes.
SYNOPSIS
procTree <degree>  <height>
DESCRIPTION

The program creats a complete tree of processes.
Each node in the tree has <degree> children (except the leafes)
and it has <height> levels.
For example:

% procTree 2 2 creates  7 processes arranged as shown in Figure 1.
% procTree 3 1 creates  4 processes arranged as shown in Figure 2.
% procTree 1 3 creates  4 processes arranged as shown in Figure 3.
We need to enforce the following constrains on the tree:  Each process has a label defined as follows: Let L denotes the level of a process in the tree (L=0 for the root).
Each  process: The program create a file called: procTreeFile.

The program starts by writing its degree, its height, the total number of processes
and the esitimated execution time, e.g.,

% procTree 2 3
degree: 2, height: 3,  number of processes: 15
estimated execution time is: 9 seconds


Each process writes two lines in this file, one when it is created and one when it is terminated and indicates if it is a leaf, e.g.,

---> My label is: 1122    -> PID=8272, PPID=8265 & I am leaf
<--- Process 1211  is terminated (leaf)
To get a feeling and gain more details about the specification
of this program, execute my own solution under:
/home/cs476/public_html/fall02/assignments/a4/wahab/procTree

Examples:

            See script of using this  command.