CS 470 - Operating
Systems
Spring 2007 – Thread Synchronization Project
40 points
Out: February 21, 2007
Due: March 19, 2007 (2nd Monday after spring break)
The purpose of this project is provide experience with Pthreads and (thread) synchronization.
Problem Statement
Complete the producer-consumer project described on pages 236-240 in the textbook using Pthreads. In this project, there may be multiple producers and consumers accessing a bounded buffer, each of which is running in a thread. You may reuse example code used in lecture as you see fit. Differences from the producer-consumer processes with semaphores example include:
Use of threads rather than processes, multiple producers and consumers
No external shared memory, since threads share global data.
Use of thread semaphores instead of external semaphores as explained in the project.
Use of thread mutex lock instead of a mutex semaphore as explained in the project.
Assignment
(20 points) Implementation. This project may be done in individually or in pairs (group of 2). This project may be written in any language as long as it uses Pthreads and runs on csserver. Provide a makefile that will make your project. Recall that when compiling a Pthread program using gcc or g++ that you must include the command-line option: -lpthread
(10 points) Provide a high-level functional analysis and design of the program describing the functionality of the major components of the program and how they interact with each other. If the program does not meet all of the project requirements, describe which parts are missing and what you think should be done to implement them.
(10 points) In addition, answer the following questions:
What aspect of thread manipulation did you find most difficult to understand?
What aspect of thread manipulation did you find least difficult to understand?
What aspect of thread synchronization did you find most difficult to understand?
What aspect of thread synchronization did you find least difficult to understand?
What, if anything, would you change in your current design?
What, if anything, did you find interesting or surprising about thread manipulation or thread synchronization that you did not know before doing this project?
What to Submit
Submit items no later than 4:30pm on the due date.
Create a tarfile containing the source code and makefile for the project. Submit this tarfile electronically by emailing it as an attachment to the instructor.
Submit the following items in hardcopy:
A printout of well-documented code for your project, preferably 2-up in landscape mode.
The functional analysis and design of your project
Answers to the questions above
02/21/2007