Submission Guidelines

Programming Assignment #2

Implementation Requirements

1- You should submit a tar file that contains the source code for your implementation of the queue abstraction. The entire implementation should be in the file queue.c if it is written in C, or queue.C (capital letter C) if it is written in C++. You can only add fields (or private member functions if you are doing the project in C++) to the header file we supply, you may not change the existing functions’ parameters or return types.

2- Like the first program, you should submit a tar file. The tar file should include:

    1. Makefile that compiles your queue implementation. The executable file should be named "driver"
    2. driver.c (driver.C) that will contain the function main.
    3. The header file (queue.h).
    4. The typescript output of running your version of the driver.

The version of driver that you write should create two new threads and one queue. The first thread should enqueue the numbers 1..10 into the queue, and the second thread should remove the items and print them out as they are removed. When you create the queue, it should have a maximum of 5 items. You should also test the timeout and other features of your program (our test cases will!).

Since we are going to use UNIX scripts to grade your program, please follow the names mentioned before (queue.C, driver.C in case of C++) and (queue.c, driver.c in case of C)

The code has to compile and run on the CSC cluster, i.e. on Alpha stations


1- How are you going to test my program?
1. First, I'll untar the submitted file. Please don't create any directories.

2- Then, replace your driver.C/c with our own version with additional test cases.

3- Type "make".

4- Run your program by typing "driver".

2- How do I submit my project?
You make a tar archive and then call a certain program from my directory called submit. The exact path is


Finally to submit your program, type

submit 2 filename

There is only one filename which is the tar file.

3- When I tried to compile a simple program, I received an error?

You should link the "pthread" library explicitly. So your compilation command should include "-lpthread".

Grading Guidelines:

Proper submission: submitted a tar file containing the files specified above with the exact names.


Probe function.


Head function.


Three thread read-write.


10,000 Read-write.




Beauty points: well-documented code, indented lines, …etc.


Total points: