3.5. Synchronization

Mutual exclusion is often the preferred method for protecting shared resources. The section of code that is being executed by a core while accessing such a shared resource is known as the critical section.

In ARMv5, you can use the SWP and SWPB instructions for synchronization. SWP and SWPB provide a method for software synchronization that does not require disabling interrupts. You can achieve this by performing a special type of memory access, that is, reading a value into a processor register and writing a value to a memory location as an atomic operation.

In ARMv7, the SWP and SWPB instructions are deprecated because they have the following limitations:

ARMv7 introduces Load-Exclusive and Store-Exclusive synchronization primitives, LDREX and STREX, to provide flexible and scalable synchronization. For more information about the new synchronization primitives, see Replacing ARMv5 synchronization primitives with equivalent ARMv7 synchronization primitives .

Copyright © 2014 ARM. All rights reserved.ARM DAI0425