CSE 451: Operating Systems, Spring 2010
  CSE Home   About Us   Search   Contact Info 
 
Course Home
 Home
Administrivia
 Overview
 Course email
 
Materials
 Lecture Schedule
 Sections
 Discussion Board
 
Assignments
 Homework
 Projects
 Turnin
 Gradebook
 
Information
 Project information
 Linux information
 forkbomb information
   

Homework 5

Out: Monday April 26

Reading

The text: Silberschatz Chapter 6

Practice Exercises

Due: Sections April 29

Doing these practice questions will help both with midterm preparation and Project 2. There is nothing to turn in - we'll talk about solutions during sections this week.

You shouldn't actually try to compile or run this code. Just write it, at the level of detail of code sketches in the slides.

These solutions are not long. The first question is a bit more specific, trying to introduce you to the pthreads implementation, which you'll use in Project 2. The second question doesn't ask for the more mechanical first two parts of the first question - on the other hand, it should take only a couple minutes to complete them, and you'll have to complete things like them in the project, of course.

  1. Implement counting semaphores using pthread locks (pthread_mutex_t) and condition variables (pthread_cond_t).
    • Give a typedef representing a semaphore_t "object"
    • Give a semaphore_create() method
    • Give a sempahore_wait() method
    • Give a semaphore_signal() method
  2. Implement the read-writers lock example from the slides (and text) using pthread locks and condition variables. (Do this directly - don't say "use my counting semaphores from the first problem, then the code on the slide.")

Computer Science & Engineering
University of Washington
Box 352350
Seattle, WA  98195-2350
(206) 543-1695 voice, (206) 543-2969 FAX
[comments to zahorjan at cs.washington.edu]