081027slides_handouts

081027slides_handouts - Scheduling Meetings Locking and...

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

View Full Document Right Arrow Icon
1 UVa CS205 Engineering Software 2008 Locking and Deadlock UVa CS205 Engineering Software 2008 Scheduling Meetings Alice wants to schedule a meeting with Bob and Colleen Bob Alice Colleen “When can you meet Friday?” “When can you meet Friday?” “11am or 3pm” “9am or 11am” “Let’s meet at 11am” “Let’s meet at 11am” Reserves 11am for meeting Reserves 11am for meeting Picks meeting time UVa CS205 Engineering Software 2008 Partial Ordering of Events ± Sequential programs give us a total ordering of events: everything happens in a determined order ± Concurrency gives us a partial ordering of events: we know some things happen before other things, but not total order Alice asks to schedule meeting before Bob replies Alice asks to schedule meeting before Colleen replies Bob and Colleen both reply before Alice picks meeting time Alice picks meeting time before Bob reserves time on calendar UVa CS205 Engineering Software 2008 Race Condition Bob Alice Colleen “When can you meet Friday?” “When can you meet Friday?” “9, 11am or 3pm” “9am or 11am” “Let’s meet at 11am” “Let’s meet at 11am” Picks meeting time Doug “When can you meet Friday?” “9, 11am or 3pm” “Let’s meet at 11am” Reserves 11am for Doug “I’m busy then…”
Background image of page 1

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

View Full DocumentRight Arrow Icon
2 UVa CS205 Engineering Software 2008 Preventing Race Conditions ± Use locks to impose ordering constraints ² Be sure your solution (algorithm) is best for concurrent execution – the best sequential algorithm often does not become the best concurrent one. ² There is a non-deterministic solution to scheduling that doesn’t require locks! ± After responding to Alice, Bob reserves all the times in his response until he hears back (and then frees the other times) UVa CS205 Engineering Software 2008 Locking Bob Alice Colleen “When can you meet Friday?” “When can you meet Friday?” “9, 11am or 3pm” “9am or 11am” “Let’s meet at 11am” “Let’s meet at 11am” Picks meeting time Doug “When can you meet Friday?” “3pm” “Let’s meet at 3” Locks calendar UVa CS205 Engineering Software 2008
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 6

081027slides_handouts - Scheduling Meetings Locking and...

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

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