CS33211 "Operating Systems" HOMEWORK #2 Due in class 11/02/2004 The numbers in parenthesis refer to exercises in "Operating System Concepts" (OSC) textbook. Unless otherwise specified, each question is worth 3 points. 1. Modify the solution for barrier synchronization as follows. There are three processes and each process can depart from the barrier only when the other two are at the barrier. 2. Modify the solution to the semaphore-based producer/consumer problem to allow multiple producers and consumers. Note that you have to allow multiple producers as well as multiple consumers to proceed concurrently if possible. 3. Solve OSC 7.8 using locks and condition variables 4. The locks and CVs solution to producer/consumer that we studied in class assumes an unbounded buffer. Provide a bounded buffer solution to producers/consumer problem using locks and CVs 5. Consider a system of processes P1,P2,...,PN. Each process has unique identifier 1 through N. The processes may concurrently access a certain file by invoking procedure READ_FILE(). The constraint is that the processes can read the file as long as the sum of the identifiers of the processes is less than a number S > N. Write a locks and CV-s based implementation of READ_FILE(). 6. [each sub-question is worth 1 point] The below real-world problem require the application of one of the classic problems of concurrency that we studied. Identify the problem and explain your choice. Suggest (but do not supply) a solution out of the ones we studied. a) A scheduler function of the OS manipulates the ready-queue of PCBs. The scheduler can be run by any process in the system when this process is in kernel mode. However, only one process running the scheduler code is allowed to manipulate the ready-queue at a time. b) multiple processes iteratively process an array of elements Every process concurrently works on a single array elements, however, the work depends on the result of the previous iteration of all elements c) the network stack consists of TCP and IP layer programs. the TCP layer passes the messages to IP layer to send over the network. The layers work concurrently and vary in speed. To increase concurrency the messages are stored in an array. d) There are parallel processes competing for limited memory. The process memory requirements differ. Each process cannot proceed until its memory requirements are satisfied, however, more than one process can proceed simultaneously if their memory requirements are met. e) The files on the web-server are updated concurrently with the requests from the web to download the files. The update process can update one file at a time and the downloads also require one file at a time. Multiple downloads can overlap but they cannot overlap with the file update. Multiple file updates of the same file cannot overlap either.