Question: Consider following solution to the producer-consumer problem: empty, full := true, false process producer var a: array 0 .. N - 1 of T =
Consider following solution to the producer-consumer problem:
empty, full := true, false
process producer var a: array 0 .. N - 1 of T = var p: 0 .. N p := 0 while p < N do await empty then empty := false buf := a(p) full, p := true, p + 1 | process consumer var b: array 0 .. N - 1 of T var c: 0 .. N c := 0 while c < N do await full then full := false b(c) := buf empty, c := true, c + 1 |
Draw a hierarchical state diagram (draw.io is recommendable). Add all annotations that are needed to establish the postcondition a = b. Label all states and state all pair of states of the producer and consumer that exclude each other! You don't need to give the proofs, but you may want to check yourself that the annotation is correct.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
