Trying to understand atomicity from the new valhalla-spec-observers post

David Alayachew davidalayachew at gmail.com
Fri Apr 7 00:39:36 UTC 2023


Hello,

Thank you for responding! (Sorry for triple sending, mailing lists are
difficult for me to navigate, so I keep making this mistake)

> An example may be a Vector of 3 integers representing
> a coordinate in a 3d voxel game. In such a case, each
> of the 3 integers has independent min and max bounds,
> so tear among the 3 values doesn't create invalid
> coordinates.

Well, independent min and max bounds would just make it harder to get an
illegal coordinate, but it wouldn't prevent it entirely, correct?

And either way, illegal or not, the tearing could still end up with
coordinates that should not have been given in the first place.

Following your analogy, if I have the player go up and forward in (what
should be an atomic) single step, then tearing may result in the player
momentarily going only forward or only up. Maybe that is a bad example, but
hopefully my point is clear.

> This value can thus give up atomicity; it's up to
> users to access such a value in the correct program
> order (like with volatile, synchronization) shall
> they share it across threads.

I see, ok. Also, I think this part of your comment addresses the issues I
had with the first part of your comment. Maybe you were trying to say
something that I didn't understand, but these solutions fully address them.

But ok. So, when giving up atomicity, possible solutions can be volatile,
synchronization, amongst others to prevent damage caused by mutability.

So, it sounds like the exact same solutions that allow me to stay safe when
I mix mutability with concurrency are the exact same solutions that allow
me to stay safe when mixing mutability non-atomicity?

Thank you for your help and insight!
David Alayachew
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/valhalla-dev/attachments/20230406/7cae4cff/attachment.htm>


More information about the valhalla-dev mailing list