Computer Science 322 |
A few weeks ago, you wrote a program that used a child process to compute and print out a Fibonacci sequence. This week, you will implement two varitions on that program.
Write the program for Exercise 3.19 on p. 145-146 of SG&G. Call your program forkfibshared.c and include a Makefile that compiles this program into forkfibshared.
Once your program is working, add a call to sleep(2)1 to your program before you detach and free the shared memory segment. In a separate window, use the ipcs command to see that your shared memory segment is listed, and that it goes away when your program terminates. Save this output and include it in a file ipcs.out to be included in your submission.
Write the program for Exercise 4.17 on p. 177 of SG&G. Call your program pthreadfib.c and include a Makefile that compiles this program into pthreadfib.
Each program will be graded based on design, documentation, style, and correctness. The correctness portion of the lab will be worth 20 points (10 points each), and the design, documentation, and style will be worth a total of 5 points.
To submit this lab, change into your directory that contains all of the subdirectories that you are to turn in (likely lab3) and and create a "tar file" to submit.
tar cvf shmem.tar *
This will create a file shmem.tar in your directory. Send this tar file as an attachment to jteresco AT mtholyoke.edu by 2:40 PM, Monday, March 1, 2010.
Please do not include any additional files, such as emacs backup files, object files, or executable programs.