---
title: "ACP roles; CC methods in transactions"
subject: "Distributed System"
chapter: 8
key: "semester_7/distributed_system:acp-cc-distributed"
source: https://www.bctengineer.com/q/semester_7/distributed_system/acp-cc-distributed
site: BCT Engineering
---

# ACP roles; CC methods in transactions

Distributed System · Chapter 8: Transaction and Concurrency Control

- Asked in: 2070 Asar, 2+6 marks
- Video: [Distributed Transactions Explained: 2 Phase Commit vs Saga Pattern](https://www.youtube.com/watch?v=DOFflggE_0Q) — Hello Interview
- Answer checked by Claude Opus 5.5 (high effort) on 2026-10-14
- Page: https://www.bctengineer.com/q/semester_7/distributed_system/acp-cc-distributed
- Whole chapter: https://www.bctengineer.com/md/semester_7/distributed_system/chapter-8

## Question

What are the roles of atomic commitment protocol (ACP) in distributed transactions? Explain the different methods of concurrency control in distributed transactions.

## Short answer

Atomic commit protocols ensure all participants reach the same commit/abort decision via a coordinator collecting votes; participants save durable state, can veto, and support recovery. Concurrency control methods: locking (strict 2PL per server, distributed deadlock possible), timestamp ordering (globally unique timestamps, abort on conflict), and optimistic (validation during commit, global order).

## Answer

#### Roles of atomic commitment protocol
An **atomic commitment protocol (ACP)** makes sure that a distributed transaction, which has operations at several servers, is either committed at all of them or aborted at all of them. Its roles are:
- Ensure atomicity: all participants reach the same decision (commit if all vote Yes, otherwise abort).
- A **coordinator** collects votes and announces the decision; **participants** vote and carry it out.
- Ensure durability: participants save tentative changes to permanent storage before voting Yes, so the decision can be completed after a crash.
- Allow any participant to veto (abort) the transaction.
- Provide recovery from crashes and lost messages using logs and timeouts.

#### Concurrency control in distributed transactions
In a distributed transaction the objects are on different servers, and each server applies its own concurrency control. All servers must agree on the serialization order, otherwise the transactions could be serial at each server but not globally.
- **Locking**: each server locks its own objects. Strict 2PL is used, with locks held until the commit protocol completes. A transaction's locks are held at several servers, so **distributed deadlock** is possible, and the servers must detect or avoid it.
- **Timestamp ordering**: transactions are given globally unique timestamps (a pair of the local clock value and the server id; the servers' clocks are kept roughly synchronized). Each server enforces timestamp rules; if the servers order conflicting transactions the same way, the result is globally serializable. A conflict causes an abort at any server, which aborts the whole transaction.
- **Optimistic**: each server validates the part of the transaction it holds, during the first phase of commit. Validation must produce a consistent order across servers, so a global or ordered validation is needed.

The basic methods used at each server are:

1. **Locking** (pessimistic): a transaction locks data before access and holds it (strict 2PL) until commit. Conflicts cause waiting; deadlock is possible.
2. **Timestamp ordering**: each transaction gets a timestamp; conflicting operations must be executed in timestamp order; late operations abort the transaction. No deadlock.
3. **Optimistic concurrency control**: work on private copies, validate at commit time, and abort if there was a conflict.

## Check yourself

The answer's key points as multiple-choice questions, with the correct option and why.

1. What does an ACP decide?
   A. Commit if all participants vote Yes, otherwise abort
   B. Commit if the majority vote Yes
   C. Commit if the coordinator votes Yes
   D. Abort always
   Answer: A. All participants must reach the same decision, and any participant can veto. (Key point: ACP atomicity)

2. How are globally unique timestamps formed in distributed timestamp ordering?
   A. Server id plus local clock value
   B. Random numbers
   C. Transaction name
   D. Number of objects accessed
   Answer: A. Combining a server id with a loosely synchronised local clock gives unique, comparable timestamps. (Key point: Timestamps in distributed CC)

3. When does each server validate in distributed optimistic concurrency control?
   A. During the first phase of the commit protocol, in a consistent order across servers
   B. After the transaction has committed
   C. Before the working phase
   D. Never; no validation is needed
   Answer: A. Validation is part of commit and must produce a consistent global order. (Key point: Distributed optimistic)

4. Which method is pessimistic and may deadlock?
   A. Timestamp ordering
   B. Locking (strict 2PL)
   C. Optimistic control
   D. Validation
   Answer: B. Locking blocks conflicting transactions and can lead to deadlock; the other two have no deadlock. (Key point: Locking vs optimistic)

## Related in Distributed System

- [Atomic commitment protocols (2PC, 3PC)](https://www.bctengineer.com/question.md?key=semester_7%2Fdistributed_system%3Aacp-two-three-phase) — Distributed System, chapter 8
- [Flat/nested transactions; concurrency control](https://www.bctengineer.com/question.md?key=semester_7%2Fdistributed_system%3Aflat-nested-cc-methods) — Distributed System, chapter 8
- [Distributed concurrency control methods](https://www.bctengineer.com/question.md?key=semester_7%2Fdistributed_system%3Adistributed-cc-methods) — Distributed System, chapter 8
- [Cascading aborts; atomic commit protocol](https://www.bctengineer.com/question.md?key=semester_7%2Fdistributed_system%3Acascading-aborts-acp) — Distributed System, chapter 8
- [Flat/nested transactions; optimistic CC](https://www.bctengineer.com/question.md?key=semester_7%2Fdistributed_system%3Aflat-nested-optimistic) — Distributed System, chapter 8
- [Nested transactions; optimistic CC advantages](https://www.bctengineer.com/question.md?key=semester_7%2Fdistributed_system%3Anested-optimistic-advantages) — Distributed System, chapter 8

## Related in other subjects

- [Montreal Protocol and control of ODS in Nepal](https://www.bctengineer.com/question.md?key=semester_7%2Fenvironment_and_pollution_control%3Amontreal-protocol-nepal-ods-control) — Environment and Pollution Control, chapter 7
