Presentation is loading. Please wait.

Presentation is loading. Please wait.

Presentation: Cas Craven

Similar presentations


Presentation on theme: "Presentation: Cas Craven"— Presentation transcript:

1 Presentation: Cas Craven
Generation Scavenging: A Non-Disruptive High Performance Storage Reclamation Algorithm David Ungar et al. ACM Presentation: Cas Craven CS395T 2011 with Dr McKinley

2 Historical Perspective: Smalltalk-80
Early Personal Computers Developed at Xerox PARC, Released OO Language, WIMP GUI, Ease of Programming DOS and the IBM PC have been around for 4 years. First release of X window system on the MIT Project Athena mailing list, Apple releases the first Macintosh. Takaway: the PC is a new thing, and interactive environments with GUIs are shiny and new This all started with a Xerox PARC (Palo Alto Research Center) project to build an interactive PC, with kids in mind, circa mid to late 70s Smalltalk developed in this effort, released in 1980 to a few organizations including Berkley (then more widely in ’83) The initial implementation used reference counting to minimize the gc pause Berkley implemented Berkley Smalltalk on a Sun 1.5 workstation. Berkley is building a Smalltalk RISC machine and trying to improve performance of Berkley Smalltalk

3 Goals Interactive – minimize pause times
Work well in a Virtual Memory machine Support circular structures Improve performance by minimizing CPU time used for memory management Xerox’s Smalltalk-80 used reference counting. 15-20% cpu time wasted, no circular structures.

4 Virtual Memory Segmentation Paging
Divide main memory into variable-size blocks Segment swapped in can only replace segment of the same size or larger Segment table in main memory Paging Fixed size blocks Hardware support hides translation time in memory latency Segmentation With objects ranging from 24 bytes to 128k, and with 32-64k objects in a smalltalk system, a segment table for every object would be too large Paging Frequently referenced objects can become scattered over pages, but previous work showed a way for idle time reorganization to mitigate this

5 GC Algorithms Reference counting Mark-sweep [MKSMW]
Copy-collector [Baker-78] Generational collection [Lieberman-Hewitt-83]

6 Reference Counting Overhead
Additional overhead Partial solution: Deferred RC [Deutsch-Bobrow] Incomplete – circular structures not reclaimed

7 Tracing Algorithms Mark-sweep Scavenging Algorithms
Large pause times Touches entire heap – lots of page faults Scavenging Algorithms Only touch live objects Baker’s Semispace Ballard’s modification of Baker’s algorithm: separate area for old objects Lieberman-Hewitt generational: not implemented Mark-Sweep: Pro: reclaims circular structures Con: high cpu overhead large pause times touches entire heap during sweep phase – large number of page faults Scavenging: Pro: only touch live objects, less thrashing, but still bad Ballard does better: don’t have to copy old objects so less overhead Cons: memory wasted Overhead incurred in creating, following, and correcting forwarding pointers can be reduced if not realtime Generational: Not yet implemented

8 Paging Dead Objects What if we just page all dead objects to disk?
Back of envelope: Allocation rate likely exceeds disk bandwidth Storage will be exceeded sooner rather than later

9 Generation Scavenging
New objects: NewSpace: Objects allocated here PastSurvivorSpace: holds survivors of previous scavenges FutureSurvivorSpace: empty during execution OldSpace: holds tenured objects Remembered Set: VM Registers plus old objects with references to new ones Transitive closure on this set finds all objects

10 Generation Scavenging
Contents Volatile Objects Permantent Objects Residence New Space Old Space Space Size 200Kb (1) 940Kb Location Main Memory Demand Paged Created By Instantiation Tenuring Reclaimed By Scavenging Mark-Sweep (2) Reclaimed Every 16 sec 3-8 hours Reclamation Takes 0.160 sec 5 min 1: All three Spaces are 140Kb, but only NewSpace is resident. *SurvivorSpace may be paged out to disk and only 28Kb was used during testing 2: This is done offline, during idle time.

11 Generation Scavenging
NewSpace PastSurvivor FutureSurvivor Registers OldSpace Remembered Set

12 Generation Scavenging
NewSpace PastSurvivor FutureSurvivor Registers OldSpace Remembered Set

13 Generation Scavenging
NewSpace FutureSurvivor PastSurvivor Registers OldSpace Remembered Set

14 Results Page it Immediate RC +compaction Deferred RC Mark-sweep
CPU Time (%) Dynamic Object Memory Paging I/Os Pause (s) Interval Page it ? 15Kb ~50/s Immediate RC 15-20 +compaction 1.3 Deferred RC 11 40Kb 0.03 0.3 Mark-sweep 25-40 1900Kb 90/gc 4.5 74 Ballard 7% 2000Kb Gen. Scavenge 200Kb 1.2/s 0.38 30

15 Discussion Points Goals: Limit pause times to a fraction of a second
Meshes well with virtual memory Reclaims circular structures Uses less than 2% of the CPU time

16 Discussion Points Experimental Methodology
Berkley Benchmarks on a Sun 1.5 Single run of 4500k instructions Only count 28k of Past/Future SurvivorSpace Pathological allocation patterns?

17 Discussion Discounting of offline reclamation time Tenure threshold?
No comparison against then-recent GC Mark-compact? Lieberman-Hewitt generational Modern perspective: Can it be parallel? Cache efficient?

18 Additional References
Kay, Alan C. The Early History Of Smalltalk. ACM SIGPLAN Notices, Vol 28, No. 3. Mar 1993. Kaehler, Ted.


Download ppt "Presentation: Cas Craven"

Similar presentations


Ads by Google