Two-Phase Commit (2PC) is a distributed algorithm that coordinates multiple processes to achieve atomic commitment for a transaction. It operates in two distinct phases: a prepare phase, where a coordinator asks all participants if they can commit, and a commit phase, where the coordinator instructs all to finalize the transaction based on unanimous agreement. This protocol is a cornerstone for ensuring data consistency in distributed databases and is a critical primitive for multi-agent system orchestration, where coordinated action is required.
