1 / 5

# Midterm - PowerPoint PPT Presentation

Midterm. P 1 : P 2 : P 3 : x = 1 y = 1 z = 1 P 3 ! x - 1 ------------------------------------------------ > P 1 ? z {A1: x = 1 } { C1: z= 0 /\ x = 1} P 3 ? y < ---------------------- P 2 ! z + 1

I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.

## PowerPoint Slideshow about 'Midterm' - zanthe

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript

### Midterm

P1: P2: P3:

x = 1 y = 1 z = 1

P3 ! x - 1 ------------------------------------------------> P1 ? z

{A1: x = 1 } { C1: z= 0 /\ x = 1}

P3 ? y <----------------------P2 ! z + 1

{B1: y = 1 /\ z = 0} {C2: z= 0 /\ y = 1}

y = y + 1

{B2: y = 2}

P2 ? x <-------------- P1 ! y

{A2: x = 2/\ y = 2} {B3: y = 2 /\ x = 2}

do do

wait for a slot to be empty wait until a slot is non-empty

deposit item in the empty slot fetch item from a non-empty slot

od od

Producer: Consumer:

do do

in1++ in2++

deposit item in the empty slot fetch item from a non-empty slot

out1++ out2++

od od

in1 <= out2 + 2 /\ in2 <= out1

in1 <= out2 + out3 + 2 /\ in2 + in3 <= out1

co

{ x = y \/ y = x + 3}

< x = x + 2>

{x = y + 2 \/ y = x + 1}

||

{ x = y \/ x = y + 2}

< y = y + 3>

{ x + 3 = y \/ x + 1 = y>

oc

{ y = x + 1}