Download as pdf or txt
Download as pdf or txt
You are on page 1of 10

CSC 403 GROUPING ASSIGMENT

TOPIC: TIMESTAMP-BASED CONCURRENCYY CONTROL PROTOCOLS


GROUP 2

S/N NAMES ADM NO


1. 1810308003 SAIDU TUKUR
2. 1810308013 UMAR HUSSAINI
3. 1810308022 UMAR SHEHU DAHIRU
4. 1810308031 MASUD ABDULLAHI
5. 1810308038 ABDULRAHMAN KABIRU
6. 1810308046 ABUBAKAR GARBA LAWAL
7. 1810308057 BALKISU MAIFULAWA SALISU
8. 1810308064 SUFYAN ABULRAHMAN RUFAI
9. 1810308074 CHUKWUEBUKA SAMUEL NWAFOR
10. 1810308083 ANTHONIA SUNDAY
11. 1810308094 SALISU ALHAJI MOHAMMED
12. 1920308004 ABDULRASHID MADA ADAMU
13. 2020308007 ANAS ABDULLAHI
14. 2020308015 USMAN BELLO
TIMESTAMP
Timestamp is a unique identifier created by the DBMS that indicates relative starting time of a transaction to identify
a transaction. They are usually assigned in the order in which they are submitted to the system.
Each transaction is assigned a unique timestamp when it starts. This timestamp represents the transaction's position in
a global time order. Data items also have associated timestamps.
Timestamp is used to associate time with some transaction or some event.
TIMESAMP-BASED CONCURRENCY CONTROL PROTOCOLS
Timestamp-based concurrency control protocols are a family of techniques used in database management systems to
ensure data consistency and manage concurrent access to the database.
These protocols rely on assigning unique timestamps to transactions and data items and using these timestamps to
make decisions about the order and compatibility of transactions. Here's a comprehensive explanation of timestamp-
based concurrency control protocols:
Timestamping can be generated using this two methods:
i. System clock: in this process, the system can be generated by using system clock at a time the transaction started
ii. Logical counter: in this process, it increments after every new timestamp has been assigned.
Suppose:
T1 = timestamp TS(1)
.
.
.
T2 = timestamp TS (2)
But, TS(1) ˂ TS(2)
Transaction Serialization:
The primary goal of timestamp-based protocols is to ensure serializability, which means
that the execution of a set of transactions produces results equivalent to some serial
(sequential) execution of those transactions.
Timestamp Ordering Protocol
- This protocol uses the timestamps of transactions to order their execution.
- If Transaction A has a lower timestamp than Transaction B, A is executed before B.
This ensures that older transactions have priority over newer ones.
- Transactions are allowed to execute in timestamp order, and conflicts are resolved by
delaying or aborting transactions to maintain this order.
Timestamp Assignment:
- When a transaction is initiated in the DBMS, it is assigned a unique timestamp. This
timestamp represents the transaction's order of entry and typically comes from the system
clock or a monotonically increasing counter. Each data item in the database is also
associated with a timestamp.
Handling Read and Write Conflicts:
- When a transaction wants to read an item, it checks if the item's timestamp is lower
than the transaction's timestamp. If the item's timestamp is higher (indicating a newer
version), the transaction is delayed or aborted.
- For write operations, if a transaction wants to write an item, it compares timestamps.
If the item's timestamp is higher, the transaction is aborted to maintain serializability.
- Read and write conflicts are resolved based on timestamps:
- Read Operation:
- When a transaction attempts to read a data item, it checks the timestamp of the data
item.
If the timestamp of the data item is higher (indicating a newer version), the transaction is
delayed or aborted. This ensures that a transaction reads a consistent snapshot of the
database.
The read operation timestamp, is a timestamp of youngest transaction which performed
read operation.
Is the largest timestamp of any transaction that executed read successfully.
Example:
Find the read timestamp(RTS) value of the following table
10 20 30 40

T1 T2 T3 T4

R1(A)

W1(A) R3(A)

R2(A)

W4(A)
RTS(A)=0
Update T1= 10
Is 0˂10? Yes
So we move to next one,
Update T3 = 30
Is 10 ˂ 30? Yes
So we move to the next one also,
Update T2 = 20
Is 30 ˂ 20? No.
Therefore, we stop at T3=30
Our RTS(A)=30
- Write Operation:
- When a transaction attempts to write to a data item, it compares its own timestamp
with the timestamp of the data item. If the data item's timestamp is higher, the transaction
is aborted, ensuring that the newest writes take precedence.
The write timestamp is a timestamp of youngest transaction which has performed write
operation.
Is the largest timestamp of any transaction that executed write successfully.
Consistency:
Timestamp-based protocols guarantee that transactions read data reflecting a consistent
snapshot of the database at a specific point in time. This snapshot consistency is
maintained through the careful control of transaction execution based on timestamps.
Advantages of timestamp:
Timestamp-based protocols are highly efficient, support a high degree of concurrency, and
automatically handle conflicts.
They are particularly useful in environments where transactions are frequently initiated and
short-lived.
Challenges:
- Timestamp management can be complex, especially in distributed databases.
- Dealing with deadlocks and contention can be challenging, and careful design and
Challenges:
- Timestamp management can be complex, especially in distributed databases.
- Dealing with deadlocks and contention can be challenging, and careful design and
implementation are required.

Summary:
In summary, timestamp-based concurrency control protocols are a fundamental approach
to managing concurrency in database systems. They ensure that transactions are executed
in a way that maintains data consistency and preserves serializability, which is crucial for
the integrity of database operations.

You might also like