Chapter 2 - Proofs - The following are direct quotes from...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
The following are direct quotes from the textbook, with some modifications: The LockOne Class We use write A (x = v) to denote the event in which A assigns value v to field x, and read A (v == x) to denote the event in which A reads v from field x. Sometimes we omit v when the value is unimportant. For example: flag[i] = true; is denoted by: writeA(flag[i] = true) Lemma 2.3.1. The LockOne algorithm satisfies mutual exclusion. Proof: Suppose not. Then there exist integers j and k such that CS A j → CS B k and CS B k → CS A j . Consider each thread's last execution of the lock() method before entering its k th (j th ) critical section. Inspecting the code we see that: write A (flag[A] = true) read A (flag[B] == false) CS A (2.3.1) write B (flag[B] = true) read B (flag[A] == false) CS B (2.3.2) read A (flag[B] == false) write B (flag[B] = true) (2.3.3) Note that once flag[B] is set to true it remains true. It follows that Eq. 2.3.3 holds, since otherwise thread A could not have read flag[B] as false. Eq. 2.3.4 follows from Eqs. 2.3.1 – 2.3.3, and the
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 2

Chapter 2 - Proofs - The following are direct quotes from...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online