Synchronization For Short Periods - Intel ARCHITECTURE IA-32 Reference Manual

Architecture optimization
Table of Contents

Advertisement

IA-32 Intel® Architecture Optimization
Table 7-1
Properties of Synchronization Objects (Contd.)
Characteristics
Miscellaneous
Recommended
use conditions

Synchronization for Short Periods

The frequency and duration that a thread needs to synchronize with
other threads depends application characteristics. When a
synchronization loop needs very fast response, applications may use a
spin-wait loop.
A spin-wait loop is typically used when one thread needs to wait a short
amount of time for another thread to reach a point of synchronization. A
spin-wait loop consists of a loop that compares a synchronization
variable with some pre-defined value [see Example 7-4(a)].
On a modern microprocessor with a superscalar speculative execution
engine, a loop like this results in the issue of multiple simultaneous read
requests from the spinning thread. These requests usually execute
out-of-order with each read request being allocated a buffer resource.
On detection of a write by a worker thread to a load that is in progress,
7-22
Operating System
Synchronization
Objects
Some objects
provide intra-process
synchronization and
some are for
inter-process
communication
1. # of active threads
> # of cores.
2. Waiting thousands
of cycles for a
signal.
3. Synchronization
among processes
Light Weight User Syn-
chronization
Must lock accesses to
synchronization
variable if several
threads may write to it
simultaneously.
Otherwise can write
without locks.
1.The number of active
threads is less or
equal to the number
of cores.
2. Infrequent
contention.
3. Need inter process
synchronization
Synchronization
Object based on MON-
ITOR/MWAIT
Same as light weight.
Also can be used only
on systems that
support
MONITOR/MWAIT.
1. Same as light
weight objects.
2. MONITOR/MWAIT
available

Advertisement

Table of Contents
loading

Table of Contents