According to the book " Operating Systems Concepts ", ninth edition , page 210, we have the following statement :
Many modern computer systems therefore provide special hardware instructions that allow us either to test and modify the content of a word or to swap the contents of two words atomically—that is, as one uninterruptible unit.
This means that an atomic instruction is an instruction that must run and complete without any interrupts. In the same page, we have :
The test and set() instruction can be defined as shown in Figure 5.3. The important characteristic of this instruction is that it is executed atomically. Thus, if two test and set() instructions are executed simultaneously (each on a different CPU), they will be executed sequentially in some arbitrary order. If the machine supports the test and set() instruction, thenwe can implement mutual exclusion by declaring a boolean variable lock, initialized to false. The structure of process Pi is shown in Figure 5.4.
According to the above statement, we can add another characteristic to the atomic instruction, which is two atomic instructions cannot be executed simultaneously. I think this statement is valid if these two atomic instructions share the same variable
lock and this make sense, because if two atomic operations ( like test_and_set()) operates on the same lock variable can be executed at the same time by two processes ( running in parallel on two cores ) and they wish to enter the critical section at the same time , then a race condition can occur. So can we say that an atomic instruction is an instruction that run without any interruptions and cannot run in parallel when it is called on the same lock variable on two or more different cores by two or more different processes or an atomic instruction is the one that cannot be interrupted and to achieve synchronization it should be supplemented by the capability that if two processes call it with the same lock variable then this atomic instruction cannot run on two processor simultaneously ?