User`s guide

Recommended and Required Source Changes
3.11 Synchronization
Note that the noninterlocked queue instructions are also compiled to their
PALcode equivalents and that they are still atomic on a single processor.
• The VAX synchronization tools work unchanged on OpenVMS Alpha and
OpenVMS I64. All of the following mechanisms use interlocked instructions
directly or indirectly for synchronization (the interlocked instructions that are
used provide memory barriers transparently):
Event flags—all of the system services that manipulate them
Spinlocks—all of the acquisition and release operators (LOCK and
UNLOCK, FORKLOCK and FORKUNLOCK, DEVICELOCK and
DEVICEUNLOCK)
Mutexes—protected by spinlocks
Lock manager—protected by spinlocks
Note
This synchronization guarantee is only true for multiprocessing systems.
The uniprocessing version of spinlocks does not use interlocked
instructions. As a result, memory barriers are not provided in
uniprocessor spinlock, mutex, and lock manager synchronization.
• Regarding ASTs, concurrent threads and atomicity, one must either redesign
the code or force atomicity using features provided by the compilers. The
MACRO compiler provides the PRESERVE feature.
• On OpenVMS Alpha, code that modifies exception handlers may require
changes if it is possible for an outstanding arithmetic trap or a machine
abort or both to occur asynchronously. The TRAPB instruction provides
the synchronization mechanisms that are required. If you want to force
synchronization when changing handlers, you must manually add these to
your program as shown in the following example:
ADDL3 R1, R2, 4(R3) ; Save total
EVAX_TRAPB ; Insure any arithmetic traps handled by
; existing handler
MOVAB HANDLER2, 0(FP) ; Enable new condition handler
• When writing OpenVMS Alpha assembly language code, make sure that you
understand the read/write ordering of the Alpha architecture. Encode MB
instructions where necessary.
3–24 Recommended and Required Source Changes