01.06.2014 Views

Concurrent Systems II - Bad Request - Trinity College Dublin

Concurrent Systems II - Bad Request - Trinity College Dublin

Concurrent Systems II - Bad Request - Trinity College Dublin

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Attempt #2<br />

Critical Section Problem Attempt #2<br />

boolean wantp ← false, wantq ← false<br />

loop forever<br />

p<br />

loop forever<br />

q<br />

p1: non-critical section q1: non-critical section<br />

p2: await wantq = false q2: await wantp = false<br />

p3: wantp ← true q3: wantq ← true<br />

p4: critical section q4: critical section<br />

p5: wantp ← false q5: wantq ← false<br />

Do you have an intuition about what might happen?<br />

109<br />

<strong>Trinity</strong> <strong>College</strong> <strong>Dublin</strong><br />

© Mike Brady 2007–2009

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!