Computer Science 330
Operating Systems
Fall 2022, Siena College
In this lab, you will see how to use System V shared memory with Unix processes.
You may work alone or with a partner or two on this lab.
Learning goals:
Getting Set Up
In Canvas, you will find link to follow to set up your GitHub repository, which will be named shmem-lab-yourgitname, for this lab. Only one member of the group should follow the link to set up the repository on GitHub, then others should request a link to be granted write access.
fork() Practice
The Syracuse Sequence starting at a given positive integer n is defined by repeated application of the function
f(n) = n/2 if n is even, 3n+1 if n is odd.
The sequence ends when the value reaches 1. It is not known if all values of n eventually lead to 1, but no one has found a value for which it doesn't or proven that one must exist.
Notes:
Adding Shared Memory
Once your program is working, add a call to sleep(2) (recall that "2" here refers to the manual section, not the argument to pass - you'll want to pass a larger number of seconds) 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.txt to be included in your submission (5 points).
Submission
Commit and push!
Grading
This assignment will be graded out of 40 points.
Feature | Value | Score |
forksyr.c | 10 | |
forksyrshared.c | 25 | |
ipcs.txt | 5 | |
Total | 40 | |