Thanks Todd. Ok, that makes sense.
A related question. What happens if 2 threads do a plain write in the same cache line but independent locations. If this happens concurrently, can the system run into a 'lost update'? I'm sure it can't and I guess the cache coherence protocol takes care it. But would like to get confirmation anyway. On Monday, May 29, 2017 at 6:17:33 AM UTC+3, Peter Veentjer wrote: > > In Martin Thompson's talks about Aeron he mentions writing threads doing > an increment on an AtomicLong counter to claim a region in a buffer, but > the initial 4 bytes for the length field aren't written, but only on > completion of the frame, the length is set. This signals to the reader of > the buffer that this particular write is complete and provides a happens > before relation. > > My question is about this length field; who is responsible for zero'ing it > out? Once the buffer has been written, the content could be total gibberish > and if it isn't zero'd, the reading thread could falsely assume it is > written and boom.. > -- You received this message because you are subscribed to the Google Groups "mechanical-sympathy" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
