0% found this document useful (0 votes)
64 views16 pages

Schedules in DBMS - Types of Schedules in DBMS

Uploaded by

Santhosh Kumar P
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
64 views16 pages

Schedules in DBMS - Types of Schedules in DBMS

Uploaded by

Santhosh Kumar P
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 16

4/14/24, 10:08 PM Schedules in DBMS | Types of Schedules in DBMS | Gate Vidyalay

Schedules in DBMS | Types of Schedules in DBMS


Database Management System

DBMS Mini Projects Topics for Stu…


Stu… 
Share

Watch on

Spread the love

Schedules in DBMS-

Before you go through this article, make sure that you have gone through the previous article on
Transactions in DBMS.

The order in which the operations of multiple transactions appear for execution is called as a schedule.

Types of Schedules-

In DBMS, schedules may be classified as-

https://www.gatevidyalay.com/schedules-in-dbms/ 1/12
4/14/24, 10:08 PM Schedules in DBMS | Types of Schedules in DBMS | Gate Vidyalay

In this article, we will discuss about Serial and Non-Serial Schedules.

Serial Schedules-

In serial schedules,

All the transactions execute serially one after the other.


When one transaction executes, no other transaction is allowed to execute.

https://www.gatevidyalay.com/schedules-in-dbms/ 2/12
4/14/24, 10:08 PM Schedules in DBMS | Types of Schedules in DBMS | Gate Vidyalay

Characteristics-

Serial schedules are always-

Consistent
Recoverable
Cascadeless
Strict

Example-01:

In this schedule,

There are two transactions T1 and T2 executing serially one after the other.
Transaction T1 executes first.
After T1 completes its execution, transaction T2 executes.
So, this schedule is an example of a Serial Schedule.

https://www.gatevidyalay.com/schedules-in-dbms/ 3/12
4/14/24, 10:08 PM Schedules in DBMS | Types of Schedules in DBMS | Gate Vidyalay

···

Example-02:

In this schedule,

There are two transactions T1 and T2 executing serially one after the other.
Transaction T2 executes first.
After T2 completes its execution, transaction T1 executes.

https://www.gatevidyalay.com/schedules-in-dbms/ 4/12
4/14/24, 10:08 PM Schedules in DBMS | Types of Schedules in DBMS | Gate Vidyalay

So, this schedule is an example of a Serial Schedule.

Non-Serial Schedules-

In non-serial schedules,

Multiple transactions execute concurrently.


Operations of all the transactions are inter leaved or mixed with each other.

Characteristics-

Non-serial schedules are NOT always-

Consistent
Recoverable
Cascadeless
Strict

Example-01:

https://www.gatevidyalay.com/schedules-in-dbms/ 5/12
4/14/24, 10:08 PM Schedules in DBMS | Types of Schedules in DBMS | Gate Vidyalay

In this schedule,

There are two transactions T1 and T2 executing concurrently.


The operations of T1 and T2 are interleaved.
So, this schedule is an example of a Non-Serial Schedule.

Example-02:

https://www.gatevidyalay.com/schedules-in-dbms/ 6/12
4/14/24, 10:08 PM Schedules in DBMS | Types of Schedules in DBMS | Gate Vidyalay

In this schedule,

There are two transactions T1 and T2 executing concurrently.


The operations of T1 and T2 are interleaved.
So, this schedule is an example of a Non-Serial Schedule.

Finding Number Of Schedules-

Consider there are n number of transactions T1, T2, T3 …. , Tn with N1, N2, N3 …. , Nn number of
operations respectively.

Total Number of Schedules-

Total number of possible schedules (serial + non-serial) is given by-

https://www.gatevidyalay.com/schedules-in-dbms/ 7/12
4/14/24, 10:08 PM Schedules in DBMS | Types of Schedules in DBMS | Gate Vidyalay

Total Number of Serial Schedules-

Total number of serial schedules

= Number of different ways of arranging n transactions

= n!

···

Total Number of Non-Serial Schedules-

Total number of non-serial schedules

= Total number of schedules – Total number of serial schedules

PRACTICE PROBLEM BASED ON FINDING NUMBER OF


SCHEDULES-

https://www.gatevidyalay.com/schedules-in-dbms/ 8/12
4/14/24, 10:08 PM Schedules in DBMS | Types of Schedules in DBMS | Gate Vidyalay

Problem-

Consider there are three transactions with 2, 3, 4 operations respectively, find-

1. How many total number of schedules are possible?


2. How many total number of serial schedules are possible?
3. How many total number of non-serial schedules are possible?

Solution-

Total Number of Schedules-

Using the above formula, we have-

···

https://www.gatevidyalay.com/schedules-in-dbms/ 9/12
4/14/24, 10:08 PM Schedules in DBMS | Types of Schedules in DBMS | Gate Vidyalay

Total Number of Serial Schedules-

Total number of serial schedules

= Number of different ways of arranging 3 transactions

= 3!

=6

Total Number of Non-Serial Schedules-

Total number of non-serial schedules

= Total number of schedules – Total number of serial schedules

···

= 1260 – 6

= 1254

Next Article- Serializability in DBMS

Get more notes and other study material of Database Management System (DBMS).

Watch video lectures by visiting our YouTube channel LearnVidFun.

https://www.gatevidyalay.com/schedules-in-dbms/ 10/12
4/14/24, 10:12 PM Serializability in DBMS | Conflict Serializability | Gate Vidyalay

Serializability in DBMS-

Some non-serial schedules may lead to inconsistency of the database.


Serializability is a concept that helps to identify which non-serial schedules are correct and will
maintain the consistency of the database.

Serializable Schedules-

If a given non-serial schedule of ‘n’ transactions is equivalent to some serial schedule of ‘n’ transactions,
then it is called as a serializable schedule.

Characteristics-

https://www.gatevidyalay.com/serializability-in-dbms-conflict-serializability/ 3/10
4/14/24, 10:12 PM Serializability in DBMS | Conflict Serializability | Gate Vidyalay

Serializable schedules behave exactly same as serial schedules.

Thus, serializable schedules are always-

Consistent
Recoverable
Casacadeless
Strict

Serial Schedules Vs Serializable Schedules-

Serial Schedules Serializable Schedules

No concurrency is allowed. Concurrency is allowed.

Thus, all the transactions necessarily execute Thus, multiple transactions can execute
serially one after the other. concurrently.

Serial schedules lead to less resource utilization Serializable schedules improve both resource
and CPU throughput. utilization and CPU throughput.

Serial Schedules are less efficient as compared to Serializable Schedules are always better than
serializable schedules. serial schedules.

(due to above reason) (due to above reason)

···

https://www.gatevidyalay.com/serializability-in-dbms-conflict-serializability/ 4/10
4/14/24, 10:12 PM Serializability in DBMS | Conflict Serializability | Gate Vidyalay

Types of Serializability-

Serializability is mainly of two types-

Apply Now For 2024 Intake

Learn and practice allied health sciences at the largest


hospital in Chengalpattu district

1. Conflict Serializability
2. View Serializability

In this article, we will discuss about Conflict Serializability.

Learn about View Serializability.


https://www.gatevidyalay.com/serializability-in-dbms-conflict-serializability/ 5/10
4/14/24, 10:12 PM Serializability in DBMS | Conflict Serializability | Gate Vidyalay

Conflict Serializability-

If a given non-serial schedule can be converted into a serial schedule by swapping its non-conflicting
operations, then it is called as a conflict serializable schedule.

Conflicting Operations-

Two operations are called as conflicting operations if all the following conditions hold true for them-

Both the operations belong to different transactions


Both the operations are on the same data item
At least one of the two operations is a write operation

Example-

Consider the following schedule-

In this schedule,

https://www.gatevidyalay.com/serializability-in-dbms-conflict-serializability/ 6/10
4/14/24, 10:12 PM Serializability in DBMS | Conflict Serializability | Gate Vidyalay

W1 (A) and R2 (A) are called as conflicting operations.


This is because all the above conditions hold true for them.

Checking Whether a Schedule is Conflict Serializable Or Not-

Follow the following steps to check whether a given non-serial schedule is conflict serializable or not-

Step-01:

Find and list all the conflicting operations.

Step-02:

Start creating a precedence graph by drawing one node for each transaction.

Step-03:

Draw an edge for each conflict pair such that if Xi (V) and Yj (V) forms a conflict pair then draw an
edge from Ti to Tj.

This ensures that Ti gets executed before Tj.

Step-04:

https://www.gatevidyalay.com/serializability-in-dbms-conflict-serializability/ 7/10
4/14/24, 10:12 PM Serializability in DBMS | Conflict Serializability | Gate Vidyalay

···

Check if there is any cycle formed in the graph.


If there is no cycle found, then the schedule is conflict serializable otherwise not.

NOTE-

By performing the Topological Sort of the Directed Acyclic Graph so obtained, the corresponding
serial schedule(s) can be found.
Such schedules can be more than 1.

Next Article- Practice Problems On Conflict Serializability

···
Get more notes and other study material of Database Management System (DBMS).

https://www.gatevidyalay.com/serializability-in-dbms-conflict-serializability/ 8/10

You might also like