gc icon indicating copy to clipboard operation
gc copied to clipboard

Parallelize collector

Open ysbaddaden opened this issue 3 years ago • 0 comments

The collector is significantly slower than BDWGC. There must be room for enhancement, for example:

  1. unmark small and large objects in parallel;
  2. scan/mark objects from multiple threads;
  3. sweep small and large HEAPs in parallel;

About parallel marking, a naive attempt would be to make Stack thread-safe and execute GC_Collector_mark() from multiple threads, but Stack will become a contention point (too many concurrent push and pop). It would be better to have a global stack, where we push the fiber stack roots, and thread-local ones, where each thread would push/pop objects to scan; with an eventual steal of objects from other threads when their is nothing left to do (e.g. steal half the objects from another thread). If that's reminiscent of how a job stealing scheduler works... this is on purpose!

ysbaddaden avatar Jun 10 '22 17:06 ysbaddaden