Table of contents
1.
Introduction
2.
Types of Schedules
2.1.
Serial Schedules
2.2.
Non-Serial Schedules
3.
FAQs
4.
Key Takeaways
Last Updated: Mar 27, 2024
Easy

Types of Schedules

Career growth poll
Do you think IIT Guwahati certified course can help you in your career?

Introduction

A schedule is the presentation of transaction operations. Scheduling is brought into play when multiple transactions are running concurrently. The order of process must be set so that the procedures do not overlap and the transactions are timed accordingly. It maintains the order of the operation in each transaction. 

Types of Schedules

The categories of schedules are given below in the form of a chart.

Serial Schedules

Schedules in which the transactions do not start execution until the currently running transaction is finished are serial schedules.

Example:

T1 T2
Read(A)  
Read(B)  
Write(A)  
commit  
  Read(B)
  Read(A)
  Write(A)
  commit

Here R means read operation, and W means write operation. In this example, transaction T2 does not start execution until transaction T1 is finished.

Non-Serial Schedules

Schedules in which the transactions execute parallel at a time is known as non-serial Schedule. 

Example:

T1 T2
Read1(P)  
Write1(P)  
  Read2(Q)
  Write2(Q)
Read1(Q)  
Write1(Q)  
Read1(Q)  

Further Non-serial schedules are divided into two types:-

  • Serializable
    This is mainly used to maintain the consistency of the Database. It is mainly used in Non-Serial scheduling to verify whether the scheduling will lead to any inconsistency or not. A serial schedule does not need serializability because it follows a transaction only when the previous transaction is complete. 

    These are of two types:
    1. Conflict-serializable
     If a schedule can be converted into a serial by swapping non-conflicting operations is known as conflict serializable. If all conditions are   satisfied that are mentioned below, then procedures are considered as conflicting:

  • one of them is a write operation.
  • They operate on the same data item.
  • They belong to different transactions.

   2. View-serializable

   A schedule is known as a view serializable if it is view equivalent to a serial schedule. A conflict schedule is a view serializable, but if the serializability contains blind writes, then the view serializable schedule is not a conflict serializable schedule.

  • Non-serializable
    It does not guarantee to produce the same effect as produced by some serial schedules on any consistent database.

It is further classified into two types:
1. Recoverable
In recoverable Schedules, transactions commit only after all transactions whose changes they read commit. In other words, if some transaction Tk is reading value updated or written by some other transaction Tj, then the commit of Tk must occur after the commit of Tj.

Consider the following Schedule involving two transactions, T1 and T2.

T1 T2
Read(A)  
Write(A)  
  Write(A)
  Read(A)
commit  
  commit

This is a recoverable schedule since T1 commits before T2, which makes the value read by T2 correct.
2. Non-Recoverable
Suppose a transaction performs a dirty read from the uncommitted transaction in a schedule and commits only before the transaction has read values. In that case, such a schedule is known as an irrecoverable schedule.

T1 T2
Read(A)  
Write(A)  
  Write(A)
  Read(A)
  commit
abort  

T2 reads  A written by T1 and commits it, and T1 later aborted, and hence, the value read by T2 is wrong, but since T2 committed, this Schedule is non-recoverable.

You can also read about the Log based recovery.

Must Recommended Topic, Schema in DBMS

FAQs

  1. Why do we need scheduling in DBMS?
    During multiple transactions are running concurrently, there needs to be a sequence in which the operations are performed because, at a particular time, only one procedure can be performed on the database. It maintains the order of the operation in each individual transaction. 
  2. What is a strict schedule in DBMS?
    If a transaction is neither allowed to read nor write a data item in a schedule till the last transaction that has been written is committed or aborted, then such a schedule is called a Strict Schedule. In other words, a Strict Schedule allows only committed read and write operations.
  3. What is interleaved Schedule?
    A schedule in which the operations of an individual transaction are executed in order concerning the same transaction without having the restriction of transactions to be scheduled as a whole is called interleaved Schedule.
  4. What is a concurrent Schedule in DBMS?
    In case the instructions of the transactions get executed preemptively, a schedule is said to be concurrent. When the database system executes several transactions concurrently, the corresponding Schedule no longer needs to be serial. 
  5. Why is a serial schedule considered correct?
    As long as every transaction is executed from beginning to end in isolation from the operations of other transactions, we get a correct result on the database. It is considered valid because a serial Schedule is equivalent to a serial schedule.

Key Takeaways

In this article, we learned about different types of scheduling in DBMS, i.e., serial and non-serial scheduling which we learned about various types of non-serial scheduling along with their types.

Visit here to learn more about various topics related to database and management systems. Check out the Top 100 SQL Problems to master frequently asked questions in large companies and land into your dream company. Try  Coding Ninjas Studio for practicing a wide range of DSA questions asked in many interviews.

Live masterclass