|   | CEG 7370 Distributed Computing2015 Spring • MidSem • 100 pointsGiven to you:  Mar 12, 8:00 PM; | 
This take-home exam permits the use of a Linux/Windows laptop/PC running javac, g++, Eclipse, Idea, and other software development and drawing tools. It is otherwise a traditional closed book, closed notes exam. In particular, you are honor bound *not* to Internet surf or access any content already existing (other than as indicated) once you access the exam until you turnin the answers. The primary reasons in making this a take-home are to relieve time pressure and give you a comfortable (computing/home) environment. Do not give or take help from others.
Submit your answers on
thor.cs.wright.eduusing~pmateti/ceg7370/turnin MidSem answers.pdf
| Determine P a predicate that characterizes the weakest deadlock-free precondition for the program. Also, explain how you arrived at P. | co <await x >= 7 -> x := x - 3> || <await x >= 6 -> x := x + 1> || <await x >= 5 -> x := x + 1> oc | 
if i < 15 then i := i + 5 else i := 5 fi
      P(m);
        Critical-Section; V(m) is not starvation-free.  Give a
        detailed starvation scenario.  What does Morris' algorithm do
        to eliminate this scenario?
          
          
    S(i: 1 .. 100) ::
    *[   n: integer; S(i-1)?has(n) --> S(0)!false
     []  n: integer; S(i-1)?insert(n) -->
            *[  m: integer; S(i-1)?has(m) -->
                 [   m <=  n --> S(0)!(m = n)
                 []  m >   n --> S(i+1)!has(m)
                 ]
             [] m: integer; S(i-1)?insert(m) -->
                 [  m < n --> S(i+1)!insert(n); n := m
                 [] m = n -->  skip
                 [] m > n --> S(i+1)!insert(m)
     ] ] ]