TCSS 422 ―Homework Assignment 7

$30.00

Category: You will Instantly receive a download link for .zip solution file upon Payment || To Order Original Work Click Custom Order?

Description

5/5 - (3 votes)

In this assignment you’ll complete a small program that gathers memory usage statistics about the
processes in MINIX.
Implementation Specifications
Your program should query the total amount of memory being used by every process running in MINIX
and display the following four summary statistics (appropriately labeled):
1) Total memory used by all processes.
2) The average memory used per process, i.e., total memory divided by the number of processes.
3) The most memory used by any process, i.e., the largest process.
4) The least memory used by any process, i.e., the smallest process.
The units for all four statistics should be bytes.
To query the memory being used by a process, you’ll need to use information stored in the /proc
directory structure. Each subdirectory in /proc represents a process, and within each subdirectory is a
file called psinfo that records a variety of information about that process. The format for the
psinfo file can be found in the source code that generates that file:
/usr/src/servers/procfs/pid.c. Lines 96–108 and 144–158 produce the psinfo contents.
As your program traverses the /proc directory structure it’s possible that process information may
change. You don’t need to worry about such changes. Instead, you may make the simplifying
assumption that the directory structure and files won’t change while your program is running.
Deliverables
The following items should be submitted to the instructor. Failure to correctly submit assignment files
will result in a 10% grade penalty.
1) The completed source file(s).
Do not include any extraneous files, such as Eclipse IDE files, object files, or subversion files.