I understand that both algorithms are very different, but what I don't understand is whether they achieve the same thing in the end. 2PC is for atomic commits and 2PL is for serializable isolation. But don't they both achieve the two things? don't these goals imply each other in the end?


1 Answer 1


These are two different things that have two different goals.

The two-phase locking protocol is designed to guarantee serializability for transactions that access concurrently a single, centralized database, using a locking mechanism. So its goal is to maintain the consistency of a centralized database, avoiding “bad” interferences among concurrent, different, transactions that operate on the same data.

Two-phase commit protocol, instead, concerns the execution of distributed transactions in a distributed database, and guarantee that a single distributed transaction, seen as “set of processes in a network system”, coordinates the work of those processes even in case of temporary system failures (for instance, in case of network failure). So the protocol has the objective of avoiding situations in which a certain transaction commit its operation is a node (that is in a part of the distributed database), but aborts in another node (that is in another part of the same distributed database).

Of course you can see both protocols as having the final objective is to maintain the “consistency” of the database, centralized in a case, distributed in the other. But this is really a generic point of view.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.