Basic Interprocess Communication

Lab 1 (Due: Feb. 10, 2010 by 11:55pm by moodle submission)

For this lab you are to create a C program capable of forking itself and creating a chunk of shared memory. The parent and child should communicate through the shared memory.

The functionality of your program will be to read information from the terminal and write it to a file that is specified at the command-line. You should write your program entirely within one main function in a single c-file. The wrinkle is, the program should quickly fork itself so there are two processes each with the following functionality.

To learn more about shared memory read the man page for shm_overview

WARNING

  1. Do not perform this lab on the computes. When working with the fork system call, it is very easy to end up with run away process replication.
  2. Be sure you reap your child process once your work is complete.
  3. Just to be safe, reboot the computer after your done.

Submission

When your complete, tar up your directory and submit a single compressed file to the classes moodle site. Also, you must follow good programming style, this includes: error checking, a make file, and documentation.