Atomic Operations
Atomic operations are sequences of instructions that guarantee atomic accesses and updates of shared single word variables. This means that atomic operations cannot protect accesses to complex data structures in the way that locks can, but they provide a very efficient way of serializing access to a single word.
The atomic operation kernel services are:
Item | Description |
---|---|
fetch_and_add | Increments a single word variable atomically. |
fetch_and_and, fetch_and_or | Manipulates bits in a single word variable atomically. |
compare_and_swap | Conditionally updates or returns a single word variable atomically. |
Single word variables accessed by atomic operations must be aligned on a full word boundary, and must be located in pinned memory if atomic operation kernel services are called with interrupts disabled.