This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

What is single-copy atomicity and how it is used in the software programming?

Hi all,

What is single copy atomicity and how it is used in the software programming.

  • Hi,

    Atomicity is a complex subject! And one which is becoming more important as embedded systems become more complex. Developments like write buffers, superscalar pipelines, out of order execution and so on mean that the order of memory access is not necessarily guaranteed at run-time in certain circumstances. Especially when you have more than one thread of execution (whether that's two threads on a single core or two threads running on separate cores).

    The rules around atomicity are not something which you "use" in programming. Rather they are intended to specify the cases where memory access behaviour in relation to program order can be guaranteed. So, certain accesses, e.g. aligned word accesses, are guaranteed by the architecture to return sensible results even if other threads are accessing the same memory item.

    These rules are necessary in order to guarantee that the programmer (and the compiler) can rely on correct behaviour of memory in the majority of cases. They are specified in the architecture to ensure that all implementations comply with them in real systems.

    The multi-copy atomicity rules are similar but relate specifically to multi-processing environments in which several possible observers may be using/accessing a particular item in memory. To be able to guarantee correct behaviour, you (your program) needs to be able to assume that memory behaves in a consistent way.

    Hope this helps.

    Chris