Load-Linked and Store-Conditional

Let's visit yet another pair of instructions that can be used to build locks: load-linked and store-conditional.

We'll cover the following

Some platforms provide a pair of instructions that work in concert to help build critical sections. On the MIPS architecture“MIPS R4000 Microprocessor User’s Manual” by Joe Heinrich. Prentice-Hall, June 1993. Available: http://cag.csail.mit.edu/raw/documents/R4400 Uman book Ed2.pdf. The old MIPS user’s manual. Download it while it still exists., for example, the load-linked and store-conditional instructions can be used in tandem to build locks and other concurrent structures. The C pseudocode for these instructions is as found in the code excerpt below. Alpha, PowerPC, and ARM provide similar instructions“Load-Link, Store-Conditional” by Many authors… en.wikipedia.org/wiki/Load- Link/Store-Conditional. Can you believe we referenced Wikipedia? But, we found the information there and it felt wrong not to. Further, it was useful, listing the instructions for the different architectures: ldl l/stl c and ldq l/stq c (Alpha), lwarx/stwcx (PowerPC), ll/sc (MIPS), and ldrex/strex (ARM). Actually Wikipedia is pretty amazing, so don’t be so harsh, OK?.

Get hands-on with 1400+ tech skills courses.