Composable Specifications for Structured Shared-Memory Communication - - PowerPoint PPT Presentation

composable specifications for structured shared memory
SMART_READER_LITE
LIVE PREVIEW

Composable Specifications for Structured Shared-Memory Communication - - PowerPoint PPT Presentation

Composable Specifications for Structured Shared-Memory Communication Benjamin P . Wood , Adrian Sampson, Luis Ceze, Dan Grossman University of Washington 1 Code-Communication Specifications Writer Thread Reader Thread enqueue(...);


slide-1
SLIDE 1

Composable Specifications for Structured Shared-Memory Communication

Benjamin P . Wood, Adrian Sampson, Luis Ceze, Dan Grossman University of Washington

1
slide-2
SLIDE 2

Writer Thread Reader Thread

enqueue(...); dequeue();

Code-Communication Specifications

2
slide-3
SLIDE 3

Writer Thread Reader Thread

enqueue(...); dequeue();

May writes in enqueue be read by other threads in dequeue?

Code-Communication Specifications

2
slide-4
SLIDE 4

Writer Thread Reader Thread

enqueue(...); dequeue();

May writes in enqueue be read by other threads in dequeue?

What code may communicate across threads? Code-Communication Specifications

2
slide-5
SLIDE 5

Writer Thread Reader Thread

enqueue(...); dequeue();

May writes in enqueue be read by other threads in dequeue?

What code may communicate across threads? ✔

enqueue dequeue

Code-Communication Specifications

2
slide-6
SLIDE 6

Writer Thread Reader Thread

enqueue(...); dequeue();

May writes in enqueue be read by other threads in dequeue?

What code may communicate across threads? ✔

enqueue dequeue enqueue render

✘ Code-Communication Specifications

2
slide-7
SLIDE 7

Implicitly Shared Memory

3

this.buffer[...] = i; this.size = this.size + 1;

slide-8
SLIDE 8

Implicitly Shared Memory

3

this.buffer[...] = i; this.size = this.size + 1;

What is shared? What is not?

slide-9
SLIDE 9

Implicitly Shared Memory

3

this.buffer[...] = i; this.size = this.size + 1;

Thread-private?

What is shared? What is not?

slide-10
SLIDE 10

Implicitly Shared Memory

3

this.buffer[...] = i; this.size = this.size + 1;

Thread-private? Read-only?

What is shared? What is not?

slide-11
SLIDE 11

Implicitly Shared Memory

3

this.buffer[...] = i; this.size = this.size + 1;

Guarded by lock? Thread-private? Read-only?

What is shared? What is not?

slide-12
SLIDE 12

Implicitly Shared Memory

3

this.buffer[...] = i; this.size = this.size + 1;

Guarded by lock? Thread-private? Race-free? Read-only?

What is shared? What is not?

slide-13
SLIDE 13

Implicitly Shared Memory

3

Atomic?

this.buffer[...] = i; this.size = this.size + 1;

Guarded by lock? Thread-private? Race-free? Read-only?

What is shared? What is not?

slide-14
SLIDE 14

Implicitly Shared Memory

3

Atomic?

this.buffer[...] = i; this.size = this.size + 1;

Guarded by lock? Thread-private? Race-free? Read-only? These are properties of data or isolation.

What is shared? What is not?

slide-15
SLIDE 15

Data- and Isolation-Centric Analyses

Race detection e.g. FastTrack [PLDI’09], Goldilocks [PLDI’07], Effective Static Race Detection [PLDI’06] Sharing specifications e.g. SharC [PLDI’08], Shoal [PLDI’09], Ownership Policies [POPL’10] Atomicity violation detection e.g. Velodrome [PLDI’08], A Type and Effect System for Atomicity [PLDI’03]

4
slide-16
SLIDE 16

Data- and Isolation-Centric Analyses

Race detection e.g. FastTrack [PLDI’09], Goldilocks [PLDI’07], Effective Static Race Detection [PLDI’06] Sharing specifications e.g. SharC [PLDI’08], Shoal [PLDI’09], Ownership Policies [POPL’10] Atomicity violation detection e.g. Velodrome [PLDI’08], A Type and Effect System for Atomicity [PLDI’03]

4

Are all accesses to location x well-synchronized?

slide-17
SLIDE 17

Data- and Isolation-Centric Analyses

Race detection e.g. FastTrack [PLDI’09], Goldilocks [PLDI’07], Effective Static Race Detection [PLDI’06] Sharing specifications e.g. SharC [PLDI’08], Shoal [PLDI’09], Ownership Policies [POPL’10] Atomicity violation detection e.g. Velodrome [PLDI’08], A Type and Effect System for Atomicity [PLDI’03]

4

Are all accesses to location x well-synchronized? Which locations may be shared?

slide-18
SLIDE 18

Data- and Isolation-Centric Analyses

Race detection e.g. FastTrack [PLDI’09], Goldilocks [PLDI’07], Effective Static Race Detection [PLDI’06] Sharing specifications e.g. SharC [PLDI’08], Shoal [PLDI’09], Ownership Policies [POPL’10] Atomicity violation detection e.g. Velodrome [PLDI’08], A Type and Effect System for Atomicity [PLDI’03]

4

Are all accesses to location x well-synchronized? Which locations may be shared? Are accesses in this code section isolated?

slide-19
SLIDE 19

Shared- Memory Bugs

5

What Shared-Memory Bugs Can We Catch?

slide-20
SLIDE 20

Shared- Memory Bugs

5

Data-centric: illegal sharing data races Isolation-centric: atomicity violations

What Shared-Memory Bugs Can We Catch?

slide-21
SLIDE 21

Shared- Memory Bugs

5

Data-centric: illegal sharing data races Isolation-centric: atomicity violations

What Shared-Memory Bugs Can We Catch?

Code-centric: illegal communication

slide-22
SLIDE 22

Outline

A Code-Centric View of Shared-Memory Code-Communication Specification Language

  • Making Specifications Modular and Concise
  • Specification Language Evaluation

Dynamic Specification Checker

  • Making Communication Checking Fast Enough
  • Performance Evaluation
6
slide-23
SLIDE 23

Specification Constructs

7
slide-24
SLIDE 24

Specification Constructs

7

Module A set of related methods (often aligned with data abstractions)

slide-25
SLIDE 25

Specification Constructs

7

Module A set of related methods (often aligned with data abstractions) Module Specification Which pairs of methods may communicate

slide-26
SLIDE 26

Specification Constructs

7

Module A set of related methods (often aligned with data abstractions) Module Specification Which pairs of methods may communicate Module Interface Which communication is encapsulated

  • r visible to callers outside the module
slide-27
SLIDE 27

Specification Constructs

7

Module A set of related methods (often aligned with data abstractions) Module Specification Which pairs of methods may communicate Module Interface Which communication is encapsulated

  • r visible to callers outside the module

Inlining Assigns communication to the caller

slide-28
SLIDE 28

Inter-Thread Communication

8

buffer[3] = ...;

Writer Thread

slide-29
SLIDE 29

communication Inter-Thread Communication

8

buffer[3] = ...; return buffer[3];

Writer Thread Reader Thread

slide-30
SLIDE 30

communication Inter-Thread Communication

8

buffer[3] = ...; return buffer[3];

Writer Thread Reader Thread in enqueue(...): in dequeue(...):

slide-31
SLIDE 31

communication Inter-Thread Communication

8

buffer[3] = ...; return buffer[3];

Writer Thread Reader Thread in enqueue(...): in dequeue(...):

Code communication is directed.

slide-32
SLIDE 32

communication Inter-Thread Communication

8

buffer[3] = ...; return buffer[3];

Writer Thread Reader Thread in enqueue(...): in dequeue(...): in produce(...): in consume(...):

slide-33
SLIDE 33

communication Inter-Thread Communication

8

Code communication is layered.

buffer[3] = ...; return buffer[3];

Writer Thread Reader Thread in enqueue(...): in dequeue(...): in produce(...): in consume(...):

slide-34
SLIDE 34

package buffer; public class BoundedBuffer { Item[] buffer = new Item[10]; int size = 0;

  • public synchronized void enqueue(Item i) {

while (size == buffer.length) wait(); buffer[...] = i; size++; ... notifyAll(); } public synchronized Item dequeue() { while (size == 0) wait(); size--; ... notifyAll(); return buffer[...]; } }

Communication Modules

package pipeline; import buffer.BoundedBuffer; class Pipeline { BoundedBuffer pipe; // Producer threads void produce() { ... pipe.enqueue(...); ... } // Consumer threads void consume() { ... = pipe.dequeue(); ... } }

9
slide-35
SLIDE 35

package buffer; public class BoundedBuffer { Item[] buffer = new Item[10]; int size = 0;

  • public synchronized void enqueue(Item i) {

while (size == buffer.length) wait(); buffer[...] = i; size++; ... notifyAll(); } public synchronized Item dequeue() { while (size == 0) wait(); size--; ... notifyAll(); return buffer[...]; } }

Communication Modules

package pipeline; import buffer.BoundedBuffer; class Pipeline { BoundedBuffer pipe; // Producer threads void produce() { ... pipe.enqueue(...); ... } // Consumer threads void consume() { ... = pipe.dequeue(); ... } }

9

Module Specification

slide-36
SLIDE 36

package buffer; public class BoundedBuffer { Item[] buffer = new Item[10]; int size = 0;

  • public synchronized void enqueue(Item i) {

while (size == buffer.length) wait(); buffer[...] = i; size++; ... notifyAll(); } public synchronized Item dequeue() { while (size == 0) wait(); size--; ... notifyAll(); return buffer[...]; } }

Communication Modules

package pipeline; import buffer.BoundedBuffer; class Pipeline { BoundedBuffer pipe; // Producer threads void produce() { ... pipe.enqueue(...); ... } // Consumer threads void consume() { ... = pipe.dequeue(); ... } }

9

Module Specification

slide-37
SLIDE 37

package buffer; public class BoundedBuffer { Item[] buffer = new Item[10]; int size = 0;

  • public synchronized void enqueue(Item i) {

while (size == buffer.length) wait(); buffer[...] = i; size++; ... notifyAll(); } public synchronized Item dequeue() { while (size == 0) wait(); size--; ... notifyAll(); return buffer[...]; } }

Communication Modules

package pipeline; import buffer.BoundedBuffer; class Pipeline { BoundedBuffer pipe; // Producer threads void produce() { ... pipe.enqueue(...); ... } // Consumer threads void consume() { ... = pipe.dequeue(); ... } }

9

Module Specification

slide-38
SLIDE 38

package buffer; public class BoundedBuffer { Item[] buffer = new Item[10]; int size = 0;

  • public synchronized void enqueue(Item i) {

while (size == buffer.length) wait(); buffer[...] = i; size++; ... notifyAll(); } public synchronized Item dequeue() { while (size == 0) wait(); size--; ... notifyAll(); return buffer[...]; } }

Communication Modules

package pipeline; import buffer.BoundedBuffer; class Pipeline { BoundedBuffer pipe; // Producer threads void produce() { ... pipe.enqueue(...); ... } // Consumer threads void consume() { ... = pipe.dequeue(); ... } }

9

Module Specification

slide-39
SLIDE 39

package buffer; public class BoundedBuffer { Item[] buffer = new Item[10]; int size = 0;

  • public synchronized void enqueue(Item i) {

while (size == buffer.length) wait(); buffer[...] = i; size++; ... notifyAll(); } public synchronized Item dequeue() { while (size == 0) wait(); size--; ... notifyAll(); return buffer[...]; } }

Communication Modules

package pipeline; import buffer.BoundedBuffer; class Pipeline { BoundedBuffer pipe; // Producer threads void produce() { ... pipe.enqueue(...); ... } // Consumer threads void consume() { ... = pipe.dequeue(); ... } }

9

Module Specification

slide-40
SLIDE 40

Checking Communication Specifications

10

buffer[3] = ...;

Writer Thread Reader Thread

return buffer[3];

in enqueue(...): in dequeue(...): in produce(...): in consume(...):

slide-41
SLIDE 41

Checking Communication Specifications

10

buffer[3] = ...;

Writer Thread Reader Thread

return buffer[3];

in enqueue(...): in dequeue(...): in produce(...): in consume(...):

slide-42
SLIDE 42

Checking Communication Specifications

11

Writer Thread Reader Thread in enqueue(...): in dequeue(...): in produce(...): in consume(...):

buffer[3] = ...; return buffer[3];

slide-43
SLIDE 43

Checking Communication Specifications

11

Writer Thread Reader Thread in enqueue(...): in dequeue(...): in produce(...): in consume(...): ✔

buffer[3] = ...; return buffer[3];

slide-44
SLIDE 44

Checking Communication Specifications

11

Writer Thread Reader Thread in enqueue(...): in dequeue(...): in produce(...): in consume(...): ✔ ✔

buffer[3] = ...; return buffer[3];

slide-45
SLIDE 45

Checking Communication Specifications

11

Writer Thread Reader Thread in enqueue(...): in dequeue(...): in produce(...): in consume(...): ✔ ✔

buffer[3] = ...; return buffer[3];

slide-46
SLIDE 46

Communication Module Interfaces

12

in dequeue(...): in enqueue(...): in consume(...): in produce(...): Writer Thread Reader Thread

size--; ... = size;

slide-47
SLIDE 47

✔ Communication Module Interfaces

12

in dequeue(...): in enqueue(...): in consume(...): in produce(...): Writer Thread Reader Thread

size--; ... = size;

slide-48
SLIDE 48

✘ ✔ Communication Module Interfaces

12

in dequeue(...): in enqueue(...): in consume(...): in produce(...): Writer Thread Reader Thread

size--; ... = size;

slide-49
SLIDE 49

package buffer; public class BoundedBuffer { Item[] buffer = new Item[10]; int size = 0;

  • public synchronized void enqueue(Item i) {

while (size == buffer.length) wait(); buffer[...] = i; size++; ... notifyAll(); } public synchronized Item dequeue() { while (size == 0) wait(); size--; ... notifyAll(); return buffer[...]; } }

Communication Module Interfaces

package pipeline; import buffer.BoundedBuffer; class Pipeline { BoundedBuffer pipe; // Producer threads void produce() { ...; pipe.enqueue(...); ... } // Consumer threads void consume() { ... = pipe.dequeue(); ... } }

13

Module Specification

slide-50
SLIDE 50

package buffer; public class BoundedBuffer { Item[] buffer = new Item[10]; int size = 0;

  • public synchronized void enqueue(Item i) {

while (size == buffer.length) wait(); buffer[...] = i; size++; ... notifyAll(); } public synchronized Item dequeue() { while (size == 0) wait(); size--; ... notifyAll(); return buffer[...]; } }

Communication Module Interfaces

package pipeline; import buffer.BoundedBuffer; class Pipeline { BoundedBuffer pipe; // Producer threads void produce() { ...; pipe.enqueue(...); ... } // Consumer threads void consume() { ... = pipe.dequeue(); ... } }

13

Module Interface Module Specification

slide-51
SLIDE 51

✘ ✔ Communication Module Interfaces

14

in dequeue(...): in enqueue(...): in consume(...): in produce(...): Writer Thread Reader Thread

size--; ... = size;

slide-52
SLIDE 52

✔ Communication Module Interfaces

14

in dequeue(...): in enqueue(...): in consume(...): in produce(...): Writer Thread Reader Thread

size--; ... = size;

slide-53
SLIDE 53

✔ Communication Module Interfaces

15

in dequeue(...): in enqueue(...): in consume(...): in produce(...): Writer Thread Reader Thread

size--; ... = size;

slide-54
SLIDE 54

✔ Communication Module Interfaces

15

in dequeue(...): in enqueue(...): in consume(...): in produce(...): encapsulated Writer Thread Reader Thread

size--; ... = size;

slide-55
SLIDE 55

in arrayCopy(...): in dequeue(...): Communication Inlining

16

Writer Thread Reader Thread in enqueue(...):

buffer[3] = ...; return buffer[3];

slide-56
SLIDE 56

in arrayCopy(...): in dequeue(...): Communication Inlining

16

Writer Thread Reader Thread in enqueue(...):

arrayCopy communicates only for its caller.

buffer[3] = ...; return buffer[3];

slide-57
SLIDE 57

in arrayCopy(...): in dequeue(...): Communication Inlining

16

Writer Thread Reader Thread

@Inline arrayCopy(...):

in enqueue(...):

arrayCopy communicates only for its caller.

buffer[3] = ...; return buffer[3];

slide-58
SLIDE 58

in enqueue(...): in dequeue(...): Communication Inlining

17

Writer Thread Reader Thread

arrayCopy communicates only for its caller.

buffer[3] = ...; return buffer[3];

slide-59
SLIDE 59

in enqueue(...): in dequeue(...): Communication Inlining

17

Writer Thread Reader Thread ✔

arrayCopy communicates only for its caller.

buffer[3] = ...; return buffer[3];

slide-60
SLIDE 60

Specification Constructs

18
slide-61
SLIDE 61

Specification Constructs

18

Module A set of related methods (often aligned with data abstractions)

slide-62
SLIDE 62

Specification Constructs

18

Module A set of related methods (often aligned with data abstractions) Module Specification Which pairs of methods may communicate

slide-63
SLIDE 63

Specification Constructs

18

Module A set of related methods (often aligned with data abstractions) Module Specification Which pairs of methods may communicate Module Interface Which communication is encapsulated

  • r visible to callers outside the module
slide-64
SLIDE 64

Specification Constructs

18

Module A set of related methods (often aligned with data abstractions) Module Specification Which pairs of methods may communicate Module Interface Which communication is encapsulated

  • r visible to callers outside the module

Inlining Assigns communication to the caller

slide-65
SLIDE 65

Evaluation: Specification Size

19

DaCapo Java Grande

slide-66
SLIDE 66

Evaluation: Specification Size

19

Benchmark LOC Annotations Avrora 70,000 Batik 190,000 Xalan 180,000 Crypt 300 LUFact 500 MolDyn 500 MonteCarlo 1,200 RayTracer 700 Series 200 SOR 200 Sparsematmult 200 DaCapo Java Grande

slide-67
SLIDE 67

Evaluation: Specification Size

19

Benchmark LOC Total Annotations

  • Ann. /

KLOC Methods Avrora 70,000 175 2.5 Batik 190,000 16 0.01 Xalan 180,000 90 0.5 Crypt 300 16 53 LUFact 500 15 30 MolDyn 500 39 78 MonteCarlo 1,200 19 16 RayTracer 700 37 53 Series 200 10 50 SOR 200 14 70 Sparsematmult 200 9 45 DaCapo Java Grande

slide-68
SLIDE 68

Evaluation: Specification Size

19

Benchmark LOC Total Annotations

  • Ann. /

KLOC Methods Methods Annotated % Methods Annotated Avrora 70,000 175 2.5 9,775 85 0.9% Batik 190,000 16 0.01 15,547 8 0.05% Xalan 180,000 90 0.5 7,854 42 0.5% Crypt 300 16 53 17 5 29% LUFact 500 15 30 29 6 21% MolDyn 500 39 78 27 16 59% MonteCarlo 1,200 19 16 172 11 6% RayTracer 700 37 53 77 15 19% Series 200 10 50 15 6 40% SOR 200 14 70 13 5 38% Sparsematmult 200 9 45 12 4 33% DaCapo Java Grande

slide-69
SLIDE 69

Specification Expressiveness

20
slide-70
SLIDE 70

Specification Expressiveness

Strengths: ✓Concise and intuitive ✓Encapsulation useful in many benchmarks ✓Sensitive to error

20
slide-71
SLIDE 71

Specification Expressiveness

Strengths: ✓Concise and intuitive ✓Encapsulation useful in many benchmarks ✓Sensitive to error Limitations / Future Work:

  • Improve support for non-layered communication
  • Integrate data-centric properties to reduce specification size
20
slide-72
SLIDE 72

Specification Expressiveness

Strengths: ✓Concise and intuitive ✓Encapsulation useful in many benchmarks ✓Sensitive to error Limitations / Future Work:

  • Improve support for non-layered communication
  • Integrate data-centric properties to reduce specification size

Also in the Paper:

  • Java annotation syntax
  • Formal semantics
20
slide-73
SLIDE 73

Outline

A Code-Centric View of Shared-Memory Code-Communication Specification Language

  • Making Specifications Modular and Concise
  • Specification Language Evaluation

Dynamic Specification Checker

  • Making Communication Checking Fast Enough
  • Performance Evaluation
21
slide-74
SLIDE 74

Fundamental Instrumentation Costs

22

class C { int x; State x__lastWriter;

slide-75
SLIDE 75

Fundamental Instrumentation Costs

22

write Store current thread and call stack as last writer. class C { int x; State x__lastWriter;

slide-76
SLIDE 76

Fundamental Instrumentation Costs

22

write Store current thread and call stack as last writer. read Check if communication is allowed from last writer to current reader. class C { int x; State x__lastWriter;

slide-77
SLIDE 77

Optimizing Read Checks

23

Full check passes? ✔ >30 Else illegal. ✘

Throw exception.

Check Action Mem. Ops. Same thread? ✔ 1

slide-78
SLIDE 78

Optimizing Read Checks

23

Full check passes? ✔ >30 Else illegal. ✘

Throw exception.

Check Action Mem. Ops. Same thread? ✔ 1

slide-79
SLIDE 79

Optimizing Read Checks

24

Full check passes? ✔

Add pair to global memo table.

>30 Else illegal. ✘

Throw exception.

Check Action Mem. Ops. Same thread? ✔ 1

slide-80
SLIDE 80

Full check passes? ✔

Add pair to global memo table.

>30 Else illegal. ✘

Throw exception.

Stack pair in global memo table? ✔ 12

Optimizing Read Checks

25

Check Action Mem. Ops. Same thread? ✔ 1

slide-81
SLIDE 81

Optimizing Read Checks

26

Full check passes? ✔

Add pair to global memo table.

>30 Else illegal. ✘

Throw exception.

Stack pair in global memo table? ✔

Add writer stack ID to reader stack’s cache.

12 Check Action Mem. Ops. Same thread? ✔ 1

slide-82
SLIDE 82

Optimizing Read Checks

27

Full check passes? ✔

Add pair to global memo table.

>30 Else illegal. ✘

Throw exception.

Writer stack ID in reader stack’s cache? ✔ 4 Stack pair in global memo table? ✔

Add writer stack ID to reader stack’s cache.

12 Check Action Mem. Ops. Same thread? ✔ 1

slide-83
SLIDE 83

Optimizing Read Checks

28

Check Action Mem. Ops. Same thread? ✔ 1 Full check passes? ✔

Add pair to global memo table.

>30 Else illegal. ✘

Throw exception.

Writer stack ID in reader stack’s cache? ✔ 4 Stack pair in global memo table? ✔

Add writer stack ID to reader stack’s cache.

12

slide-84
SLIDE 84

Experimental Configuration

29

Benchmarks 8 Java Grande, large inputs, 8 threads 3 DaCapo 9.12, default inputs, 8 threads Machine 8-core 2.8GHz Intel Xeon, 10GB RAM Ubuntu 8.10 JVM HotSpot 64-bit client VM 1.6.0 max heap size 8GB Data Average over 10 runs separate performance and profiling

slide-85
SLIDE 85 30

Execution Profile

slide-86
SLIDE 86 30

Execution Profile > 99.99999% of reads checked on fast paths

slide-87
SLIDE 87 30

Execution Profile up to 6 billion communicating reads > 99.99999% of reads checked on fast paths

slide-88
SLIDE 88 30

Execution Profile up to 6 billion communicating reads > 99.99999% of reads checked on fast paths ≤ 697 full stack checks

slide-89
SLIDE 89 31

Communicating Read Operations

0% 20% 40% 60% 80% 100% Avrora Batik Xalan Crypt LUFact MolDyn MonteCarlo RayTracer Series SOR SparseMatmult

% of reads that communicate

slide-90
SLIDE 90 31

Communicating Read Operations

0% 20% 40% 60% 80% 100% Avrora Batik Xalan Crypt LUFact MolDyn MonteCarlo RayTracer Series SOR SparseMatmult

% of reads that communicate

slide-91
SLIDE 91

0x 5x 10x 15x 20x 25x 30x Avrora Batik Xalan Crypt LUFact MolDyn MonteCarlo RayTracer Series SOR SparseMatmult

Running time vs. uninstrumented

Time Overhead

32
slide-92
SLIDE 92

0x 5x 10x 15x 20x 25x 30x Avrora Batik Xalan Crypt LUFact MolDyn MonteCarlo RayTracer Series SOR SparseMatmult

Running time vs. uninstrumented

Time Overhead

32
slide-93
SLIDE 93

Space Overhead

33

34.3x

0x 1x 2x 4x 5x 6x 7x 8x 10x 11x 12x Avrora Batik Xalan Crypt LUFact MolDyn MonteCarlo RayTracer Series SOR SparseMatmult

Peak memory vs. uninstrumented

slide-94
SLIDE 94

Space Overhead

33

34.3x

0x 1x 2x 4x 5x 6x 7x 8x 10x 11x 12x Avrora Batik Xalan Crypt LUFact MolDyn MonteCarlo RayTracer Series SOR SparseMatmult

Peak memory vs. uninstrumented

slide-95
SLIDE 95

Space Overhead

33

34.3x

0x 1x 2x 4x 5x 6x 7x 8x 10x 11x 12x Avrora Batik Xalan Crypt LUFact MolDyn MonteCarlo RayTracer Series SOR SparseMatmult

Peak memory vs. uninstrumented 0.5x

slide-96
SLIDE 96

Summary

  • 1. A Code-Centric View of Shared-Memory
  • 2. Code-Communication Specification Language
  • Concise and modular specifications
  • Fit communication patterns in real programs
  • 3. Dynamic Specification Checker
  • Aggressive optimization of communication checks
  • Debugging-level performance
34
slide-97
SLIDE 97

Summary

  • 1. A Code-Centric View of Shared-Memory
  • 2. Code-Communication Specification Language
  • Concise and modular specifications
  • Fit communication patterns in real programs
  • 3. Dynamic Specification Checker
  • Aggressive optimization of communication checks
  • Debugging-level performance
34

Download: www.cs.washington.edu/homes/bpw/

slide-98
SLIDE 98

This slide intentionally not left blank

35
slide-99
SLIDE 99

Thread 1 Thread 2 Thread 3

work() { work() { ... consume() {

  • sync (map) {
  • if (line == 768)
  • }
  • sync (map) {
  • line = line + 2;
  • map.put(line, x);
  • }
  • sync(map) {
  • line = 0;
  • map.put(line, x);
  • } ...

Communication Specifications, Race Detection, Sharing Specs, Atomicity Checker

36

✘ ✔

int line; Map map;

  • sync(map) {
  • line = line + 2;
  • map.put(line, x);
  • }

} // end work()

slide-100
SLIDE 100

Thread 1 Thread 2 Thread 3

work() { work() { ... consume() {

  • sync (map) {
  • if (line == 768)
  • }
  • sync (map) {
  • line = line + 2;
  • map.put(line, x);
  • }
  • sync(map) {
  • line = 0;
  • map.put(line, x);
  • } ...

Communication Specifications, Race Detection, Sharing Specs, Atomicity Checker

36

✘ ✔

int line; Map map;

  • sync(map) {
  • line = line + 2;
  • map.put(line, x);
  • }

} // end work()

work() work()

✘ ✔

work() consume()

slide-101
SLIDE 101

Thread 1 Thread 2 Thread 3

work() { work() { ... consume() {

  • sync (map) {
  • if (line == 768)
  • }
  • sync (map) {
  • line = line + 2;
  • map.put(line, x);
  • }
  • sync(map) {
  • line = 0;
  • map.put(line, x);
  • } ...

Communication Specifications, Race Detection, Sharing Specs, Atomicity Checker

36

✘ ✔

int line; Map map;

  • sync(map) {
  • line = line + 2;
  • map.put(line, x);
  • }

} // end work()

slide-102
SLIDE 102

Thread 1 Thread 2 Thread 3

work() { work() { ... consume() {

  • sync (map) {
  • if (line == 768)
  • }
  • sync (map) {
  • line = line + 2;
  • map.put(line, x);
  • }
  • sync(map) {
  • line = 0;
  • map.put(line, x);
  • } ...

Communication Specifications, Race Detection, Sharing Specs, Atomicity Checker

36

✘ ✔

int line; Map map;

  • sync(map) {
  • line = line + 2;
  • map.put(line, x);
  • }

} // end work()

✘ ✘

line: lock was insufficient should not be thread-local or read-only

slide-103
SLIDE 103

Thread 1 Thread 2 Thread 3

work() { work() { ... consume() {

  • sync (map) {
  • if (line == 768)
  • }
  • sync(map) {
  • line = 0;
  • map.put(0, x);
  • } ...

Communication Specifications, Race Detection, Sharing Specs, Atomicity Checker

37

int line; Map map;

} // end work()

  • sync(map) {
  • line = line + 2;
  • map.put(766, x);
  • }
  • sync (map) {
  • line = line + 2;
  • map.put(1, x);
  • }

Correct version is not intended to be atomic.

✘ ✘ ✘

slide-104
SLIDE 104

This slide intentionally not left blank

38
slide-105
SLIDE 105

Callbacks

39

buffer[3] = ...;

Writer Thread Reader Thread

return buffer[3];

in Action.create(...): in Action.fire(...): in Simulator.run(...): in Simulator.run(...): in EventList.fireAll(...): ✔

slide-106
SLIDE 106

Callbacks

39

buffer[3] = ...;

Writer Thread Reader Thread

return buffer[3];

in Action.create(...): in Action.fire(...): in Simulator.run(...): in Simulator.run(...): in EventList.fireAll(...): ✔

slide-107
SLIDE 107

This slide intentionally not left blank

40