Garbage collection, I have a possibly dumb question: Why is it when concurrency is brought up in (most) garbage collection algorithms, the answer is to have a separate nursery for each thread? I can intuitively see that it would be to solve a bottle-necking issue causes by a global lock during allocation, but would not a more simpler solution be to fork then run the mark, and sweep in a secondary (child) process, which then communicates back the data to be freed? This would eliminate the global lock during allocation since the parent process would not have to bother it self with the child, no? So what is the downside? I realize this is a hard question to answer without code, so pointing me to a book that anyone can recommend for garbage collection (algorithms, and design for beginners to this kind of stuff) would be nice, and would be sufficient to answer this question.
I thought that most garbage collection was done by reference count. Try Googling "garbage collection algorithms" and see what you get
What happens if a second thread asks for memory during a sweep? Does it get blocked until the sweep finishes?
Join our real-time social learning platform and learn together with your friends!