News for hackers. Stuff that matters.
Re:What Should I Know About Garbage Collection as a Java Dev... by mike_hearn on Tuesday January 10, 2023 @05:20PM (#34332366)
Yeah, but it's actually deeper than just adding refcounts. The algorithms themselves can change in some cases.

The issue is, the hardware can usually only do atomic/interlocked operations at the word level. If you have a GC then you can atomically update a pointer from one thing to another and not think about the thing that was being pointed to previously: an object becomes unreachable atomically due to the guarantees provided by the GC (either via global pauses or write barriers or both). If you don't have that then you need to both update a pointer and a refcount atomically, which goes beyond what the hardware can easily do without introducing locks, but that in turn creates new problems like needing an ordering.

There are no comments on this comment yet.