| | |
Summary: Empirical Studies of Competitive Spinning
for A SharedMemory Multiprocessor
Anna R. Karlin \Lambda , Kai Li y , Mark S. Manasse \Lambda , Susan Owicki \Lambda
Abstract
A common operation in multiprocessor programs is ac
quiring a lock to protect access to shared data. Typ
ically, the requesting thread is blocked if the lock it
needs is held by another thread. The cost of blocking
one thread and activating another can be a substan
tial part of program execution time. Alternatively, the
thread could spin until the lock is free, or spin for a
while and then block. This may avoid contextswitch
overhead, but processor cycles may be wasted in unpro
ductive spinning. This paper studies seven strategies
for determining whether and how long to spin before
blocking. Of particular interest are competitive strate
gies, for which the performance can be shown to be
no worse than some constant factor times an optimal
offline strategy. The performance of five competitive
strategies is compared with that of always blocking, al
|