In a distributed system, how atomic operations are done when network connections inherently have the Two Generals problem?
Does atomicity have a different meaning in this context?
There is one primary meaning of the word "atomicity", and one additional property that some people use on occasion.
The primary meaning is that a complex operation (usually called a "transaction"), which requires multiple parties to take action, either happens or doesn't happen. It can't happen only in part.
One classic example (because this is one domain where atomicity is more important than most other considerations) is transferring money from one bank account to another bank account at a different bank. Think of the banks as communicating agents (possibly involving other agents, like an arbitrator or broker). Conceptually, one bank needs to subtract some amount from a number held somewhere, and the other bank needs to add the same amount. The important part is that either both pieces of arithmetic happen or neither happen. What is not allowed is for money to be created or destroyed.
The additional property that some people add is that all agents, or at least the initiating agent, must be able to know in a timely manner whether the transaction happened or didn't happen. Think of a file system sync operation, for example. If that operation returns and signals that it was successful, the client can assume that any data and/or metadata written to the file system before the sync operation has been committed to secondary storage.