Golang proposal: Dense mark bits and sweep-free allocation
github.com
github.com
If the cost of atomically setting bits in the mark bitmap turns out to be
high, we could instead dedicate a byte per object for the mark. This idea is
mentioned in GC literature [Garner, 2007]. Obviously, this involves an 8×
increase in memory overhead. It’s likely that on modern hardware, the
cost of the atomic bit operation is small, while the cost of increasing
the cache footprint of the mark structure is probably large.
I have been trained to think of an atomic operation at the CPU level flushing the cache line, and possibly L1 and further impacting all cores sharing the cache. This statement implies the opposite. Can anyone comment on this vis-a-vis a modern intel chip?For the multi-core case, there's always going to be cache line thrashing regardless of size. Cache lines will evict/transfer between cores as each accesses them.
Probably best to go with single bit, unless it can be shown that the overhead of generating a bit mask and the r/m/w is far more expensive.
An alternative to side bitmaps is a bytemap, a bytegrained data structure on the side. Bytemaps trade an 8× space overhead to avoid synchronizing on each set operation (if we assume support for atomic byte-grained stores).
I think the idea is that, since a bytemap is less dense, two cores less frequently access the same cache lines, leading to fewer invalidations. Though, I wonder if it pays off, since it also gives less locality.
That is, I don't think they are referring to the same concept of atomicity as you are.