CSCI 152: Operating Systems Programming

Laboratory Assignment 3

ASSIGNMENT DUE: see calendar on the web

Assignment Description:

Lab 3 involves adding a modification to lab 2.  So as long as you completed lab 2 and lab 1 it should not be too difficult.

In lab 2 each "producer" was a thread created by main() and generated print jobs in a somewhat random fashion.  In lab 3 this portion of the program will be modified so that main() creates a network server and each client that connects to the server is a "producer".  So a client can connect and generate print jobs interactively.

Each network server thread does the following: Create producer ID's in some fashion.  (Maybe use a incrementing counter or by choosing a random integer or the thread_id, etc.)  Each producer should have a unique ID so that the server can send output to the terminal like "Printer 5 printing Job 12 page 1 of 3 from Client 4".

Please note in Lab 1 most students implemented a network server capable of handling multiple clients simulaneously by using the system call fork().  In this lab you must accomplish the same thing except by using POSIX threads.

Consumer threads are created the same way as they were in Lab 3.

Problems to Avoid in Producer/Consumer:

Goals:

Learn about operating system fundamentals, including history, process and thread management, concurrency with semaphores and monitors, deadlocks, storage management, file systems, I/O, and distributed systems.

Objectives:

Expected Outcome: