Next: Submit Your Program(s) Electronically
Programming Project Two
Computer Science 4334 -- Fall 2000
Operating Systems
CSCI4334 |
Assigned: |
Friday September 22, 2000 |
|
Due: |
Monday October 9, 2000 |
You are to complete the ``Laboratory Exercise: Observing OS Behavior'' on
page 147 of the textbook. Read the description there for detailed
discussion. The information here added some issues that were not clear
in the textbook description.
- The Linux (and most other UNIX) provides a pseudo-file system
named /proc to store most of the statistics about the
system. The assignment asks you to write three versions of a program
to collect different statistics using the file /proc.
- The statistics you are to collect are as follows.
- A first version collects and prints:
- CPU type and model
- Kernel version
- Amount of time since the system was last booted.
- A second version should print the same information as
the first one plus:
- The amount of time the CPU has spent in user
mode, system mode, and idle
- The number of disk requests made on the system
- The number of context switches the kernel has
performed
- The time at which the system was last booted
- The number of processes that have been created
since the system was booted
- The last version of the program should print the same
information as the second version plus:
- The amount of memory configured on this computer
- The amount of memory currently available
- A list of load average (each averaged over the
last minute). The program would take two parameters: (1) how often
the load average should be read from the kernel; (2) how many total
times the load average should be read.
- The /proc file system has a number of directories and a
number of files. Each file or directory contains some statistics that
the system has been collecting. You should use a separate program
(major source code listed here) to find out which file contains what
information. The files are stored in special format such that you need
to use the following program to read and interpret the
information. Carefully read man proc to get more
information. Read, compile and execute the following program to read
the files in /proc file system.
1#1
- You don't have to submit three separate versions of the
program. You should make the first version work correctly; then the
second version; then the third version. All you need to turn in is the
third version. However, if you have trouble finishing all, you may
turn in the first or second version for partial credit.
Next: Submit Your Program(s) Electronically
Meng Xiannong
2006-07-14