30 Apr 2009

Q4. Why is a Two-Phase commit protocol better than an One-Phase atomic commit protocol?

Answer:

First of all, let's see the definition of One-Phase atomic commit protocol and Two-Phase commit protocol.

One-Phase atomic commit protocol is that an elected co-ordinator tells all the other processes to perform the operation in question. (Cosh, 2009)
Two-Phase commit protocol is ...
  1. The coordinator sends a VOTE_REQUEST message to all group members.
  2. The group member returns VOTE_COMMIT if it can commit locally, otherwise VOTE_ABORT.
  3. All votes are collected by the coordinator. A GLOBAL_COMMIT is sent if all the group members voted to commit. If one group member voted to abort, a GLOBAL_ABORT is sent.
  4. The group members then COMMIT or ABORT based on the last message received from the coordinator.
(Cosh, 2009)

Two-Phase commit protocol is better than One-Phase atomic commit protocol because there is no way to tell the coordinator when a process cannot perform the operation (Cosh, 2009)

Reference:

1. Cosh Ken (2009). "Lecture 7 of ICS362 – Distributed Systems". Computer Programming I in the Computer Information Systems Department at Payap University, Retrieved from URL - http://www.kencosh.co.uk/cis/ics362/362L7.ppt



No comments:

Post a Comment