Intel® Integrated Performance Primitives
Deliberate problems developing high-performance vision, signal, security, and storage applications.

Atomic integer operations on Intel processors

neaflo
Beginner
1,022 Views
Hi,
Arethe bellow assumptions correctregarding the increment/decrement operations on Intel processors?
1.Increment/Decrement operations on 32 bits or less integer variableson a single 32 bits processor with no hyper-threading technology are atomic.
2.On a processor with hyper-threading technology or on a multi-processor system, the increment/decrement operations are NOT guaranteed to be executed atomicaly.
How about 64 bits processors?
An official Inteldocument which would describethe atomic operations would be realy wellcomed!
Thanks,
Florin

Message Edited by neaflo on 04-06-2005 10:49 PM

0 Kudos
2 Replies
ianier-munoz
Beginner
1,022 Views
Hi,
The official Intel document that describes atomic operations isthe IA-32 Software Developer's Manual (volume 3): ftp://download.intel.com/design/Pentium4/manuals/25366814.pdf(See "7.1.1 Guaranteed Atomic Operations").
As for IA-64, you can find this information at http://developer.intel.com/design/itanium/manuals/245318.pdf(See "10.6.8 Atomic Operations").
Regards,
Ianier Munoz
0 Kudos
neaflo
Beginner
1,022 Views
Bellow isthe answer from Intel support team:
The rules for atomic operations may be found in Chapter 7, Locked Atomic Operations, of the IA-32 IntelR Architecture Software Developers Manual, Volume 3: System Programming Guide (http://developer.intel.com/design/Pentium4/documentation.htm). Here, it is guaranteed that simple loads or stores will be automatically atomic as long as the memory location is aligned on the appropriate boundary (16-bit boundary for 16-bit values, 32-bit boundary for 32-bit values, and so forth). In addition, simple loads or stores that are not aligned on the appropriate boundary are still guaranteed to be executed atomically if the 16, 32, or 64-bit values fit completely within a 32-byte cache line. Loads and stores that cross cache lines are not guaranteed to be executed atomically. In these cases, you can use the LOCK prefix to guarantee atomic operation of the simple load or store.
INC and DEC belong to the family of instructions that can read, modify, and write a data value in memory. Thus, their operation is not guarnateed to be atomic unless the LOCK prefix is used for these instructions (when referencing a location in memory). The XCHG instruction automatically causes the LOCK behavior to occur regardless of whether the prefix is used or not.
0 Kudos
Reply