Whats exact definition of ‘atomicity’ in programming?

the definition of ‘atomicity’ says that a transaction should be able to be terminated without being touched or manipulated by possibly concurrent running actions during its process. But does that also mean that a program should not run concurrent when it is supposed to be atomic?

let’s say we have 2 program as an example:


counts int i = 1 to 100 every second

every number is printed in new line


just prints “hi”

and a parent program that includes both of these program and run them once receiving a signal to start a specific program (e.g via sigaction in linux) with 2 version:

version 1:

runs the program (even concurrent) anytime once receiving the signal

which means program2 can print “hi” while program1 is still printing out the numbers

version 2:

only run one program at a time

signal for other program is blocked until program in progress has terminated

in this example, can only version 2 be considered atomic or both? Would this program be non-atomic only if e.g program2 would increment i by 1 during its process?