Everything2
Near Matches
Ignore Exact
Full Text
Everything2

lock convoying

created by nyte

(idea) by nyte (1 wk) (print)   ?   (I like it!) Tue Feb 14 2006 at 16:59:37

These days, many computers sold are multi-programmed machines. The industry as a whole is pretty near the limit in terms of increasing the processing power of a computer by increasing the processing power of its single CPU. Instead, they have turned to multiprocessor (SMP), multi-core (CMP), or multi-threaded machines to increase throughput. As such machines become more popular, the average programmer has to deal with the synchronization issues involved in writing a multi-threaded application. Lock convoying is one of the many problems to which a lock-based synchronization system is prone, along with deadlock and priority inversion.

Suppose there are a set of threads doing similar things (worker threads in a web server, for example). Unless they spend a lot of time accessing shared objects, one might expect that accesses to shared objects might be spread out more or less evenly over time. Some threads will be near the beginning of their work cycle; some will be near the middle; some will be near the end. "Natural randomization" ought to keep contention for any one lock low.

Now suppose some thread gets preempted while holding a lock that the other threads will be using later in their work cycle. As it sleeps, the other threads will "catch up" and either spin or get descheduled waiting on that lock. When the preempted lock holder wakes up, all the other threads are running more or less in "lockstep" (pun intended). They will all arrive at the next lock at around the same time, resulting in high contention. Eventually they may get spread out again, until once again a thread gets preempted holding the lock, at which point the convoy restarts.


printable version
chaos

convoy effect If Dr. Seuss Was A Tech Writer priority inversion spinlock
A "Big Bang" does not resolve Olbers' paradox Olbers' Paradox Body Farm Unwanted Convoy
lock Deadlock Nesting Models in Software Transactional Memory non-blocking synchronization
node-fu Double Indemnity Synchronization convoy
thread Shared memory server Preempt
mutex starvation contention Lock-freedom and Obstruction-freedom in Software Transactional Memory
Y'know, if you log in, you can write something here, or contact authors directly on the site. Create a New User if you don't already have an account.
  Epicenter
Login
Password

password reminder
register

Everything2 Help

Cool Staff Picks
Little presents from the Node Fairy:
We don't write poetry because it's cute
Jacó
Vaclav Havel's address to the US Congress, 21 February 1990
Watching Robyn Hitchcock
A Public Execution Is No Picnic
I reserve the right to club you and eat your bones
Cries and Whispers
False Memory Syndrome Foundation
Celtic Mythology
Death of a Yuppie
Lesbian conspiracy
node
Goth vs. Gothic
New Writeups
antigravpussy
One fly amongst many(person)
sam512
Moon Base Shackleton, 1978(fiction)
Pavlovna
toy boy(person)
XWiz
tear jerker(review)
Heitah
Anarchy is Order(idea)
jessicaj
July 26, 2008(dream)
Berek
ABBA(person)
devolution
k-hole(place)
Nadine_2
The Sound Of Madness(review)
SwimmingMonkey
Conversations with Fo Fo, the Loneliest dog in Purgatory(fiction)
locke baron
lynx(thing)
Simulacron3
Reality, Dimensions and the Natural Ontology(essay)
SubSane
Making Love to a 9-Foot Woman(person)
Ouzo
Thoughts(idea)
antigravpussy
I fall silent, listening. The breadcrumbs are talking about us(person)
This page courtesy of The Everything Development Company