160 likes | 175 Vues
Learn about minor and major garbage collection, heap sizing, and parallelizing strategies in Poly/ML and Isabelle languages. Explore effective memory management techniques and performance optimizations.
E N D
Parallel GC and Heap Management in Poly/ML and Isabelle David C.J. Matthews David.Matthews@prolingua.co.uk
Summary • Minor GC • Major GC • Sharing pass • Heap sizing
Poly/ML and Isabelle Poly/ML David Matthews Isabelle Larry Paulson Tobias Nipkow Makarius Wenzel
Standard ML Mutable data • Ref • Array • Mutex / Condition variable Immutable data • List • Closure Mostly immutable Most cells have short lifetime Equality of immutables is by value
Minor Collector Values initially allocated in allocation area Copying collector Mutable cells to mutable area Immutable cells to immutable area Only mutable area is scanned for roots
Parallelising Minor Collector Multiple threads process roots Work sharing Lock-free update of forwarding pointers No locking on immutable data Weak coherence
Major GC Mark-sweep Compacting
Parallelising Major GC Lock-free marking Marking is idempotent Sweep phase can operate on separate segments
Sharing phase • Combine cells with same contents • Recursively apply for lists and trees • Quicksort • Parallel • Expensive - O(n log n) • Reduces the live heap size
Heap sizing Paging Live data GC Cost Heap size
Heap sizing: Small Live Data Live data GC Cost Target Heap size
Heap sizing: Large live data Live data GC Cost Target Heap size
Heap sizing • Estimate a cost function • Calculate a minimum • Trigger sharing pass