1 CSCE 313 Introduction to Computer Systems Spring 2011 Homework 2 (25 points) Chapters 8, 13 and 14 are the focus of this homework assignment. It requires the course textbook and the Programs located on the book website: http://usp.cs.utsa.edu/usp/ . 1. The readers/writers problem is discussed in the text on page 478. We covered it in class in Lecture 5, slide 33. Re-write the pseudo code on slide 33 to give priority to writers. If you were to write the pseudo code in C, which synchronization type (sem_t, pthread_mutex_t, or pthread_rwlock_t) you would use? Explain why in terms of how they would be used. 2. Download the programs for Chapter 13. You’ll find Programs 13.2 thru 13.8 are interrelated. Run the Program computethreadmain with parameters 5 (#threads) and 1 (second) three times in a row. Turn in the output of these three runs. Explain why the output of each run is not the same. 3.
This is the end of the preview.
access the rest of the document.