CSP301: Assignment 1 on Inter-Process Communication
Background reading
- Read chapter 2 of Unix Network Programming Volume 2: Interprocess Communications by W. Richard
Stevens
- Carefully read the following man pages: signal, ualarm, umask, sigprocmask,
gettimeofday, wait, exec, fork, pipe,open, ipc, clone, msgctcl, msgsnd,
msgrcf,rand, srand48.
Processes
- Expand the hare and turtle process descriptions and implement IPC solutions by
defining cooperating processes.
- First use fork() and execve() to create the processes and develop
complete applications using the following Linux IPC (message passing)
mechanisms separately: (i) pipes (ii) FIFO files and (iii) message queues.
Threads
- Now, develop the same application (hare and turtle) using Linux
pthreads (shared memory).
Tests
-
The current outcome of the race should be displayed after fixed intervals.
-
Try varying the speed and the sleeping time of the hare to see different
outcomes.
Note:
- To be done individually.
- On program exit, all process state should be cleaned up properly
- There should be no remaining running processes
- There should be no leftover FIFO files, message queues, etc.
- The logic should be implemented correctly. For example, the hare
should check again after waking up whether it should go back to sleep
or run
- The last date of submission of solutions using pipes, FIFOs and
message Qs (processes) is Aug 14.
The last date for the threads assignment is Aug 21.