For Q2, only the first line time since the line gets invalidated right after.
I think P1 has the line at the end also, since it updates the line by setting to 0 to give up the lock. So it has the cache line at 2 points in time, when it sets to 1 and again when it sets to 0.
yes, it was said in lecture that P0 has a valid copy of the cache line and the very beginning of and at the very end of the locking period
For Q1: the thread has the lock from the moment the "ts" command sets the lock variable from 0 -> 1 to the point when we set the variable to 0 during the release.
I think the key thing to note is that "having the lock" != "having a valid copy in cache".
@trappedin418. Yes. I agree. That's exactly what I want everyone to notice here.