Assignment 1 (Process Accounting)

Part I  (Experiment)

1. Run the 'top' command in one window and observe its output.
Study the different fields listed by 'top' with the help of its manpage.

2. Download the  cpubound.c  program.
It is a process that runs for 10 seconds, uses CPU, but does not perform any I/O.
Compile and convert it into a process.
What is the effect of this program  on 'top' ?

Now stop this process by a 'cntrl-z' and see how the change is reflected
in the top screen. Bring the process to running state again by executing
command 'fg'. See the change in 'top' screen.
This cpubound.c process will automatically exit after a certain timeout.
You may need to rerun it to complete the experiment.
how many process states did you discover?

3. Run the 'ps' command. Observe its output. Look at its manpage.
Explore various parameters to ps and study the output. Conduct the
same experiment, observe the state of your process in the output
reported by 'ps'.

Part II  (Programming Assignment)

/proc file system was described in 1991 by Faulkner and Gomes at a USENIX conference.
Current implementations of /proc may be different from the original /proc description.
Study the /proc pseudo file system ( LINUX) with the help of  its manpage.

Write a program which computes (1) the ratio of idle time to cpu time (kernel mode+user mode) for each
running process and (2) the ratio for the entire system. Use the structures available on /proc.
Submit your assignment using  ~oslab/submit program on everest.
usage:  submit  assignment-number  list of files
e.g. submit 1 file1.c file2.c ....

Deadline:  Tuesday 5:40 pm. submit will be disabled after the deadline.