how two phase commit ensure serializability
Let me try to explain this using an example. Suppose there is coordinator and two participants named P1 &amp; P2.
Now suppose both P1 &amp; P2 creates a transaction to modify a variable A and no other transaction is raised in between, in this case coordinator know that both participants are doing same this coordinator will raise a commit message indicating that both participants can commit and changes will be saved.
Now let's take other example Suppose variable A depends on variable B, now participant P1 raises message to modify variable A and at the same time participant P2 raises message to modify both B &amp; A, in this case coordinator know that participants are going out of sync by executing these commands so master will decline this transaction since it will not serialize.
An assumption about the outcome of transactions, either commit, or abort, can save both messages and logging operations by the participants during the 2PC protocol's execution. For example, when presumed abort, if during system recovery from failure no logged evidence for commit of some transaction is found by the recovery procedure, then it assumes that the transaction has been aborted, and acts accordingly. [Wikipedia]