encyclopegia.org

Load-link/store-conditional

In computer science, load-linked/store-conditional (LL/SC), sometimes known as load-reserved/store-conditional (LR/SC), are a pair of instructions used in multithreading to achieve synchronization.[src] Load-link returns the current value of a memory location, while a subsequent store-conditional to the same memory location will store a new value only if no updates have occurred to that location since the load-link.[src] Together, this implements a lock-free, atomic, read–modify–write operation.[src] "Load-linked" is also known as load-link, load-reserved, and load-locked.[src] LL/SC was originally proposed by Jensen, Hagensen, and Broughton for the S-1 AAP multiprocessor at Lawrence Livermore National Laboratory.[src]

In computer science, load-linked/store-conditional (LL/SC), sometimes known as load-reserved/store-conditional (LR/SC), are a pair of instructions used in multithreading to achieve synchronization.[src] Load-link returns the current value of a memory location, while a subsequent store-conditional to the same memory location will store a new value only if no updates have occurred to that location since the load-link.[src] Together, this implements a lock-free, atomic, read–modify–write operation.[src] "Load-linked" is also known as load-link, load-reserved, and load-locked.[src] LL/SC was originally proposed by Jensen, Hagensen, and Broughton for the S-1 AAP multiprocessor at Lawrence Livermore National Laboratory.[src] ==Comparison of LL/SC and compare-and-swap== If any updates have occurred, the store-conditional is guaranteed to fail, even if the value read by the load-link has since been restored.[src] As such, an LL/SC pair is stronger than a read followed by a compare-and-swap (CAS), which will not detect updates if the old value has been restored (see ABA problem).[src] Real implementations of LL/SC do not always succeed even if there are no concurrent updates to the memory location in question.[src] Any exceptional events between the two operations, such as a context switch, another load-link, or even (on many platforms) another load or store operation, will cause the store-conditional to spuriously fail.[src] Older implementations will fail if there are any updates broadcast over the memory bus.[src] This is called weak LL/SC by researchers, as it breaks many theoretical LL/SC algorithms.[src] Weakness is relative, and some weak implementations can be used for some algorithms.[src] LL/SC is more difficult to emulate than CAS.[src] Additionally, stopping running code between paired LL/SC instructions, such as when single-stepping through code, can prevent forward progress, making debugging tricky.[src] Nevertheless, LL/SC is equivalent to CAS in the sense that either primitive can be implemented in terms of the other, in O(1) and in a wait-free manner.[src] ==Implementations== LL/SC instructions are supported by: Alpha: ldl_l /stl_c and ldq_l /stq_c PowerPC/Power ISA: lwarx/stwcx and ldarx/stdcx MIPS: ll/sc and lld/scd ARM: ldrex/strex (ARMv6, v7 and v8-M ), and ldxr/stxr (ARMv8-A ) RISC-V: lr/sc ARC: LLOCK/SCOND Some CPUs require the address being accessed exclusively to be configured in write-through mode.[src] Typically, CPUs track the load-linked address at a cache-line or other granularity, such that any modification to any portion of the cache line (whether via another core's store-conditional or merely by an ordinary store) is sufficient to cause the store-conditional to fail.[src] All of these platforms provide weak LL/SC.[src] The PowerPC implementation allows an LL/SC pair to wrap loads and even stores to other cache lines (although this approach is vulnerable to false cache line sharing).[src] This allows it to implement, for example, lock-free reference counting in the face of changing object graphs with arbitrary counter reuse (which otherwise requires double compare-and-swap, DCAS).[src] RISC-V provides an architectural guarantee of eventual progress for LL/SC sequences of limited length.[src] Some ARM implementations define platform dependent blocks, ranging from 8 bytes to 2048 bytes, and an LL/SC attempt in any given block fails if there is between the LL and SC a normal memory access inside the same block.[src] Other ARM implementations fail if there is a modification anywhere in the whole address space.[src] The former implementation is the stronger and most practical.[src] LL/SC has two advantages over CAS when designing a load–store architecture: reads and writes are separate instructions, as required by the design philosophy (and pipeline architecture); and both instructions can be performed using only two registers (address and value), fitting naturally into common 2-operand ISAs.[src] CAS, on the other hand, requires three registers (address, old value, new value) and a dependency between the value read and the value written.[src] x86, being a CISC architecture, does not have this constraint; though modern chips may well translate a CAS instruction into separate LL/SC micro-operations internally.[src] ==Extensions== Hardware LL/SC implementations typically do not allow nesting of LL/SC pairs.[src] A nesting LL/SC mechanism can be used to provide a MCAS primitive (multi-word CAS, where the words can be scattered).[src] In 2013, Trevor Brown, Faith Ellen, and Eric Ruppert implemented in software a multi-address LL/SC extension (which they call LLX/SCX) that relies on automated code generation; they have used it to implement one of the best-performing concurrent binary search tree (actually a chromatic tree), slightly beating the JDK CAS-based skip list implementation.[src] ==See also== Non-blocking synchronization Read–modify–write Transactional memory ==References==[src]

36 sentences · 36 cited inline · 0 references stored

References

No reference rows published for this article.

Cite this article

MLA

"Load-link/store-conditional." encyclopegia.org, 2026, https://encyclopegia.org/wiki/load-link-store-conditional. Accessed 30 November 2026.

Chicago

"Load-link/store-conditional." encyclopegia.org. Accessed November 30, 2026. https://encyclopegia.org/wiki/load-link-store-conditional.

APA

encyclopegia.org. (2026). Load-link/store-conditional. Retrieved November 30, 2026, from https://encyclopegia.org/wiki/load-link-store-conditional

Accessed November 30, 2026 · CC BY-SA 4.0 · citation page · JSON

Related articles

Template:Link FA

stub · references available

Karl Link

stub · references available

outlet store

stub · references available

Roy Peter Link

stub · references available

AV.link

stub · references available

Air Link

stub · references available

Wertheim Department Store

stub · references available

warehouse store

stub · references available
CC BY-SA 4.0 · share-alike · https://en.wikipedia.org/w/index.php?oldid=1366602671 · 0.5 · snapshot enwiki-001366602671

Cite · JSON · Search

Related services and records

Services

  • Estate — measured countries, lanes and facts
  • Intel — live corroborated events
  • Legal — statutes, cases and citations
  • Encyclopedia — articles with inline sources
  • Space — launches, satellites and orbits
  • Search — federated search and reports
  • Pass — passport account and SSO
  • Corpora — read-only corpus origins
  • e01 — self-hosted corpora and tools
  • Careers — open roles: frontier engineers and sales partners
  • Index — every corpus, paper and record
  • Estate guide — what a public data estate is
  • Founder — Lois-Kleinner Alpasan
  • Records — DOIs and external deposits
  • Documents — one-pagers, PDFs and QR codes
  • Brand kit — logos and share images
  • Papers — plain-language briefs with citations
  • Browser — search engine, PWA and bookmarklet
  • Anticloud — the operator and its projects

As seen in Business Insider · 336 outlets · evidence DOIs · plain-language papers

Text and metadata only; each target carries its own sources. Missing data is published as no-data, never estimated.