CSL373: Assignment 1 on Process control and IPC

Background reading

  1. Read one (or more) of the following references:
  2. Carefully read the following man pages: signal, kill, ualarm, umask, sigprocmask, gettimeofday, wait, exec, fork, pipe,open, ipc, clone, msgctcl, msgsnd, msgrcf,rand, srand48.
  3. (optional) Read from the OS books the sections (bed time stories) that deal with: CPU scheduling, processes, threads, IPC.

Processes

  1. Expand the hare and turtle process descriptions and implement IPC solutions by defining cooperating processes.
  2. 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

  1. Now, develop the same application (hare and turtle) using Linux pthreads (shared memory). Here is a good pthreads tutorial. Notice that you have shared memory between threads so you do not need explicit communication channels. You can communicate using shared variables. However, you will need to ensure that different threads synchronize their access to shared variables to avoid inconsistencies. In particular, you should use mutexes (see tutorial) to protect all accesses to shared variables.

Tests

Note:

  1. To be done individually.
  2. The last date of submission of solutions using pipes, FIFOs and message Qs (processes) is Jan 11. The last date for the threads assignment is Jan 13. The deadlines are final and no extensions will be allowed.
  3. Submissions should be made through the submit-lab1 script on palasi.