Work 8: Ring ring ring ring... semaphone!

posted Dec 8, 2016, 7:02 AM by JonAlf Dyrland-Weaver   [ updated Dec 15, 2016, 6:59 AM ]
With your table buddy, write a telephone style game simulator! It will use a semaphore to control access to a file and shared memory. This will be due on Monday.
You will need 2 programs:
  1. Control for the resources
    • Should take a command line argument to determine if it is creating or removing the resources or viewing the story.
    • If creating (command line argument: -c):
      • Should make the shared memory, semaphore and file (open the file with the truncate flag). 
      • Set any values that are needed.
    • If removing (command line argument: -r)
      • Remove the shared memory and the semaphore
      • Display the full contents of the story.
    • If viewing (command line argument: -v)
      • Output the contents of the story file. 
      • This mode does not need to interact with the semaphore
  2. The writing program
    • Will attempt to access the resources using the semaphore
      • Once in, it should display the last line added to the file (the shared memory should contain the size of the last line).
      • Then prompt the use for the next line.
      • Once a new line is added, it should write that to the file, update the shared memory and then release the semaphore
  3. You do not need a run target in your makefile
github links:
https://github.com/mks65/semaphone.git
Comments