Structure Overview & Motivation Design I mplementation - - PowerPoint PPT Presentation

structure overview motivation design i mplementation
SMART_READER_LITE
LIVE PREVIEW

Structure Overview & Motivation Design I mplementation - - PowerPoint PPT Presentation

I mplementation and Optimization of Thread-Local Variables for a Race-Free Java Dialect Yi Zhang , Clark Verbrugge McGill University Structure Overview & Motivation Design I mplementation Experiments Conclusion & Future Work


slide-1
SLIDE 1

I mplementation and Optimization of Thread-Local Variables for a Race-Free Java Dialect

Yi Zhang, Clark Verbrugge

McGill University

slide-2
SLIDE 2

Structure Overview & Motivation Design I mplementation Experiments Conclusion & Future Work

slide-3
SLIDE 3

Overview

implement and optimize thread local access a new semantic for Java race-free version of Java

slide-4
SLIDE 4

Motivation

Complexity in racy program hard to validate the optimization many optimizations are prohibited data-race free property

slide-5
SLIDE 5

Motivation

data are thread local by default and use shared directives for shared data ThreadLocal class in Java API thread-local access

slide-6
SLIDE 6

Design

ThreadLocal

  • bjects as wrapper

Original Design

ThreadLocal objects as wrapper access data: get(), set()

slide-7
SLIDE 7

Design

Original Design each thread holds a ThreadLocalMap First, get map from thread Second, < ThreadLocal as key, value>

slide-8
SLIDE 8

Design

Our Design thread-local the default option use “volatile” to specify the shared data

slide-9
SLIDE 9

Design

Our Design

thread-local the default option

slide-10
SLIDE 10

Design

Our Design

use “volatile” to specify the shared data accesses of data

slide-11
SLIDE 11

Design

Original New

semantic thread-local is not inherent need support from ThreadLocal class thread-local is inherent with in semantics data access map searching

static: table look-up based

approach

non-static: normal access

without overhead initial value

fixed initial value manually and statically inherent initial value from

parents

automatically and at run-time

slide-12
SLIDE 12

Implementation

Thread Local Accesses

at the start of thread, make local copy all reachable reference objects if that field is not volatile Class.staticField this.field shared with all threads shared with parent threads we do this through deep-copying

slide-13
SLIDE 13
slide-14
SLIDE 14

static fields

slide-15
SLIDE 15
  • bjects reachable

from static fields

slide-16
SLIDE 16
  • bjects reachable

from parent thread

slide-17
SLIDE 17

Implementation

slide-18
SLIDE 18

Implementation

static fields

slide-19
SLIDE 19

Implementation

  • bjects reachable

from static fields

slide-20
SLIDE 20

Implementation

  • bjects reachable

from non-static fields

slide-21
SLIDE 21

Implementation

slide-22
SLIDE 22

Implementation

slide-23
SLIDE 23

Implementation

slide-24
SLIDE 24

Implementation

slide-25
SLIDE 25

Implementation

slide-26
SLIDE 26

Implementation

slide-27
SLIDE 27

Implementation

table look-up based mechanism to speed up

Object Object copy for thread 1

A.localItem A.localItem

Object copy for thread 2

A.sharedItem global table local table local table

slide-28
SLIDE 28

Experiments

Implementation Environment: JikesRVM 3.1.1 Micro Benchmarks: Reads and writes operations on thread-local static field

slide-29
SLIDE 29

Experiments

Micro Benchmarks

slide-30
SLIDE 30

Experiments

Micro Benchmarks

slide-31
SLIDE 31

Experiments

gc time of new design increases faster !! We need special garbage collector adapted to our dialect

Micro Benchmarks

slide-32
SLIDE 32

Experiments

Micro Benchmarks

slide-33
SLIDE 33

Experiments

Non-trivial Benchmarks:

Sable Research Group: Sun Java Tutorial: Doug Lea: Java Grande Forum Benchmark Suite: SPECJVM98:

series Producer/ Consumer (P/ C) traffic, roller coaster bank mtrt

slide-34
SLIDE 34

Experiments

Non-trivial Benchmarks

most benchmarks shows comparable performance traffic benchmarks runs considerably slower 289 threads-> too many

slide-35
SLIDE 35

Conclusion & Future Work

Conclusion Data-Race-Free thread-local data VS shared data thread-local and Java Virtual Machine

slide-36
SLIDE 36

Conclusion & Future Work

Future Work Full data-race-free language design Improve performance of current design reduce the copying overhead reduce gc time

slide-37
SLIDE 37

Thank You!