Date: Mon, 11 Nov 1996 17:24:46 GMT Server: NCSA/1.5 Content-type: text/html Last-modified: Fri, 01 Mar 1996 17:52:01 GMT Content-length: 4486
UNIVERSITY OF WISCONSIN-MADISON
Computer Sciences Department | ||
CS 537
Spring 1996 | Bart Miller | |
Programming Assignment #2
(Due Tuesday, March 5, at 5pm) |
The goal of this assignment is to get experience in writing a program that actually runs in parallel. You will write a program with four processes, structure like:
The processes will communicate through shared memory. Each of the three pairs of communicating processes will have a queue of buffers between. This queue will be represented by a C++ class that you will call SyncQueue. The SyncQueue class will be implemented as a fixed sized buffer; the constructor for the class will take a parameter (with a default) to set the size of the buffer.
You should use semaphores to make sure that processes do not insert or remove data from the same queue at the same time. You should also make sure that each buffer queue is locked separately, so that only the pair of processes using that buffer queue would block. The semaphores should be part of the SyncQueue class definition, so each instance of the class produces a new queue with new semaphores.
You will use the semaphore and thread operations supported by the Solaris operating system. We have prepared a summary of the functions that you will use, and special instructions for compiling your program.
For this assignment, you must use a Sun workstation running the Solaris operating system.
For semaphore operations, you will use sema_init, sema_wait (the P operation), and sema_post (the V operation). In addition to the description that we provide, you can use the "man" command to find out more about these functions.
You must do a few special things to compile a program to use threads and synchronization. Follow the instructions carefully or you will get strange (and incorrect) results.
You should hand in a print-out of your program, including all .C (.cc) and .h files. Also hand in your Makefile. You should run your program on the data stored in ~cs537-2/public/program2/DATA.test. This file is not yet available. Do not print the data file nor should you hand in the output of your program..
After your program is completed, you will meet with Muthiah to demonstrate your running program. Make sure that you do not modify your files after you turn in the program.