BeginnersBook

  • Home
  • Java
    • Java OOPs
    • Java Collections
    • Java Examples
  • C
    • C Examples
  • C++
    • C++ Examples
  • DBMS
  • Computer Network
  • Python
    • Python Examples
  • More…
    • jQuery
    • Kotlin
    • WordPress
    • SEO
    • JSON
    • JSP
    • JSTL
    • Servlet
    • MongoDB
    • XML
    • Perl

Timestamp based Ordering Protocol in DBMS

Last Updated: July 5, 2022 by Chaitanya Singh | Filed Under: DBMS

In the previous chapter, you learned lock based protocol in DBMS to maintain the integrity of database. In this chapter, you will learn Timestamp based ordering protocol.

What is Timestamp Ordering Protocol?

  • Timestamp ordering protocol maintains the order of transaction based on their timestamps.
  • A timestamp is a unique identifier that is being created by the DBMS when a transaction enters into the system. This timestamp can be based on the system clock or a logical counter maintained in the system.
  • Timestamp helps identifying the older transactions (transactions that are waiting in line to be executed) and gives them higher priority compared to the newer transactions. This make sure that none of the transactions are pending for a longer period of time.
  • This protocol also maintains the timestamps for the last read and last write on a data.
  • For example, let’s say an old transaction T1 timestamp is TS(T1) and a new transaction T2 enters into the system, timestamp assigned to T2 is TS(T2). Here TS(T1) < TS(T2) so the T1 has the higher priority because its timestamp is less than timestamp of T2. T1 would be given the higher priority than T2. This is how timestamp based protocol maintains the serializability order.

How a Timestamp ordering protocol works?

Let’s see how a timestamp ordering protocol works in a DBMS system. Let’s say there is data item A in the database.

W­_TS(A) is the largest timestamp of a transaction that executed the operation write(A) successfully.
R_TS(A) is the largest timestamp of a transaction that executed the operation read(A) successfully.

  1. Whenever a Transaction Tn issues a Write(A) operation, this protocol checks the following conditions:
    • If R_TS(A) > TS(Tn) or if W_TS(A) > TS(Tn), then abort and rollback the transaction Tn and reject the write (A) operation.
    • If R_TS(A) <= TS(Tn) or if W_TS(A) <= TS(Tn) then execute Write(A) operation of Tn and set W_TS(A) to TS(Tn).
  2. Whenever a Transaction Tn issues a Read(A) operation, this protocol checks the following conditions:
    • If W_TS(A) > TS(Tn), then abort and reject Tn and reject the Read(A) operation.
    • If W_TS(A) <= TS(Tn), then execute the Read(A) operation of Tn and update the timestamp R_TS(A).

Advantages of Timestamp based protocol

  • Schedules managed using timestamp based protocol are serializable just like the two phase protocols
  • Since older transactions are given priority which means no transaction has to wait for longer period of time that makes this protocol free from deadlock.
❮ Lock based ProtocolValidation based Protocol ❯

Top Related Articles:

  1. Transaction Management in DBMS
  2. Checkpoint in DBMS
  3. Types of DBMS (Database Management System)
  4. Lock based Protocol in DBMS
  5. DBMS Transaction States

About the Author

I have 15 years of experience in the IT industry, working with renowned multinational corporations. Additionally, I have dedicated over a decade to teaching, allowing me to refine my skills in delivering information in a simple and easily understandable manner.

– Chaitanya

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

DBMS Tutorial

Basics

  • DBMS Tutorial
  • DBMS Introduction
  • Database Applications
  • DBMS vs File System
  • DBMS vs RDBMS
  • DBMS Architecture
  • Three-level DBMS architecture
  • View in DBMS
  • Abstraction
  • Instance & Schema
  • DBMS languages

Data Models

  • Data Models
  • ER Diagram
  • ER Design issues
  • Convert ER to table
  • DBMS Generalization
  • DBMS Specialization
  • DBMS Aggregration
  • Relational Model
  • Hierarchical Model
  • Constraints
  • Cardinality

Relational Database

  • RDBMS concepts
  • Relational Algebra
  • Relational Calculus
  • Keys Index
  • Primary Key
  • Super Key
  • Candidate Key
  • Foreign Key
  • Composite Key
  • Alternate Key

Normalization

  • Normalization
  • Functional dependency

Transaction Management

  • Transaction Management
  • ACID properties
  • Transaction States
  • DBMS Schedules
  • Serializability
  • Conflict Serializability
  • View Serializability
  • Recoverability Of Schedule
  • Failure Classification
  • Log based Recovery
  • DBMS Checkpoint
  • Deadlock

Concurrency Control

  • Concurrency Control
  • Lock based protocol
  • Timestamp based protocol
  • Validation based protocol

File Organization

  • File Organization
  • Sequential File Organization
  • Heap File Organization
  • Hash File Organization
  • DBMS ISAM
  • B+ File Organization
  • Cluster File Organization

SQL Introduction

  • SQL Introduction
  • SQL Characteristics
  • Advantages of SQL
  • SQL Commands
  • SQL Operators
  • SQL CREATE
  • SQL DROP
  • SQL SELECT
  • SQL INSERT

Copyright © 2012 – 2025 BeginnersBook . Privacy Policy . Sitemap