CS4411 Reading List: Week 5

Textbook Material
Read the following sections
  • Section 6.7
  • Monitors Slides: This set of slides is available in the common directory with filename chap06-4.pdf.
  • Solutions to Exam 1: Will be online this week.
  • Section 6.8 (required reading, will not be covered in class)

Programming Material
Do Programming Assignment 2

Do the following problems
From our text
    Chapter 6: 6.22, 6.26, 6.27, 6.28, 6.29, 6.30, 6.32 (page 271)
Food for Thought
    Although monitors are more structured than semaphores, deadlocks may still occur if monitors are not designed carefully. Consider the following monitor
     
    monitor  deadlock
       condition  p, q;
    
       void  stop(void)
       {
          p.wait;
          ......
          q.signal;
       }
    
       void  go(void);
       {
          ......
          p.signal;
          q.wait;
       }
       // no initialization is required
    }
    
    
    Suppose we have processes P1 and P2 as follows:
    
    P1:    repeat ..... deadlock.stop; ..... until false;
    P2:    repeat ..... deadlock.go;   ..... until false;
    
    
    The intention of this monitor is that P1 is required to wait on condition p until P2 has completed some task, at which point it calls deadlock.go to release P1. P2 then waits until P1 has performed its task, when it signals condition q to indicate that P2 may continue.

    This program looks correct and seems can perform the indicated task. But, it has the potential to deadlock. Find this deadlock.

You do not have to turn in your paper. What I really expect you to do is using these problems to gauge your understanding of the subject. So, do the problems after finish reading the above sections.