In response to what action does X2 wait? If it is when it does its second read of bar, I am confused why it doesn't simply just abort and then wait to start the transaction again (feels redundant for it to complete its TX and then abort it at the end when we have enough info already to know it will have to abort. Otherwise if it is alerted immediately when X1 is written to bar's timestamp, what part of the STM protocol initiates this?
I also was wondering about the wait vs abort semantics above.
Overall this example was quite helpful for WA5 as it simplified the timestamping idea -- it's clear here timestamps are used to answer the question "is my copy of this data out of date" at the time where the transaction needs to validate its data (here, at commit time, for reads)
@martigp and @apappu, we stall because we wanted to run a read operation followed by a write (we wait until the write is done and then read the updated value).
Please log in to leave a comment.
Some quick notes about this example that helped me understand better. Atomic indicates all or nothing. So, we will either get 0, 0 in bar or 9, 7 in bar. Whenever we write to an object, we also change the version of that object.