SlideShare a Scribd company logo
1 of 25
Download to read offline
Rethinking
Garbage Collection
Rifat Shahriyar
Who Am I?
•  Asst. Prof., Dept. of CSE, BUET
•  PhD from Australian National University
(ANU)
•  Dissertation title
–  High Performance Reference Counting and
Conservative Garbage Collection
•  Supervised by
–  Steve Blackburn (ANU)
–  Kathryn McKinley (MSR)
2
Java Virtual Machine
3
The Birth of GC (1960)
4
Today Garbage collection is
ubiquitous
•  GC algorithms
–  Tracing and Reference counting
•  GC implementations
–  Exact and Conservative
✔ Tracing and Exact in all highly engineered,
high performance systems
✘ Reference counting and conservative only
in non-performance critical settings
5
GC Fundamentals
Algorithmic Components
Allocation Reclamation
6
Identification
Bump Allocation
Free List
`
Tracing
(implicit)
Reference Counting
(explicit)
Sweep-to-Free
Compact
Evacuate
3 1
Mark-Compact [Styger 1967]
Bump allocation + trace + compact
GC Fundamentals
Canonical Garbage Collectors
7
`
Sweep-to-Free
Compact
Evacuate
Mark-Sweep [McCarthy 1960]
Free-list + trace + sweep-to-free
Semi-Space [Cheney 1970]
Bump allocation + trace + evacuate
Generational[Ungar 1984]
•  Most objects die young
8
Nursery space
Mature space
Immix [Blackburn and McKinley 2008]
•  Contiguous allocation into regions
–  256B lines and 32KB blocks
–  Objects span lines but not blocks
•  Simple mark phase
–  Mark objects and containing regions
•  Free unmarked regions
•  Recycled allocation and defragmentation
9
block
line
recyclable linesobject mark line mark
Down for the Count?
Getting Reference Counting
Back in the Ring
ISMM’12
10
Tracing [McCarthy1960]
11
A
D
B
E
C
F
✗ ✗
Roots
Reference Counting [Collins 1960]
12
1
1
1
1 2
1
2
0
1
✗
Roots
Why Reference Counting?
Advantages
✔ Immediacy
✔ Object local
✔ Basic RC is easy
Disadvantages
✘  Cycles
✘  Performance
13
Problem
✔ One of the two fundamental GC algorithms
✔ Many advantages
✘ Neglected by performance-conscious VMs
So how much slower is it?
Can we get RC back in the ring?
14
30%
Optimizing RC
•  Limited bit count
–  Use just few bits, fix o/f with backup tracing
•  Elision of new object counts
–  Only do RC work if object survives the first GC
•  Born as dead
–  Avoid free-list work for short lived objects
15
16
New RC ≈ MS
Optimized RC vs. MS
-20%
0%
20%
40%
60%
80%
compress
jess
db
javac
mtrt
jack
avrora
bloat
eclipse
fop
hsqldb
luindex
pmd
sunflow
xalan
pjbb2005
geomean
faster←Time→slower
Old RC New RC
Summary
•  Old RC
–  30% slower than MS
–  40% slower than production
•  New RC
–  Limited bit count
–  Optimization for new objects
•  Performance
–  Matches MS
–  Still 10% slower than production
17
40%
10%
TotalTimevProduction
< 2012 2012
Taking Off the Gloves with
Reference Counting Immix
OOPSLA’13
18
Why So Slow?
10% 10%
-3%
TimevProduction
19
Total Mutator
GC
Looking a Little Deeper…
10% 9%
32%
7%
4%
28%
-2% -3% -2%-3% -3%
1%
MutatorvProduction
RC MS SS Immix
20
Time Instructions
Retired
L1 D
Cache Misses
Looking a Little Deeper…
10% 9%
32%
7%
4%
28%
-2% -3% -2%-3% -3%
1%
MutatorvProduction
RC MS SS Immix
21
Time Instructions
Retired
L1 D
Cache Misses
Free List
Bump Pointer
Goal & Challenge
•  Goal
–  Object-local collection
–  Excellent mutator locality
–  Copying to eliminate fragmentation
•  Immix provides opportunistic copying
✔ Same mutator locality as contiguous allocator
•  However, RC is inherently local
–  References to an object generally unknown
–  but copying must redirect all references
22
RC Immix
✔ Combines RC and Immix
✔ Line/block reclamation
✔ Line live object count with object reference count
✔ Exploit Immix’s opportunistic copy
✔ Observe new objects can be copied by first GC
✔ Observe old objects can be copied by backup GC
23
Total time
3% faster then Gen Immix, +6% worst case, -21% best case
24
-30%
-20%
-10%
0%
10%
20%
30%
40%
compress
jess
db
javac
mtrt
jack
avrora
bloat
eclipse
fop
hsqldb
jython
luindex
lusearchfix
pmd
sunflow
xalan
pjbb2005
geomean
faster←Time→slower
RC RC Immix
Summary
•  RC Immix
–  Object-local collection
–  Excellent mutator locality
–  Copying with RC
•  Great performance
–  Outperforms fastest production
•  Transforms RC
TotalTimevProduction
10%
RC 2013
RC Immix
-3%
25
Questions?

More Related Content

What's hot

Coupling ecophysiological data with models_Whitley
Coupling ecophysiological data with models_WhitleyCoupling ecophysiological data with models_Whitley
Coupling ecophysiological data with models_WhitleyTERN Australia
 
1704.03414_cvrg&hustcv
1704.03414_cvrg&hustcv1704.03414_cvrg&hustcv
1704.03414_cvrg&hustcv敏 杜
 
IBM Cloud Community Summit 2018:「Kubernetes in Muiticloudで戦うCloud Native時代」 b...
IBM Cloud Community Summit 2018:「Kubernetes in Muiticloudで戦うCloud Native時代」 b...IBM Cloud Community Summit 2018:「Kubernetes in Muiticloudで戦うCloud Native時代」 b...
IBM Cloud Community Summit 2018:「Kubernetes in Muiticloudで戦うCloud Native時代」 b...capsmalt
 
スマホでDeepLearning実践入門(α版)
スマホでDeepLearning実践入門(α版)スマホでDeepLearning実践入門(α版)
スマホでDeepLearning実践入門(α版)cocodrips
 
Quick Wikipedia Mining using Elastic Map Reduce
Quick Wikipedia Mining using Elastic Map ReduceQuick Wikipedia Mining using Elastic Map Reduce
Quick Wikipedia Mining using Elastic Map Reduceohkura
 
Ronan Kerr: Exploring the Debris Disk Around Beta Pictoris
Ronan Kerr: Exploring the Debris Disk Around Beta PictorisRonan Kerr: Exploring the Debris Disk Around Beta Pictoris
Ronan Kerr: Exploring the Debris Disk Around Beta PictorisJeremyHeyl
 

What's hot (8)

Coupling ecophysiological data with models_Whitley
Coupling ecophysiological data with models_WhitleyCoupling ecophysiological data with models_Whitley
Coupling ecophysiological data with models_Whitley
 
1704.03414_cvrg&hustcv
1704.03414_cvrg&hustcv1704.03414_cvrg&hustcv
1704.03414_cvrg&hustcv
 
IBM Cloud Community Summit 2018:「Kubernetes in Muiticloudで戦うCloud Native時代」 b...
IBM Cloud Community Summit 2018:「Kubernetes in Muiticloudで戦うCloud Native時代」 b...IBM Cloud Community Summit 2018:「Kubernetes in Muiticloudで戦うCloud Native時代」 b...
IBM Cloud Community Summit 2018:「Kubernetes in Muiticloudで戦うCloud Native時代」 b...
 
スマホでDeepLearning実践入門(α版)
スマホでDeepLearning実践入門(α版)スマホでDeepLearning実践入門(α版)
スマホでDeepLearning実践入門(α版)
 
CourboSpark
CourboSparkCourboSpark
CourboSpark
 
Quick Wikipedia Mining using Elastic Map Reduce
Quick Wikipedia Mining using Elastic Map ReduceQuick Wikipedia Mining using Elastic Map Reduce
Quick Wikipedia Mining using Elastic Map Reduce
 
Ronan Kerr: Exploring the Debris Disk Around Beta Pictoris
Ronan Kerr: Exploring the Debris Disk Around Beta PictorisRonan Kerr: Exploring the Debris Disk Around Beta Pictoris
Ronan Kerr: Exploring the Debris Disk Around Beta Pictoris
 
How does one go from binary data to HDF files efficiently?
How does one go from binary data to HDF files efficiently?How does one go from binary data to HDF files efficiently?
How does one go from binary data to HDF files efficiently?
 

Similar to Rethinking garbage collection

Nearest Neighbor Customer Insight
Nearest Neighbor Customer InsightNearest Neighbor Customer Insight
Nearest Neighbor Customer InsightMapR Technologies
 
Understanding low latency jvm gcs V2
Understanding low latency jvm gcs V2Understanding low latency jvm gcs V2
Understanding low latency jvm gcs V2Jean-Philippe BEMPEL
 
Scaling out logistic regression with Spark
Scaling out logistic regression with SparkScaling out logistic regression with Spark
Scaling out logistic regression with SparkBarak Gitsis
 
Fast Single-pass K-means Clusterting at Oxford
Fast Single-pass K-means Clusterting at Oxford Fast Single-pass K-means Clusterting at Oxford
Fast Single-pass K-means Clusterting at Oxford MapR Technologies
 
Oxford 05-oct-2012
Oxford 05-oct-2012Oxford 05-oct-2012
Oxford 05-oct-2012Ted Dunning
 
Use Ruby GC in full..
Use Ruby GC in full..Use Ruby GC in full..
Use Ruby GC in full..Alex Mercer
 
Performance Tuning - Understanding Garbage Collection
Performance Tuning - Understanding Garbage CollectionPerformance Tuning - Understanding Garbage Collection
Performance Tuning - Understanding Garbage CollectionHaribabu Nandyal Padmanaban
 
Seismic Data Processing, Ahmed Osama
Seismic Data Processing, Ahmed OsamaSeismic Data Processing, Ahmed Osama
Seismic Data Processing, Ahmed OsamaAhmed Osama
 
Мониторинг. Опять, rootconf 2016
Мониторинг. Опять, rootconf 2016Мониторинг. Опять, rootconf 2016
Мониторинг. Опять, rootconf 2016Vsevolod Polyakov
 
Robots, Small Molecules & R
Robots, Small Molecules & RRobots, Small Molecules & R
Robots, Small Molecules & RRajarshi Guha
 
clique-summary
clique-summaryclique-summary
clique-summaryJia Wang
 
Scaling classical clone detection tools for ultra large datasets
Scaling classical clone detection tools for ultra large datasetsScaling classical clone detection tools for ultra large datasets
Scaling classical clone detection tools for ultra large datasetsimanmahsa
 
Object Detection Beyond Mask R-CNN and RetinaNet I
Object Detection Beyond Mask R-CNN and RetinaNet IObject Detection Beyond Mask R-CNN and RetinaNet I
Object Detection Beyond Mask R-CNN and RetinaNet IWanjin Yu
 
Modularization compass - Navigating white waters of feature-oriented modularity
Modularization compass - Navigating white waters of feature-oriented modularityModularization compass - Navigating white waters of feature-oriented modularity
Modularization compass - Navigating white waters of feature-oriented modularityAndrzej Olszak
 
Chicago-Java-User-Group-Meetup-Some-Garbage-Talk-2015-01-14
Chicago-Java-User-Group-Meetup-Some-Garbage-Talk-2015-01-14Chicago-Java-User-Group-Meetup-Some-Garbage-Talk-2015-01-14
Chicago-Java-User-Group-Meetup-Some-Garbage-Talk-2015-01-14Jayesh Thakrar
 
150807 Fast R-CNN
150807 Fast R-CNN150807 Fast R-CNN
150807 Fast R-CNNJunho Cho
 
Quantum Computing and Qiskit
Quantum Computing and QiskitQuantum Computing and Qiskit
Quantum Computing and QiskitPooja Mistry
 
Wait! What’s going on inside my database?
Wait! What’s going on inside my database?Wait! What’s going on inside my database?
Wait! What’s going on inside my database?Jeremy Schneider
 

Similar to Rethinking garbage collection (20)

Nearest Neighbor Customer Insight
Nearest Neighbor Customer InsightNearest Neighbor Customer Insight
Nearest Neighbor Customer Insight
 
Understanding low latency jvm gcs V2
Understanding low latency jvm gcs V2Understanding low latency jvm gcs V2
Understanding low latency jvm gcs V2
 
Scaling out logistic regression with Spark
Scaling out logistic regression with SparkScaling out logistic regression with Spark
Scaling out logistic regression with Spark
 
ACM 2013-02-25
ACM 2013-02-25ACM 2013-02-25
ACM 2013-02-25
 
Fast Single-pass K-means Clusterting at Oxford
Fast Single-pass K-means Clusterting at Oxford Fast Single-pass K-means Clusterting at Oxford
Fast Single-pass K-means Clusterting at Oxford
 
Oxford 05-oct-2012
Oxford 05-oct-2012Oxford 05-oct-2012
Oxford 05-oct-2012
 
Understanding jvm gc advanced
Understanding jvm gc advancedUnderstanding jvm gc advanced
Understanding jvm gc advanced
 
Use Ruby GC in full..
Use Ruby GC in full..Use Ruby GC in full..
Use Ruby GC in full..
 
Performance Tuning - Understanding Garbage Collection
Performance Tuning - Understanding Garbage CollectionPerformance Tuning - Understanding Garbage Collection
Performance Tuning - Understanding Garbage Collection
 
Seismic Data Processing, Ahmed Osama
Seismic Data Processing, Ahmed OsamaSeismic Data Processing, Ahmed Osama
Seismic Data Processing, Ahmed Osama
 
Мониторинг. Опять, rootconf 2016
Мониторинг. Опять, rootconf 2016Мониторинг. Опять, rootconf 2016
Мониторинг. Опять, rootconf 2016
 
Robots, Small Molecules & R
Robots, Small Molecules & RRobots, Small Molecules & R
Robots, Small Molecules & R
 
clique-summary
clique-summaryclique-summary
clique-summary
 
Scaling classical clone detection tools for ultra large datasets
Scaling classical clone detection tools for ultra large datasetsScaling classical clone detection tools for ultra large datasets
Scaling classical clone detection tools for ultra large datasets
 
Object Detection Beyond Mask R-CNN and RetinaNet I
Object Detection Beyond Mask R-CNN and RetinaNet IObject Detection Beyond Mask R-CNN and RetinaNet I
Object Detection Beyond Mask R-CNN and RetinaNet I
 
Modularization compass - Navigating white waters of feature-oriented modularity
Modularization compass - Navigating white waters of feature-oriented modularityModularization compass - Navigating white waters of feature-oriented modularity
Modularization compass - Navigating white waters of feature-oriented modularity
 
Chicago-Java-User-Group-Meetup-Some-Garbage-Talk-2015-01-14
Chicago-Java-User-Group-Meetup-Some-Garbage-Talk-2015-01-14Chicago-Java-User-Group-Meetup-Some-Garbage-Talk-2015-01-14
Chicago-Java-User-Group-Meetup-Some-Garbage-Talk-2015-01-14
 
150807 Fast R-CNN
150807 Fast R-CNN150807 Fast R-CNN
150807 Fast R-CNN
 
Quantum Computing and Qiskit
Quantum Computing and QiskitQuantum Computing and Qiskit
Quantum Computing and Qiskit
 
Wait! What’s going on inside my database?
Wait! What’s going on inside my database?Wait! What’s going on inside my database?
Wait! What’s going on inside my database?
 

Recently uploaded

Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfRankYa
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 

Recently uploaded (20)

Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 

Rethinking garbage collection

  • 2. Who Am I? •  Asst. Prof., Dept. of CSE, BUET •  PhD from Australian National University (ANU) •  Dissertation title –  High Performance Reference Counting and Conservative Garbage Collection •  Supervised by –  Steve Blackburn (ANU) –  Kathryn McKinley (MSR) 2
  • 4. The Birth of GC (1960) 4
  • 5. Today Garbage collection is ubiquitous •  GC algorithms –  Tracing and Reference counting •  GC implementations –  Exact and Conservative ✔ Tracing and Exact in all highly engineered, high performance systems ✘ Reference counting and conservative only in non-performance critical settings 5
  • 6. GC Fundamentals Algorithmic Components Allocation Reclamation 6 Identification Bump Allocation Free List ` Tracing (implicit) Reference Counting (explicit) Sweep-to-Free Compact Evacuate 3 1
  • 7. Mark-Compact [Styger 1967] Bump allocation + trace + compact GC Fundamentals Canonical Garbage Collectors 7 ` Sweep-to-Free Compact Evacuate Mark-Sweep [McCarthy 1960] Free-list + trace + sweep-to-free Semi-Space [Cheney 1970] Bump allocation + trace + evacuate
  • 8. Generational[Ungar 1984] •  Most objects die young 8 Nursery space Mature space
  • 9. Immix [Blackburn and McKinley 2008] •  Contiguous allocation into regions –  256B lines and 32KB blocks –  Objects span lines but not blocks •  Simple mark phase –  Mark objects and containing regions •  Free unmarked regions •  Recycled allocation and defragmentation 9 block line recyclable linesobject mark line mark
  • 10. Down for the Count? Getting Reference Counting Back in the Ring ISMM’12 10
  • 12. Reference Counting [Collins 1960] 12 1 1 1 1 2 1 2 0 1 ✗ Roots
  • 13. Why Reference Counting? Advantages ✔ Immediacy ✔ Object local ✔ Basic RC is easy Disadvantages ✘  Cycles ✘  Performance 13
  • 14. Problem ✔ One of the two fundamental GC algorithms ✔ Many advantages ✘ Neglected by performance-conscious VMs So how much slower is it? Can we get RC back in the ring? 14 30%
  • 15. Optimizing RC •  Limited bit count –  Use just few bits, fix o/f with backup tracing •  Elision of new object counts –  Only do RC work if object survives the first GC •  Born as dead –  Avoid free-list work for short lived objects 15
  • 16. 16 New RC ≈ MS Optimized RC vs. MS -20% 0% 20% 40% 60% 80% compress jess db javac mtrt jack avrora bloat eclipse fop hsqldb luindex pmd sunflow xalan pjbb2005 geomean faster←Time→slower Old RC New RC
  • 17. Summary •  Old RC –  30% slower than MS –  40% slower than production •  New RC –  Limited bit count –  Optimization for new objects •  Performance –  Matches MS –  Still 10% slower than production 17 40% 10% TotalTimevProduction < 2012 2012
  • 18. Taking Off the Gloves with Reference Counting Immix OOPSLA’13 18
  • 19. Why So Slow? 10% 10% -3% TimevProduction 19 Total Mutator GC
  • 20. Looking a Little Deeper… 10% 9% 32% 7% 4% 28% -2% -3% -2%-3% -3% 1% MutatorvProduction RC MS SS Immix 20 Time Instructions Retired L1 D Cache Misses
  • 21. Looking a Little Deeper… 10% 9% 32% 7% 4% 28% -2% -3% -2%-3% -3% 1% MutatorvProduction RC MS SS Immix 21 Time Instructions Retired L1 D Cache Misses Free List Bump Pointer
  • 22. Goal & Challenge •  Goal –  Object-local collection –  Excellent mutator locality –  Copying to eliminate fragmentation •  Immix provides opportunistic copying ✔ Same mutator locality as contiguous allocator •  However, RC is inherently local –  References to an object generally unknown –  but copying must redirect all references 22
  • 23. RC Immix ✔ Combines RC and Immix ✔ Line/block reclamation ✔ Line live object count with object reference count ✔ Exploit Immix’s opportunistic copy ✔ Observe new objects can be copied by first GC ✔ Observe old objects can be copied by backup GC 23
  • 24. Total time 3% faster then Gen Immix, +6% worst case, -21% best case 24 -30% -20% -10% 0% 10% 20% 30% 40% compress jess db javac mtrt jack avrora bloat eclipse fop hsqldb jython luindex lusearchfix pmd sunflow xalan pjbb2005 geomean faster←Time→slower RC RC Immix
  • 25. Summary •  RC Immix –  Object-local collection –  Excellent mutator locality –  Copying with RC •  Great performance –  Outperforms fastest production •  Transforms RC TotalTimevProduction 10% RC 2013 RC Immix -3% 25 Questions?