Yliopiston etusivulle Suomeksi På svenska In English
Helsingin yliopisto Tietojenkäsittelytieteen laitos
 

Tietojenkäsittelytieteen laitos

Suomeksi In English Homework

Concurrent Programming, Autumn 2006, HW 5

These will be covered in practise session during the week 48, 27.11.-1.12.2006.
  1. Exercise 6.6 from text book.
     
  2. Redo problem 3 in homework set 4 so that process synchronization is done with semaphores.
     
  3. Look at the Algorithm 6.21 in text book (p. 144). Notice the typo in algorithm.
    1. Show that readers have priority over writers.
    2. Will the algorithm work, if all three semaphores would be busy-wait semaphores instead of the usual suspend-wait semaphores? Under which conditions one should/should not use busy-wait semaphores instead of the usual suspend-wait semaphores?
    3. Modify the algorithm so that writers have priority over readers. Why would one want to do it this way?

     
  4. Look at the Algorithm 6.21 in text book (p. 144). Notice the typo in algorithm.
    1. Modify the algorithm so that the last writer will wake up all waiting readers. Notice that you must modify also the entry protocol for readers. Why would one want to do it this way?
    2. Modify the algorithm so that readers and writers have alternating priority. Why would one want to do it this way?

     
  5. Create a symmetric solution to the Dining Phisophers problem. All philosophers need the use exactly the same algorithm, which is not bound to the philosophers identity number. (The algorithm 6.12 in text book is a good asymmetric algorithm, because philosopher 4 uses different algorithm than the others.) Show that your algorithm does not cause deadlocks and that the philosophers do not starve and do not wait unnecessarily. [Andr00]
    • Hint 1: Flip a coin to select which fork to pick up first.
    • Hint 2: Extra variables with which fast thinking philosophers can be kept in line.


Teemu Kerola 22.11.2006 16:44