Atomicity |
In computer science, an atomic operation is one that appears to happen instantaneously. Atomicity implies indivisibility and irreducibility, so an atomic operation must appear to be performed entirely or not at all. Note that this is not actually the case; even a simple add operation in code requires perhaps three to five register operations. The operating system and computer architecture, however, can ensure that nothing interrupts that sequence of register operations, resulting in the appearance of atomicity.
Atomicity can prevent read-write and write-write conflicts. Suppose one Thread_(computer_science) of a program attempts to write the value updated to a memory location with the string initial , while another thread simultaneously attempts to read it. If the string read and write operations are not both atomic, the second thread may read the value updaial when it should read either initial or updated . Similarly, suppose two threads simultaneously attempt to write to the same memory space containing an integer value. If the integer write operation is non-atomic and the threads attempt to write 7 and 0, the bits may be mangled and a 5 may be written instead.
Many processor, especially 32-bit ones with 64-bit Floating point support, provide some read and write operations that are not atomic. Most processors provide an operation that can simultaneously read a location and update it in the same bus operation. This prevents any other processor or input-output device from writing or reading memory until the operation is complete.
==Examples of atomic operations==
==Other meanings==
There are several other unrelated meanings of the word atomic in computing:
*In the context of component-based paradigms, atomicity is an element of orthogonality. Possibly guaranteeing hermetic interfaces among components of a component-based system. Malfunctions in one component would result in side-effects in another component . In addition atomicity guarantees that services provided by a component are either offered as a whole, or not at all. Systems built according to this design principle localise the side-effects of changes within the package.
= See also =
|
|