CSCI 152: Operating Systems Programming

Laboratory Assignment 2 - Cover Sheet 

Group Members (1-3):

1) ______________________________________

2) ______________________________________

3) ______________________________________

Grading Criteria:

Points Recieved
Points Possible
Description

10
Written in C.  Compiles with gcc not g++.  Doesn't make use of C++ libraries like <iostream> or the STL.  

5 Written so that 1 to N persons and 1 to M printers can be specified at runtime (instead of a fixed number).  [You will want this to be able to do lab 3 anyway].  The program takes two command line arguments: The first is the number of producer threads that should be created and the second is the number of consumer threads to be created.  Not required for this project but optional is to also be able to specify a DEBUG LEVEL on the command line.

5
main() exits after all producer threads are finished.  (This means you have to use a pthread_join(), also you need to make sure that the consumer threads are finished before exiting).

5
Uses only one function per thread type (There should be one function for consumers and another function for producers but not a function for each consumer and one for each producer).  [This program should have a main() and around 4 to 6 functions.  If you have more or less than this you are probably doing something wrong].

5
Uses Posix Threads Appropriately.  Program should use a struct to pass in thread data to thread functions  (for instance, an id_number needs to be given to each producer and consumer thread).

20
Uses Semaphores Appropriately.  Consumers wait() on a semaphore for things to be in the queue.  Producers wait() on a semaphore to make sure there is room in the queue.  Producers also have to post() to the consumers semaphore so that consumers find out when something has been added.

10
Uses Mutex Appropriately.  Queue is protected by a mutex.  Queue is protected whenever something is added or removed.

5
Uses rand() appropriately.  This means you use the mod operator to give equal probability.  You initialize it if you need to, whatever...

5
Uses sleep appropriately.  Approximately 1 second elapses between printing each page on a given printer.

5
Includes Documentation as Required (especially header at the top of every file and a function header before every function).

10
Uses debug level to turn the use of sleep() on and off.

5
Program generates nice readable output as described in the lab 2 specification.  It is okay if it gets jumbled up some from multiple threads doing things at the same time but the output needs to explain what is going on, for example, "printer 2 printing document 3 page 1 from person 1".

10
Wrote your own queue.  Also, queue has a small maximum size (3-5) so that we can see it fill up completely so that producers have to wait for there to be more room to put print jobs in it.  [For our purposes, a queue is an array and two functions, addItem() and removeItem() or something like this].

--
POINTS REMOVED FOR MISC:

--
POINTS ADDED FOR MISC:


100

TOTAL POINTS