3 ms·
"For example, a garbage collector could deliberately trigger segfaults (by `mprotect()`ing all managed memory) to forcibly pause the mutator during a garbage co
by bogomipz 11y ago
"For example, a garbage collector could deliberately trigger segfaults (by `mprotect()`ing all managed memory) to forcibly pause the mutator during a garbage collection cycle. Every managed thread must install a `SIGSEGV` handler that waits until the collection process is done."
Interesting, is this actually a common implementation pattern for languages that have a GC built into their run time?
- catnaroek 11y agoNo idea. I haven't read the source code of any serious, production GC. I've only written toy ones.
- samth 11y agoI don't think the exact thing you describe is common, but plenty of garbage collectors use memory protection to implement the write barrier. This is particularly useful when integrating with arbitrary code you don't control, since it will also be affected by memory protection.