Man Cao Jake Roemer Aritra Sengupta Michael D Bond 1 Parallel Programming is Hard 2 Parallel Programming is Hard Sharedmemory 3 Main Memory CPU Cache CPU Cache CPU Cache CPU ID: 570759
Download Presentation The PPT/PDF document "Prescient Memory: Exposing Weak Memory M..." is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.
Slide1
Prescient Memory: Exposing Weak Memory Model Behavior by Looking into the Future
Man CaoJake RoemerAritra SenguptaMichael D. Bond
1Slide2
Parallel Programming is Hard
2Slide3
Parallel Programming is Hard
Shared-memory3
Main Memory
CPU
Cache
CPU
Cache
CPU
Cache
CPU
CacheSlide4
Parallel Programming is Hard
Shared-memoryDifficult to be both correct and scalable4
Main Memory
CPU
Cache
CPU
Cache
CPU
Cache
CPU
CacheSlide5
Parallel Programming is Hard
Shared-memoryDifficult to be both correct and scalableData race
5
Main Memory
CPU
Cache
CPU
Cache
CPU
Cache
CPU
CacheSlide6
Parallel Programming is Hard
Shared-memoryDifficult to be both correct and scalableData race
-Fundamentally, lacks strong semantic
guarantees
6
Main Memory
CPU
Cache
CPU
Cache
CPU
Cache
CPU
CacheSlide7
Example #1: Weak Semantics
7T1T2
data = new Foo();
flag
= true;
if (
flag
)
data
.bar();
Foo data
=
null;
b
oolean
flag= false;Slide8
Example #1: Weak Semantics
8Null pointer exception!T1
T2
data
= new Foo();
flag
= true;
if (
flag
)
data
.bar();
Foo data
=
null;
b
oolean
flag= false;Slide9
Example #1: Weak Semantics
9
No data dependence
T1
T2
data
= new Foo();
flag
= true;
Foo data
=
null;
b
oolean
flag= false;
Null pointer exception!
if (
flag
)
data
.bar();Slide10
Exposing Behaviors of Data Races
Existing ApproachesDynamic analyses Model checkers10Slide11
Exposing Behaviors of Data Races
Existing ApproachesDynamic analyses - Limitation: coverageModel checkers - Limitation: scalability11Slide12
Exposing Behaviors of Data Races
Existing ApproachesDynamic analyses - Limitation: coverageModel checkers - Limitation: scalabilityPrescient Memory (PM) Dynamic analysis with better coverage
12Slide13
Outline
Memory Models and Behaviors of Data RacesDesignPrescient Memory (PM)PM-profilerPM WorkflowEvaluation
13Slide14
Memory Model
14Defines possible values that a load can returnSlide15
Memory Model
Defines possible values that a load can return15Slide16
Memory Model
Defines possible values that a load can return16Slide17
Behaviors Allowed by Memory Models
17DRF0 Memory Model
Java Memory Model (JMM)Slide18
Behaviors Allowed by Memory Models
18DRF0 Memory Model
Java Memory Model (JMM
)
Racy execution
No semantics
Data-race-free execution
Strong semantics (SC
)Slide19
Behaviors Allowed by Memory Models
19DRF0 Memory Model
Java Memory Model (JMM
)
Racy execution
No semantics
Data-race-free execution
Strong semantics (SC
)
Racy execution
Weak
semantics
Data-race-free execution
Strong semantics (SC
)Slide20
Behaviors Allowed by Memory Models
20DRF0 Memory Model
Java Memory Model (JMM
)
Racy execution
No semantics
Data-race-free execution
Strong semantics (SC
)
Racy execution
Weak
semantics
Data-race-free execution
Strong semantics (SC
)
Racy execution
can still
lead to surprising
behaviors!Slide21
Behaviors Allowed in JMM #1: Revisit
21T1T2
data = new Foo();
flag
= true;
if (
flag
)
data
.bar();
Foo data
=
null;
b
oolean
flag= false;Slide22
Behaviors Allowed in JMM #1: Revisit
22T1T2data
= new Foo();
flag
= true;
if (
flag
)
data
.bar();
Foo data
=
null;
b
oolean
flag= false;
stale value
latest valueSlide23
Behaviors Allowed in JMM #1: Revisit
23Null pointer exception!T1
T2
data
= new Foo();
flag
= true;
if (
flag
)
data
.bar();
Foo data
=
null;
b
oolean
flag= false;
stale value
latest valueSlide24
Behaviors Allowed in JMM #1: Revisit
24T1T2data
= new Foo();
flag
= true;
if (
flag
)
data
.bar();
Foo data
=
null;
b
oolean
flag= false;
Returning
stale value
can trigger the exceptionSlide25
Behaviors Allowed in JMM #2
25r = data;flag = 1;
T1
T2
int
data = flag = 0;
while (
flag
== 0) {}
data
= 1;
assert r == 0;Slide26
Behaviors Allowed in JMM #2
26r = data;flag = 1;
T1
T2
int
data = flag = 0;
while (
flag
== 0) {}
data
= 1;
assert r == 0;Slide27
Behaviors Allowed in JMM #2
27r = data;flag = 1;
T1
T2
int
data = flag = 0;
while (
flag
== 0) {}
data
= 1;
assert r == 0;
latest value
future valueSlide28
Behaviors Allowed in JMM #2
28r = data;flag = 1;
T1
T2
int
data = flag = 0;
while (
flag
== 0) {}
data
= 1;
assert r == 0;
latest value
future value
Valid due to lack of
happens-before
orderingSlide29
Behaviors Allowed in JMM #2
29r = data;flag = 1;
T1
T2
int
data = flag = 0;
while (
flag
== 0) {}
data
= 1;
assert r == 0;
latest value
future value
Assertion failure!Slide30
Behaviors Allowed in JMM #2
30r = data;flag = 1;
T1
T2
int
data = flag = 0;
while (
flag
== 0) {}
data
= 1;
assert r == 0;
Assertion failure!Slide31
Behaviors Allowed in JMM #2
31r = data;flag = 1;
T1
T2
int
data = flag = 0;
while (
flag
== 0) {}
data
= 1;
assert r == 0;
Requires
returning
future value
or
reordering
to trigger the assertion failureSlide32
Example #3
32r1 = x;y = r1;T1
T2
r2 = y;
if (r2 == 1) {
r3 = y;
x = r3;
} else x = 1
;
assert r2 == 0;
int
x = y = 0;Slide33
Example #3
33r1 = x;y = r1;T1
T2
r2 = y;
if (r2 == 1) {
r3 = y;
x = r3;
} else x = 1
;
assert r2 == 0;
int
x = y = 0;
JMM
disallows
r2 == 1 because of
causality
requirements
–
Ševčík and Aspinall
, ECOOP, 2008Slide34
Example #3
34r1 = x;y = r1;T1
T2
r2 = y;
if (r2 == 1) {
r3 =
r2
;
x = r3;
} else x = 1
;
assert r2 == 0;
int
x = y = 0;
However, in a
JVM
, after redundant read eliminationSlide35
Example #3
35r1 = x;y = r1;T1
T2
r2 = y;
if (r2 == 1) {
r3 =
r2
;
x = r3;
} else x = 1
;
assert r2 == 0;
int
x = y = 0;
However, in a
JVM
, after redundant read elimination
r2 = y;
If (r2 == 1)
x = r2;
else x = 1;Slide36
Example #3
36r1 = x;y = r1;T1
T2
r2 = y;
if (r2 == 1) {
r3 =
r2
;
x = r3;
} else x = 1
;
assert r2 == 0;
int
x = y = 0;
However, in a
JVM
, after redundant read elimination
r2 = y;
x
= 1
;
r2 = y;
If (r2 == 1)
x = r2;
else x = 1;Slide37
Example #3
37r1 = x;y = r1;T1
T2
r2 = y;
if (r2 == 1) {
r3 =
r2
;
x = r3;
} else x = 1
;
assert r2 == 0;
int
x = y = 0;
However, in a
JVM
, after redundant read elimination
r2 = y;
x
= 1
;
r2 = y;
If (r2 == 1)
x = r2;
else x = 1;
Assertion failure possible!Slide38
Behaviors Allowed by Memory Models and JVMs
38DRF0 Memory Model
Java Memory Model
Typical JVMsSlide39
Behaviors Allowed by Memory Models and JVMs
39DRF0 Memory Model
Java Memory Model
Typical JVMs
Unsatisfactory, impractical
to enforceSlide40
Exposing Behaviors of Example #3
40T1T2
int x = y = 0;
Consider future value
r1 = x
;
y
= r1
;
r2 =
y;
if (r2 == 1) {
r3 =
y;
x =
r3;
} else x = 1
;
assert r2 == 0;Slide41
Exposing Behaviors of Example #3
41r1 = x; // r1 = 1y = r1; // y = 1
T1
T2
r2 = y
;
// r2 = 1
if (r2 == 1) {
r3 = y
;
// r3 = 1
x = r3
;
// x = 1
} else x = 1
;
assert r2 == 0;
int
x = y = 0;
Consider future valueSlide42
Exposing Behaviors of Example #3
42r1 = x; // r1 = 1y = r1; // y = 1
T1
T2
r2 = y
;
// r2 = 1
if (r2 == 1) {
r3 = y
;
// r3 = 1
x = r3
;
// x = 1
} else x = 1
;
assert r2 == 0;
int
x = y = 0;
Consider future value
r1 = 1 justified!
Assertion failure!Slide43
Exposing Behaviors of Example #3
43r1 = x;y = r1;T1T2
r2 = y;
if (r2 == 1) {
r3 = y;
x = r3;
} else x = 1
;
assert r2 == 0;
int
x = y = 0;
Requires
returning
future value
or compiler optimization and reordering
to trigger the assertion failureSlide44
Exposing Behaviors with Dynamic Analyses
Typical approachesSimulate weak memory models behaviors [1,2,3]Explore multiple thread interleavings [4, 5]44
Adversarial Memory, Flanagan & Freund, PLDI’09
Relaxer,
Burnim
et al, ISSTA’11
Portend+,
Kasikci
et al, TOPLAS’15
Replay Analysis,
Narayanasamy
et al, PLDI’07
RaceFuzzer, Sen, PLDI’08Slide45
Exposing Behaviors with Dynamic Analyses
Typical approachesSimulate weak memory models behaviors [1,2,3]Explore multiple thread interleavings [4, 5]Coverage LimitationReturn stale values only, not future values
Cannot expose assertion failures in Examples #2, #
3
45
Adversarial Memory, Flanagan & Freund, PLDI’09
Relaxer,
Burnim
et al, ISSTA’11
Portend+,
Kasikci
et al, TOPLAS’15
Replay Analysis,
Narayanasamy
et al, PLDI’07RaceFuzzer, Sen, PLDI’08Slide46
Relationship among memory models and exposed behaviors
46DRF0 Memory Model
Java Memory Model
Existing Dynamic Analyses
Typical JVMsSlide47
Relationship among memory models and exposed behaviors
47DRF0 Memory Model
Our Goal
Java Memory Model
Existing Dynamic Analyses
Typical JVMsSlide48
Relationship among memory models and exposed behaviors
48DRF0 Memory Model
Our Goal
Java Memory Model
Existing Dynamic Analyses
Typical JVMs
Example #1
data
= new Foo(); if
(
flag
)
flag
= true;
data
.bar();
Example #2
r =
data
; while
(
flag
== 0)
{}
flag
= 1
;
data
= 1;
Example #3
r1 = x
; r2
= y
;
y = r1
; if (r2 == 1) {
r3 = y;
x = r3;
} else x = 1;Slide49
Relationship among memory models and exposed behaviors
49DRF0 Memory Model
Our Goal
Java Memory Model
Existing Dynamic Analyses
Typical JVMs
Example #1
data
= new Foo(); if
(
flag
)
flag
= true;
data
.bar();
Example #2
r =
data
; while
(
flag
== 0)
{}
flag
= 1
;
data
= 1;
Example #3
r1 = x
; r2
= y
;
y = r1
; if (r2 == 1) {
r3 = y;
x = r3;
} else x = 1;
Real-world evidence is valuable here!Slide50
Outline
Memory Models and Behaviors of Data RacesDesignPrescient Memory (PM)PM-profilerPM WorkflowEvaluation
50Slide51
Prescient Memory: Key Idea
Speculatively “guess” a future value at a loadValidate
the speculative value at a later store
51Slide52
Prescient Memory: Key Idea
Speculatively “guess” a future value at a loadValidate
the speculative value at a
later store
52Slide53
Returning Future Values is Tricky
53r1 = x;y = r1;T1
T2
r2 = y;
if (r2 ==
0)
x = 1;
assert r1 == 0 || r2 == 0;
int
x = y = 0;Slide54
Returning Future Values is Tricky
54r1 = x;y = r1;T1T2
assert r1 == 0 || r2 == 0;
int
x = y = 0;
r2 = y;
if (r2 ==
0)
x = 1;Slide55
Returning Future Values is Tricky
55T1T2int
x = y = 0;
r1 = x
;
// r1 = 1
y = r1
;
// y = 1
assert r1 == 0 || r2 == 0;
r2 = y
;
// r2 = 1
if (r2 ==
0)
x = 1;Slide56
Returning Future Values is Tricky
56T1T2
int x = y = 0;
r1 = x
;
// r1 = 1
y = r1
;
// y = 1
assert r1 == 0 || r2 == 0;
r2 = y
;
// r2 = 1
if (r2 ==
0)
x = 1;
r1 = 1 not justifiedSlide57
Returning Future Values is Tricky
57T1T2int
x = y = 0;
r1 = x
;
// r1 = 1
y = r1
;
// y = 1
assert r1 == 0 || r2 == 0;
r2 = y
;
// r2 = 1
if (r2 ==
0)
x = 1;
r1 = 1 not justified
Invalid
execution!Slide58
Returning Future Values is Tricky
58T1T2int
x = y = 0;
r1 =
x;
y
= r1
;
assert r1 == 0 || r2 == 0;
r2 =
y;
if (r2 ==
0)
x = 1;
Should
never
fail!Slide59
Returning Future Values is Tricky
59r1 = x;y = r1;T1T2
r2 = y;
if (r2 ==
0)
x = 1;
assert r1 == 0 || r2 == 0;
int
x = y = 0;
Validating
speculative values is necessary to
prevent
nonsensical
resultsSlide60
Prescient Memory: Key Idea
Speculatively “guess” a future value at a loadValidate
the speculative value at a later store
60Slide61
Prescient Memory: Key Idea
Speculatively “guess” a future value at a loadValidate
the speculative value at a later store
61
Valid
future value
Store writes the
same
value
Store
races
with loadSlide62
Prescient Memory: Key Idea
Speculatively “guess” a future value at a loadMaintain a per-variable speculative read historyRecords <logical timestamp, speculative value>
Validate
the speculative value at a
later store
62
Valid
future value
Store writes the
same
value
Store
races
with loadSlide63
PM Example
631: r = x;2: y = 1;
T1
T2
int
x = y = 0;
3: while (
y
== 0) {}
4
:
x
= 1;
assert r == 0;
S[x]
=
∅
Timestamp:
K
1
Timestamp: K
2Slide64
PM Example
641: r = x;2: y = 1;
T1
T2
int
x = y = 0;
3: while (y == 0) {}
4
:
x = 1;
1 ⇠
predict(…) // guess value 1
S
[x] = {<K
1
, 1>}
S
[x]
=
∅
assert r == 0;
Timestamp:
K
1
Timestamp: K
2Slide65
PM Example
651: r = x;2:
y = 1;
T1
T2
int
x = y = 0;
3: while (y == 0) {}
4
:
x
= 1;
S
[x]
=
∅
validate S[x]:
K
1
⋢ K
2
&& 1
== 1
1 is a valid future value!
assert r == 0;
Timestamp:
K
1
Timestamp: K
21 ⇠
predict(…) // guess value 1
S
[x] = {<K
1
, 1>}Slide66
Challenges
How to guess a future value?66predict(…) ?Slide67
Challenges
How to guess a future value?Which load should return a future value?What value should be returned?
67Slide68
Challenges
How to guess a future value?Which load should return a future value?What value should be returned?Solution
Profile
possible future values in a prior run
68Slide69
Profiling Future Values
Helper Dynamic Analysis: PM-profilerMaintains a per-variable concrete read historyAt a load, records:
<logical timestamp, instruction ID, set of visible
values>
69Slide70
Profiling Future Values
Helper Dynamic Analysis: PM-profilerAt a store, detects:70
Potential future value for a previous load
Store
races
with the previous
load
Store writes a
value
distinct
from visible values of the previous loadSlide71
Prescient Memory Workflow
71
Data race detector
PM-Profiler
PM
Racy accesses
Potential future values and loads
First Execution
Second ExecutionSlide72
Prescient Memory Workflow
72
Data race detector
PM-Profiler
PM
Racy accesses
Potential future values and loads
First Execution
Second Execution
Run-to-run
nondeterminism
affects
validatable
future
valuesSlide73
Prescient Memory Workflow
73
Data race detector
PM-Profiler
PM
Racy accesses
Potential future values and loads
First Execution
Second Execution
Run-to-run
nondeterminism
affects
validatable
future
values
Solution: record and replaySlide74
Prescient Memory Workflow
74
Data race detector
PM-Profiler
PM
Fuzzy Replay
Record
Racy accesses
Potential future values and loadsSlide75
Prescient Memory Workflow
75
Data race detector
PM-Profiler
PM
Fuzzy Replay
Record
Racy accesses
Potential future values and loads
Returning a future value could
diverge
from the record execution
Best-effort, fuzzy replaySlide76
Outline
Memory Models and Behaviors of Data RacesDesignPrescient Memory (PM)PM-profiler
PM Workflow
Evaluation
76Slide77
Methodology and Implementation
Compare withAdversarial Memory (AM) [Flanagan & Freund, PLDI’09]: a dynamic analysis that only uses stale values77Slide78
Methodology and Implementation
Compare withAdversarial Memory (AM) [Flanagan & Freund, PLDI’09]: a dynamic analysis that only uses stale valuesPlatform
Jikes RVM 3.1.3
DaCapo Benchmark 2006, 2009 and SPEC JBB 2000 & 2005
4-Core Intel Core
i5-2500
Record and Replay [Replay, Bond et al. PPPJ’15
]
78Slide79
Methodology and Implementation
Compare withAdversarial Memory (AM) [Flanagan & Freund, PLDI’09]: a dynamic analysis that only uses stale valuesPlatformJikes RVM 3.1.3DaCapo Benchmark 2006, 2009 and SPEC JBB 2000 & 2005
4-Core Intel Core i5-2500
Record and Replay [Replay, Bond et al. PPPJ’15
]
Implementation limitation
D
oes
not support reference-type
fields
79Slide80
Exposed Erroneous Behaviors
ProgramAMPMhsqldbNon-terminationData corruption
hsqldb
None
Performance bug
avrora
Data corruption
Data corruption
lusearch
(GNU
Classpath
)
Performance bug
None
sunflow
Null
ptr
exception
Null ptr exception
jbb2000Non-termination
Data corruptionjbb2000
Data corruption
Data corruption
jbb2005 (GNU Classpath)
Data corruption
Data corruptionjbb2005 (GNU
Classpath)
Data corruption
None
80Slide81
Exposed Erroneous Behaviors
81PM found 3 new erroneous behaviors!ProgramAM
PMhsqldb
Non-termination
Data corruption
hsqldb
None
Performance bug
avrora
Data corruption
Data corruption
lusearch
(GNU
Classpath
)
Performance bug
None
sunflow
Null
ptr exception
Null ptr exceptionjbb2000
Non-termination
Data corruption
jbb2000
Data corruptionData corruption
jbb2005 (GNU Classpath)
Data corruption
Data corruption
jbb2005 (GNU Classpath
)Data corruption
NoneSlide82
Exposed Erroneous Behaviors
82PM exposes most bugs that AM found.ProgramAM
PMhsqldb
Non-termination
Data corruption
hsqldb
None
Performance bug
avrora
Data corruption
Data corruption
lusearch
(GNU
Classpath
)
Performance bug
None
sunflow
Null
ptr exception
Null ptr exceptionjbb2000
Non-termination
Data corruption
jbb2000
Data corruptionData corruption
jbb2005 (GNU Classpath)
Data corruption
Data corruption
jbb2005 (GNU Classpath)
Data corruption
None
Slide83
Exposed Erroneous Behaviors
83Paper contains detailed analysis of each bug.Program
AMPM
hsqldb
Non-termination
Data corruption
hsqldb
None
Performance bug
avrora
Data corruption
Data corruption
lusearch
(GNU
Classpath
)
Performance bug
None
sunflow
Null ptr exception
Null ptr exceptionjbb2000
Non-termination
Data corruption
jbb2000
Data corruptionData corruption
jbb2005 (GNU Classpath)
Data corruption
Data corruption
jbb2005 (GNU Classpath
)Data corruption
NoneSlide84
Conclusion
First dynamic analysis to expose legal behaviors due to future values in large, real programsSuccessfully found new harmful behaviors due to future values in real programs
Reaffirms that “
benign
”
races are
harmful
Helps future
revisions
to language
specifications
by finding evidence of
controversial
behaviors in real programs
84Slide85
Backup slides
85Slide86
Data Races are Evil
86Slide87
DRF0 Memory Model
– Adve and Hill, ISCA, 199087
Racy execution
No semantics
Data-race-free execution
Strong semantics
Execution is sequentially consistent (SC)Slide88
Java Memory Model (JMM)
Based on DRF0Need to ensure memory and type safety88
Racy execution
Weak
semantics
Racy execution can still lead to surprising behaviors
Unsatisfactory, impractical to enforce
JVMs do
not
strictly conform to JMMSlide89
Relationship among memory models and exposed behaviors
89DRF0 Memory Model
Happens-Before Memory Model
Our Goal
Java Memory Model
Existing Dynamic Analyses
Typical JVMsSlide90
Relationship among memory models and exposed behaviors
90DRF0 Memory Model
Our Goal
Java Memory Model
Existing Dynamic Analyses
Typical JVMs
Out-of-thin-air results?Slide91
Example #5: Out-Of-Thin-Air Result
91r1 = x;y = r1;T1
T2
r2 = y
;
x = r2
assert r1 != 42;
int
x = y = 0;
Assertion can fail in DRF0!Slide92
Contrived Transformation
92r1 = 42;y = r1;r3 = x;if (r3 != r1) y = r3;
T1
T2
r2 = y
;
x = r2
assert r1 != 42;
int
x = y = 0;
r1 = x;
y = r1;
T1Slide93
Contrived Transformation
93r1 = 42;y = r1;r3 = x;if (r3 != r1) y = r3;
T1
T2
r2 = y
;
x = r2
assert r1 != 42;
int
x = y = 0;
r1 = x;
y = r1;
T1
Assertion can fail in DRF0!Slide94
Example #6: Out-of-thin-air results for a DRF program
94r1 = x;if (r1 == 1) y = 1;T1
T2
r2 = y
;
if (r2 == 1)
x = 1;
assert r1 == 0 && r2 == 0;
int
x = y = 0;
Cannot fail in DRF0 or JMM.Slide95
Example #7
95r1 = z;if (r1 == 1) x = 1;T1
T2
r2 =
x;
if (r2 == 1
)
y = 1;
else
z = 1;
assert r3 == 0;
int
x = y = z = 0;
T3
r3
= y;
if (
r3
== 1
)
x = 1;Slide96
Example #7
96r1 = z;if (r1 == 1) x = 1;T1
T2
r2 =
x;
if (r2 == 1
)
y = 1;
else
z = 1;
assert r3 == 0;
int
x = y = z = 0;
T3
r3
= y;
if (
r3
== 1
)
x = 1;Slide97
Example #7
97r1 = z; // r1 = 0if (r1 == 1) x = 1;
T1
T2
r2 =
x;
// r2 = 1
if (r2 == 1
)
y = 1;
else
z = 1;
assert r3 == 0;
int
x = y = z = 0;
T3
r3
= y
;
// r3 = 1
if (
r3
== 1)
x = 1; // justifies r2 = 1Slide98
Model checkers
Typical approachesExplore all behaviors allowed in the memory modelTarget routines for concurrent data structuresCould expose behaviors due to future valuesExample: CDSCheckerCoverage Limitation
Do not scale
to large, real programs
98Slide99
PM-profiler Example
991: r = x;2: y = 1;
T1
T2
int
x = y = 0;
3: while (
y
== 0) {}
4
:
x
= 1;
assert r == 0;
RH[x]
=
∅, RH[y
] = ∅
Timestamp:
K
1
Timestamp: K
2Slide100
PM-profiler Example
1001: r = x;2: y = 1;
T1
T2
int
x = y = 0;
3: while (y == 0) {}
4
:
x = 1;
assert r == 0;
RH[x] = {<K
1
, 1@T1, {0}>}
RH[x]
=
∅, RH[y
] = ∅
Timestamp:
K
1
Timestamp: K
2Slide101
PM-profiler Example
1011: r = x;2: y = 1;
T1
T2
int
x = y = 0;
3: while (y == 0) {}
4
:
x = 1;
assert r == 0;
RH[x] = {<K
1
, 1@T1, {0}>}
RH[x]
=
∅, RH[y
] = ∅
check RH[y]:
Timestamp:
K
1
Timestamp: K
2
no previous load!Slide102
PM-profiler Example
1021: r = x;2: y = 1;
T1
T2
int
x = y = 0;
3: while (
y
== 0) {}
4
:
x = 1;
RH[x]
=
∅, RH[y
] = ∅
RH[y] = {<K
2
, 3@T2, {0, 1}>}
assert r == 0;
Timestamp:
K
1
Timestamp: K
2
RH[x] = {<K
1
, 1@T1, {0}>}Slide103
PM-profiler Example
1031: r = x;2: y = 1;
T1
T2
int
x = y = 0;
3: while (y == 0) {}
4
:
x
= 1;
RH[x] = {<K
1
, 1@T1, {0}>}
RH[x]
=
∅, RH[y
] = ∅
RH[y] = {<K
2
, 3@T2, {0, 1}>}
check RH[x]:
K
1 ⋢ K
2 && 1 ∉ {0}
1 is a potential future value for load at 1@T1!
assert r == 0;
Timestamp:
K
1
Timestamp: K
2