Previous | Next --- Slide 9 of 66
Back to Lecture Thumbnails
Iamme

Does LL/SC protect against lack of progress due to preemption? If so, how?

bpr

@lamme, if I understand your question correctly, yes. While two instructions, LL/SC operate in a similar manner as CMPXCHG or the atomic fetch_and_op instructions. In and of themselves, they are just operating on a memory location without blocking any other processor. So if a thread executes LL, it has the sole copy of the cache line, but if any other processor makes a memory request to that location, then the LL will fail, whether or not the thread is executing or has been preempted.

MangoSister

Is the condition of LC being executed successfully "x hasn't been written to by others since LL" or "x hasn't been accessed to by others since LL"? Both version appear at different places, and I wonder which one is the correct one.

bpr

@MangoSister, both are correct. A specific architecture will implement one or the other, but generically both are correct and possible.