
Two-Phase Commit (2PC)
Two-Phase Commit (2PC) is a protocol used in distributed computing to ensure all parts of a system agree on a transaction. In the first phase, a coordinator asks all participant systems if they can commit the transaction. Each participant prepares and responds with either approval or denial. If all participants agree, the second phase is triggered, where the coordinator instructs them to commit the transaction. If any participant declines, the coordinator tells everyone to abort. This ensures consistency and reliability across the system, preventing partial updates that could lead to errors.