CSE5XX Distributed Computing2020 Winter • MidSem • 100 pointsGiven to you: Feb 22, 2020, 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.pdf as an email attachment to me.
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 < 150 then i := i + 150 else i := 100 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) ] ] ]