Dana Vrajitoru
C151 Multi-User Operating Systems
Lab 5
Due date: Monday, February 13, 2012.
Ex. 1
- Copy the following archive into your c151 folder:
~danav/temp/c151/phil.tar.gz
Decompress this file with the commands
gzip -d phil.tar.gz
tar xf phil.tar
You should find a folder called phils. Go to this folder.
- Identify the source files and the header files in this
folder. Compile each of the source files (.cc) one by one to obtain
the objects. You will need the command g++ with the option -c for
that.
- Link all the objects together and create and executable called
phils. For this part you'll need to like the following libraries in
your program:
libpthread.a
Run the executable to test the program. The program will ask for a
number of iterations. Enter something small, like 10. The program does
a small simulation and outputs some statistics.
- Note that this folder contains a file named Makefile. Identify
some of the units in this Makefile (for yourself to make sure you
understand them)). Find the entry called clean in this
Makefile. Invoke this entry with the make command. Make sure that your
executable and your objects have been deleted.
- Compile the project again using the command make. Make sure the
objects have been recreated as well as the executable. Run the program
again to see if the result is the same.
- Using whatever editor you want, add an entry to the Makefile
called run. List no dependencies for this entry and list just one
command which should contain the name of the executable. Run the
program again using the entry in the Makefile that you have just
created.
- Save the content of your terminal into a file called
lab5.txt. You'll have to upload it to Oncourse.
Submit to Oncourse: The modified Makefile and the file
lab5.txt.