Retrofitting Parallelism onto Ocaml
summary
A mostly-concurrent, non-moving mark-and-sweep GC for multicore OCaml is implemented (major heap based on VCGC, allocator from Streamflow) and extended to handle weak refs, ephemerons with a cycle-delimited handshaking algorithm, lazy values and two kinds of finalizers; correctness is checked with the Spin model checker. Two minor-collector strategies are evaluated: Concurrent Minor (introduces read barriers reduced to three x86 instructions) and Parallel Minor (stop-the-world, parallel minors). Sequential overheads are ~4.9% slower and 3.5% slower respectively, lower peak memory, and good scaling to 24 cores; OCaml 5.00 adopts Parallel Minor.
AI-written summary · about
