7 mytime 23 mytime reg reg 00 tottime csep 524

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 4: Parallel ComputaDon Winter 2013: Chamberlain 55 Bug of the week •  Whether or not this bug exhibits itself depends on the scheduling of the tasks –  the following schedule is problemaDc: @me Task 1 reg = read totTime reg = reg + myTime totTime = write reg 3.7 myTime Task 2 reg = read totTime reg = reg + myTime totTime = write reg 2.3 myTime 0.0 reg reg 0.0 totTime CSEP 524: Parallel ComputaDon Winter 2013: Chamberlain 56 Bug of the week •  Whether or not this bug exhibits itself depends on the scheduling of the tasks –  the following schedule is problemaDc: @me Task 1 reg = read totTime reg = reg + myTime totTime = write reg Task 2 reg = read totTime reg = reg + myTime totTime = write reg 3.7 myTime 2.3 myTime 0.0 reg 0.0 reg 0.0 totTime CSEP 524: Parallel ComputaDon Winter 2013: Chamberlain 57 Bug of the week •  Whether or not this bug exhibits itself depends on the scheduling of the tasks –  the following schedule is problemaDc: @me Task 1 reg = read totTime reg = reg + myTime totTime = write reg Task 2 reg = read totTime reg = reg + myTime totTime = write reg 3.7 myTime 2.3 myTime 3.7 reg 0.0 reg 0.0 totTime CSEP 524: Parallel ComputaDon Winter 2013: Chamberlain 58 Bug of the week •  Whether or not this bug exhibits itself depends on the scheduling of the tasks –  the following schedule is problemaDc: @me Task 1 reg = read totTime reg = reg + myTime totTime = write reg Task 2 reg = read totTime reg = reg + myTime totTime = write reg 3.7 myTime 2.3 myTime 3.7 reg 2.3 reg 0.0 totTime CSEP 524: Parallel ComputaDon Winter 2013: Chamberlain 59 Bug of the week •  Whether or not this bug exhibits itself depends on the scheduling of the tasks –  the following schedule is problemaDc: @me Task 1 reg = read totTime reg = reg + myTime totTime = write reg Task 2 reg = read totTime reg = reg + myTime totTime = write reg 3.7 myTime 2.3 myTime 3.7 reg 2.3 reg 3.7 totTime CSEP 524: Parallel ComputaDon Winter 2013: Chamberlain 60 Bug of the week •  Whether or not this bug exhibits itself depends on the scheduling of the tasks –  the following schedule is problemaDc: @me Task 1 reg = read totTime reg = reg + myTime totTime = write reg Task 2 reg = read totTime reg = reg + myTime totTime = write reg 3.7 myTime 2.3 myTime 3.7 reg 2.3 reg 2.3 totTime CSEP 524: Parallel ComputaDon Winter 2013: Chamberlain 61 Bug of the week: RRWW (Read-­‐Read-­‐Write-­‐Write) •  Due to interleaving, uncoordinated reads and writes to shared state may cause values to be lost •  The fix is to coordinate such accesses to shared state –  in this case, totTime, minTime, maxTime –  e.g., could protect each/all of them by a lock coforall tid in 0..#numTasks … grab totTime lock totTime += myTime; release totTime lock … CSEP 524: Parallel ComputaDon Winter 2013: Chamberlain 62 Glossary: Synchroniza3on Synchroniza4on: CSEP 524: Parallel ComputaDon Winter 2013: Chamberlain 63 Glossary: Synchroniza3on Synchroniza4on: CoordinaDon between t...
View Full Document

This document was uploaded on 04/04/2014.

Ask a homework question - tutors are online