SlideShare une entreprise Scribd logo
1  sur  47
On-the-Fly Garbage Collection Using Sliding Views Erez Petrank Technion – Israel Institute of Technology Joint work with Yossi Levanoni, Hezi Azatchi,  and Harel Paz
Garbage Collection  ,[object Object],[object Object],[object Object],[object Object]
Garbage Collection  Two Classic Approaches Reference counting  [Collins 1960]: keep a reference count for each object, reclaim objects with count 0. Tracing  [McCarthy 1960]: trace reachable objects, reclaim objects not traced.  Traditional  Wisdom Good Problematic
What (was) Bad about RC ? ,[object Object],[object Object],[object Object],A B
What’s Good about RC ? ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Garbage Collection Today ,[object Object],[object Object],Dealing with multiprocessors Single-threaded stop the world
Garbage Collection Today ,[object Object],[object Object],Dealing with multiprocessors Concurrent collection Parallel collection
Terminology (stop the world, parallel, concurrent, …) Stop-the-World Parallel (STW) Concurrent  On-the-Fly program GC
Benefits & Costs Informal Pause times 200ms 2ms 20ms Throughput Loss: 10-20% Stop-the-World Parallel (STW) Concurrent  On-the-Fly program GC
This Talk ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Basic Reference Counting ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],o 1 o 2 p
An Important Term: ,[object Object],[object Object],o 1 o 2 p
Deferred Reference Counting  ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Multithreaded RC? ,[object Object]
Multithreaded RC? ,[object Object],[object Object]
Multithreaded RC? ,[object Object],A B D C Thread 2:  Read A.next;  (see B) A.next    D; B.rc- -;  D.rc++ Thread 1:  Read A.next;  (see B) A.next    C; B.rc- -;  C.rc++ ,[object Object]
Known Multithreaded RC ,[object Object],[object Object],[object Object]
To Summarize Problems… ,[object Object],[object Object],[object Object],[object Object]
Reducing RC Overhead: ,[object Object],[object Object],Parent Child
An Observation ,[object Object],[object Object],[object Object],[object Object],[object Object],p O 1 O 2 O 3 O n . . . . . O 4 O 0
Use of Observation ,[object Object],[object Object],[object Object],Time Only the first modification of each pointer is logged.  Garbage Collection P    O 1 ;  (record p’s previous value O 0 ) P    O 2 ;  (do nothing) … P    O n ;  (do nothing)
Some Technical Remarks ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Effects of Optimization ,[object Object],[object Object]
Elimination of RC Updates Mpegaudio 5,517,795 51 1/108192 Jess 26,258,107 27,333 1/961 Javac 22,042,028 535,296 1/41 Jack 135,174,775 1,546 1/87435 Db 33,124,780 30,696 1/1079 Compress 64,905 51 1/1273 jbb 71,011,357 264,115 1/269 Benchmark No of stores No of “first” stores Ratio of “first” stores
Effects of Optimization ,[object Object],[object Object],[object Object],[object Object],[object Object]
Reducing Synch. Overhead ,[object Object],[object Object]
The write barrier Update(Object **slot, Object *new){ Object *old = *slot if (!IsDirty(slot)) { log( slot, old ) SetDirty(slot) } *slot = new } ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Running Write Barrier Concurrently Thread 1:  Update(Object **slot, Object *new){ Object *old = *slot if (!IsDirty(slot)) { /*  if we got here, Thread 2 has  */ /*  yet set the dirty bit, thus, has */ /*  not yet modified the slot.  */ log( slot, old ) SetDirty(slot) } *slot = new } Thread 2: Update(Object **slot, Object *new){ Object *old = *slot if (!IsDirty(slot)) { /*  if we got here, Thread 1 has  */ /*  yet set the dirty bit, thus, has */ /*  not yet modified the slot.  */ log( slot, old ) SetDirty(slot) } *slot = new }
Concurrent Algorithm: ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Timeline Stop  threads. Scan roots; Get buffers; erase dirty  bits; Resume threads. Decrement values in read buffers; Increment “current” values;  Collect dead objects
Timeline Stop  threads. Scan roots; Get buffers; erase dirty  bits; Resume threads. Decrement values in read buffers; Increment “current” values;  Collect dead objects  Unmodified current values are  in the heap.  Modified are in new  buffers.
Concurrent Algorithm: ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Goal 2: stop one thread at a time Goal 1: clear dirty bits during program run.
The Sliding Views “Framework”   ,[object Object],[object Object],[object Object],[object Object],[object Object]
Graphically A Snapshot A Sliding View time time Heap Addr. Heap Addr. t t1 t2
Fixing Correctness  ,[object Object],[object Object],[object Object],[object Object]
Cycles Collection ,[object Object],[object Object]
Performance Measurements ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Pause Times vs. STW
Pause Times vs. Jikes Concurrent
SPECjbb2000 Throughput
SPECjvm98 Throughput
SPECjbb2000 Throughput
A Glimpse into Subsequent Work: SPECjbb2000 Throughput
Subsequent Work ,[object Object],[object Object],[object Object],[object Object]
Related Work ,[object Object],[object Object],[object Object]
Conclusions ,[object Object],[object Object],[object Object],[object Object]
Project Building Blocks ,[object Object],[object Object],[object Object],[object Object],[object Object]

Contenu connexe

Tendances

Functional Reactive Programming by Gerold Meisinger
Functional Reactive Programming by Gerold MeisingerFunctional Reactive Programming by Gerold Meisinger
Functional Reactive Programming by Gerold Meisinger
GeroldMeisinger
 
Return-Oriented Programming: Exploits Without Code Injection
Return-Oriented Programming: Exploits Without Code InjectionReturn-Oriented Programming: Exploits Without Code Injection
Return-Oriented Programming: Exploits Without Code Injection
guest9f4856
 
Spark summit2014 techtalk - testing spark
Spark summit2014 techtalk - testing sparkSpark summit2014 techtalk - testing spark
Spark summit2014 techtalk - testing spark
Anu Shetty
 
Reactive programming using rx java & akka actors - pdx-scala - june 2014
Reactive programming   using rx java & akka actors - pdx-scala - june 2014Reactive programming   using rx java & akka actors - pdx-scala - june 2014
Reactive programming using rx java & akka actors - pdx-scala - june 2014
Thomas Lockney
 

Tendances (20)

Computational Techniques for the Statistical Analysis of Big Data in R
Computational Techniques for the Statistical Analysis of Big Data in RComputational Techniques for the Statistical Analysis of Big Data in R
Computational Techniques for the Statistical Analysis of Big Data in R
 
OpenJDK Concurrent Collectors
OpenJDK Concurrent CollectorsOpenJDK Concurrent Collectors
OpenJDK Concurrent Collectors
 
Debugging Your Production JVM
Debugging Your Production JVMDebugging Your Production JVM
Debugging Your Production JVM
 
JCConf 2018 - Retrospect and Prospect of Java
JCConf 2018 - Retrospect and Prospect of JavaJCConf 2018 - Retrospect and Prospect of Java
JCConf 2018 - Retrospect and Prospect of Java
 
TWJUG x Oracle Groundbreakers 2019 Taiwan - What’s New in Last Java Versions
TWJUG x Oracle Groundbreakers 2019 Taiwan - What’s New in Last Java VersionsTWJUG x Oracle Groundbreakers 2019 Taiwan - What’s New in Last Java Versions
TWJUG x Oracle Groundbreakers 2019 Taiwan - What’s New in Last Java Versions
 
Intro to Functional Programming with RxJava
Intro to Functional Programming with RxJavaIntro to Functional Programming with RxJava
Intro to Functional Programming with RxJava
 
Clr jvm implementation differences
Clr jvm implementation differencesClr jvm implementation differences
Clr jvm implementation differences
 
Making fitting in RooFit faster
Making fitting in RooFit fasterMaking fitting in RooFit faster
Making fitting in RooFit faster
 
Intro to Garbage Collection
Intro to Garbage CollectionIntro to Garbage Collection
Intro to Garbage Collection
 
Functional Reactive Programming by Gerold Meisinger
Functional Reactive Programming by Gerold MeisingerFunctional Reactive Programming by Gerold Meisinger
Functional Reactive Programming by Gerold Meisinger
 
Return-Oriented Programming: Exploits Without Code Injection
Return-Oriented Programming: Exploits Without Code InjectionReturn-Oriented Programming: Exploits Without Code Injection
Return-Oriented Programming: Exploits Without Code Injection
 
Java performance tuning
Java performance tuningJava performance tuning
Java performance tuning
 
Ruby3x3: How are we going to measure 3x
Ruby3x3: How are we going to measure 3xRuby3x3: How are we going to measure 3x
Ruby3x3: How are we going to measure 3x
 
NvFX GTC 2013
NvFX GTC 2013NvFX GTC 2013
NvFX GTC 2013
 
Basics of JVM Tuning
Basics of JVM TuningBasics of JVM Tuning
Basics of JVM Tuning
 
Spark summit2014 techtalk - testing spark
Spark summit2014 techtalk - testing sparkSpark summit2014 techtalk - testing spark
Spark summit2014 techtalk - testing spark
 
Reactive programming using rx java & akka actors - pdx-scala - june 2014
Reactive programming   using rx java & akka actors - pdx-scala - june 2014Reactive programming   using rx java & akka actors - pdx-scala - june 2014
Reactive programming using rx java & akka actors - pdx-scala - june 2014
 
Arm tools and roadmap for SVE compiler support
Arm tools and roadmap for SVE compiler supportArm tools and roadmap for SVE compiler support
Arm tools and roadmap for SVE compiler support
 
Reactive Programming and RxJS
Reactive Programming and RxJSReactive Programming and RxJS
Reactive Programming and RxJS
 
JVM Memory Model - Yoav Abrahami, Wix
JVM Memory Model - Yoav Abrahami, WixJVM Memory Model - Yoav Abrahami, Wix
JVM Memory Model - Yoav Abrahami, Wix
 

Similaire à Lp seminar

Memory Management with Java and C++
Memory Management with Java and C++Memory Management with Java and C++
Memory Management with Java and C++
Mohammad Shaker
 
Inside LoLA - Experiences from building a state space tool for place transiti...
Inside LoLA - Experiences from building a state space tool for place transiti...Inside LoLA - Experiences from building a state space tool for place transiti...
Inside LoLA - Experiences from building a state space tool for place transiti...
Universität Rostock
 
23_Advanced_Processors controller system
23_Advanced_Processors controller system23_Advanced_Processors controller system
23_Advanced_Processors controller system
stellan7
 

Similaire à Lp seminar (20)

Review: You Only Look One-level Feature
Review: You Only Look One-level FeatureReview: You Only Look One-level Feature
Review: You Only Look One-level Feature
 
あなたのScalaを爆速にする7つの方法
あなたのScalaを爆速にする7つの方法あなたのScalaを爆速にする7つの方法
あなたのScalaを爆速にする7つの方法
 
150807 Fast R-CNN
150807 Fast R-CNN150807 Fast R-CNN
150807 Fast R-CNN
 
Porting a Streaming Pipeline from Scala to Rust
Porting a Streaming Pipeline from Scala to RustPorting a Streaming Pipeline from Scala to Rust
Porting a Streaming Pipeline from Scala to Rust
 
Scaling an ELK stack at bol.com
Scaling an ELK stack at bol.comScaling an ELK stack at bol.com
Scaling an ELK stack at bol.com
 
RxJava@DAUG
RxJava@DAUGRxJava@DAUG
RxJava@DAUG
 
Stream processing from single node to a cluster
Stream processing from single node to a clusterStream processing from single node to a cluster
Stream processing from single node to a cluster
 
Memory Management with Java and C++
Memory Management with Java and C++Memory Management with Java and C++
Memory Management with Java and C++
 
Inside LoLA - Experiences from building a state space tool for place transiti...
Inside LoLA - Experiences from building a state space tool for place transiti...Inside LoLA - Experiences from building a state space tool for place transiti...
Inside LoLA - Experiences from building a state space tool for place transiti...
 
Low pause GC in HotSpot
Low pause GC in HotSpotLow pause GC in HotSpot
Low pause GC in HotSpot
 
Exploitation Crash Course
Exploitation Crash CourseExploitation Crash Course
Exploitation Crash Course
 
Performance .NET Core - M. Terech, P. Janowski
Performance .NET Core - M. Terech, P. JanowskiPerformance .NET Core - M. Terech, P. Janowski
Performance .NET Core - M. Terech, P. Janowski
 
Heading for a Record: Chromium, the 5th Check
Heading for a Record: Chromium, the 5th CheckHeading for a Record: Chromium, the 5th Check
Heading for a Record: Chromium, the 5th Check
 
2013 syscan360 yuki_chen_syscan360_exploit your java native vulnerabilities o...
2013 syscan360 yuki_chen_syscan360_exploit your java native vulnerabilities o...2013 syscan360 yuki_chen_syscan360_exploit your java native vulnerabilities o...
2013 syscan360 yuki_chen_syscan360_exploit your java native vulnerabilities o...
 
Understanding JVM GC: advanced!
Understanding JVM GC: advanced!Understanding JVM GC: advanced!
Understanding JVM GC: advanced!
 
3. Synthesis.pptx
3. Synthesis.pptx3. Synthesis.pptx
3. Synthesis.pptx
 
PuppetConf 2016: Multi-Tenant Puppet at Scale – John Jawed, eBay, Inc.
PuppetConf 2016: Multi-Tenant Puppet at Scale – John Jawed, eBay, Inc.PuppetConf 2016: Multi-Tenant Puppet at Scale – John Jawed, eBay, Inc.
PuppetConf 2016: Multi-Tenant Puppet at Scale – John Jawed, eBay, Inc.
 
Opal compiler
Opal compilerOpal compiler
Opal compiler
 
23_Advanced_Processors controller system
23_Advanced_Processors controller system23_Advanced_Processors controller system
23_Advanced_Processors controller system
 
An Introduction to JVM Internals and Garbage Collection in Java
An Introduction to JVM Internals and Garbage Collection in JavaAn Introduction to JVM Internals and Garbage Collection in Java
An Introduction to JVM Internals and Garbage Collection in Java
 

Lp seminar

  • 1. On-the-Fly Garbage Collection Using Sliding Views Erez Petrank Technion – Israel Institute of Technology Joint work with Yossi Levanoni, Hezi Azatchi, and Harel Paz
  • 2.
  • 3. Garbage Collection Two Classic Approaches Reference counting [Collins 1960]: keep a reference count for each object, reclaim objects with count 0. Tracing [McCarthy 1960]: trace reachable objects, reclaim objects not traced. Traditional Wisdom Good Problematic
  • 4.
  • 5.
  • 6.
  • 7.
  • 8. Terminology (stop the world, parallel, concurrent, …) Stop-the-World Parallel (STW) Concurrent On-the-Fly program GC
  • 9. Benefits & Costs Informal Pause times 200ms 2ms 20ms Throughput Loss: 10-20% Stop-the-World Parallel (STW) Concurrent On-the-Fly program GC
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24. Elimination of RC Updates Mpegaudio 5,517,795 51 1/108192 Jess 26,258,107 27,333 1/961 Javac 22,042,028 535,296 1/41 Jack 135,174,775 1,546 1/87435 Db 33,124,780 30,696 1/1079 Compress 64,905 51 1/1273 jbb 71,011,357 264,115 1/269 Benchmark No of stores No of “first” stores Ratio of “first” stores
  • 25.
  • 26.
  • 27.
  • 28. Running Write Barrier Concurrently Thread 1: Update(Object **slot, Object *new){ Object *old = *slot if (!IsDirty(slot)) { /* if we got here, Thread 2 has */ /* yet set the dirty bit, thus, has */ /* not yet modified the slot. */ log( slot, old ) SetDirty(slot) } *slot = new } Thread 2: Update(Object **slot, Object *new){ Object *old = *slot if (!IsDirty(slot)) { /* if we got here, Thread 1 has */ /* yet set the dirty bit, thus, has */ /* not yet modified the slot. */ log( slot, old ) SetDirty(slot) } *slot = new }
  • 29.
  • 30. Timeline Stop threads. Scan roots; Get buffers; erase dirty bits; Resume threads. Decrement values in read buffers; Increment “current” values; Collect dead objects
  • 31. Timeline Stop threads. Scan roots; Get buffers; erase dirty bits; Resume threads. Decrement values in read buffers; Increment “current” values; Collect dead objects Unmodified current values are in the heap. Modified are in new buffers.
  • 32.
  • 33.
  • 34. Graphically A Snapshot A Sliding View time time Heap Addr. Heap Addr. t t1 t2
  • 35.
  • 36.
  • 37.
  • 39. Pause Times vs. Jikes Concurrent
  • 43. A Glimpse into Subsequent Work: SPECjbb2000 Throughput
  • 44.
  • 45.
  • 46.
  • 47.