CS 416 Operating System Design Fall 2006

For those of you not already familiar with the C language, here is a handy reference card in PDF format.

Here is a simple C program.

Here are the notes from recitation.

Here are client.c and server.c programs and the shared makefile that builds the executables for both.

Here are some instructions on how to create a tar file.

Here is a sample makefile, a second smaller makefile and a readme file.

Some useful insights for your first assignment:

1. The pipe(2) system call will initialize two previously uninitialized file descriptors. What you write into one can be read from the other. See man -a pipe for details on the pipe system call.

2. fork(2) carries all open file descriptors from parent to child.

3. You can do the entire assignment as a single, clean program with fork(2) and pipes.

4. You can do the assignment as three different programs using fork(2), exec(2) and intermediate files, but it doesn't seem like such a good idea.

5. Synchronization, schmynchronization.

6. Sometimes, just waiting is better than continually looking and trying again.

7. In C (and C++), if it's got a file descriptor, it's a file.

8. You open it, you close it.

Do the math, people.

What to hand in:
Through the handin site, hand in a single tar file, which would include a readme.txt file along with your source code and makefile. The readme.txt file should provide instructions for compiling and running your program. There should be no object files or executables handed in. See the links above to a sample readme.txt and a sample makefile. A sample input file is welcome, but we may run your program with our own input to grade it.
Your code should compile and run on the cereal lab machines.

For the second assignment, here's an informative, but useless program using shared memory. Go ahead and look at the man page for the shared memory system calls.

Here is a small, but interesting client and server that use the POSIX multithreading primitives. Here is it's makefile.