Read during Evacuation

Roman Kennke rkennke at redhat.com
Thu Apr 4 19:17:43 UTC 2019


> while studying a bit Shenandoah, I would like to ask your help about
> how reads are handled in case of a concurrent evacuation, the
> following case:
> 
> * Mutator1 reads the fwd_ptr of an object, points to self.
> * Mutator2 wants to write to the same object, but GC is in the evacuation phase.
> * Mutator2 evacuates the object, CASes the fwd_ptr, updates the field
> it wants to write and let's assume that this is a volatile write.
> * Mutator1 resumes and follows the old fwd_ptr, and reads a stale value.
> 
> How can Mutator1 know that the object has been evacuated _and_ changed?

This is a race, with or without Shenandoah. Shenandoah cannot fix that race.

Write down the same sequence of events without Shenandoah. Mutator1 
would still read a stale value (e.g. from its CPU cache).


Roman


More information about the shenandoah-dev mailing list