ef56cdca9986c9042054ee660ba6d1c3a48bc411
[model-checker-benchmarks.git] / mcs-lock / note.txt
1 When lock() publishes the 'me' to the previous lock-holder
2         // prev->next.store(me, std::mo_release);
3 , it must synchronize with the unlock()'s 
4         // me->next.load(std::mo_acquire);
5 because otherwise when it's the lock()'s turn to lock, it is allowed to always
6 read 1 in 
7         // me->gate.load(std::mo_acquire)
8 such that it will end up with an infinite loop.
9
10 To make this happen, we establish synchronization between the initialization of
11 the gate and the later update of gate. From the inference analysis, we actually
12 got two results, where wildcard(7) and wildcard(8) only need one acquire. That's
13 actually the place to synchronize the update of gate. We can achieve it at the
14 Tail or at the next field.