Information on all processes running on a Linux system is contained within the /proc directory. All directories under /proc which are digits represent a process. If you issue the command ps aux you will see all processes that are running. You can also see the processes ordered by cpu usage by issuing the command top.
In this lab, you will write a C/CPP program to scan all processes running on the system and report on those which have used more than 10Mbytes of resident memory. You can do this by going through each process directory in /proc and looking at the file status. For instance, let's say you want to look at the status information for process 10167:
$ cd /proc/10167
$ vim status
Inside the file status are variables such as Name: (the process name) and Pid: (the process pid). Virtual Memory is represented by VmSize: and Resident memory is represented by VmRSS:
The following web-page contains detailed information about each of the files under /proc:
proc - process information pseudo-filesystem: https://linux.die.net/sag/proc-fs.html.
Sample source code that retrieves system information such as model name, cpu speed, memory usage, processes running/blocked, up time and idle time can be seen at MemMonitor.cpp.
Email me your C/CPP file and Makefile (#1 above) as well as a short document (#3 and #4 above) to: miguel.watler@senecapolytechnic.ca
NB: My last name is Watler, not Walter.