7

the difference between atomicity and isolation of DBMS is somewhat vague so i am asking for a clear difference between the two ?

Atomicity and isolation, are ensured in classical database transactions by using a commit protocol. This protocol is used to turn temporary storage into permanent storage - that is, the updates to the transaction's data are not visible until the commit protocol validates the stored data. Note that it is the presence of a commit record in the database log which effectively validates the transaction's data.

tamil
  • 83
  • 1
  • 7

3 Answers3

9

Atomicity describes the behavior within an individual transaction, and Isolation describes the behavior among one or more transactions.

Atomicity: Either all of the database operations in a transaction are executed or none are.

Isolation: Each transaction appears to execute in isolation from other transactions.

jyapx
  • 2,009
  • 2
  • 15
  • 18
2

Atomicity: all operations in a transaction are executed as a single unit.

Isolation: transactions don't see intermediate changes of other transactions.

According to these definitions, Isolation is just a part of Atomicity. Because when other transactions can see intermediate impact of our transaction, operations of our transaction cannot be considered as a single atomic unit.

Palindromer
  • 854
  • 1
  • 10
  • 29
0

Atomicity means if ONE transaction contains multiple operations, either ALL of them or NONE are performed.

The counterintuitive point is, this definition still allows for interleaving the operations with other transactions. As a result, atomicity itself does not guarantee isolation.

Example: Transaction A and B both contain two operations:

Transaction A:
A1: Read Alice's account balance
A2: Add 100 and write it back to Alice's balance

Transaction B:
B1: Read Alice's account balance
B2: Add 50 and write it back to Alice's balance

Suppose now Alice's balance is 0, and transactions A and B happen concurrently in the order of A1-B1-B2-A2, what is the final balance? It's 100.

Both A and B are atomically committed, in the sense that all their operations occurred. But without proper isolation, the result is probably not what you want.

wlnirvana
  • 1,811
  • 20
  • 36