

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


Programming Assignment 1 Assigned: Monday Sept 8th, 2008 Due: Sunday 21st, 2008 Language to Use: C Group Size: 2 Goal: To acquaint you with Linux and to help you brush up on your C programming skills, you will be reading system information from the proc files. To do this, you will need to make use of system calls and file I/Os, which will prepare you for your next assignment. Project Description: Part 1) Using the Proc File System You will write a program that displays the following information: The current time (date not required but is in my example) The total amount of time the computer has been on (uptime) The current version of Linux The current user’s ID The total amount of memory the system has, in KB The amount of memory currently being used, in KB Furthermore if the program is called with the command line argument -p, you should display a list of all processes running that are owned by the current user. For each process you should display the following: The PID (Process ID) of the process The name of the process You can test this functionality by making use of ctrl+z to minimize a program such as emacs or pico (you can type the command fg to bring the program back to the foreground). Note: A makefile must be used for all projects in this class.
Part 2) Using strace Write a program that uses several system calls, at least 5 distinct system calls. Compile and run the program to ensure the system calls work accordingly. Record the output of your program (if any) into a file. (Hint: Use standard redirection “>” in Linux) Proceed to execute “strace” to trace the program written in Part 2a. Record the output of the trace into a file using the –o option. Perform the following experiment: