Unit 5-Schedule in DBMS-1
Unit 5-Schedule in DBMS-1
In serial schedules,
• All the transactions execute serially one after the
other.
• When one transaction executes, no other
transaction is allowed to execute.
• Characteristics-
Serial schedules are always-
• Consistent
• Recoverable
• Cascadeless
• Strict
In this schedule,
• There are two transactions T1 and T2 executing serially In this schedule,
one after the other. • There are two transactions T1 and T2 executing serially
• Transaction T1 executes first. one after the other.
• • Transaction T2 executes first.
After T1 completes its execution, transaction T2 executes.
• So, this schedule is an example of a Serial Schedule. • After T2 completes its execution, transaction T1 executes.
• 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-
No concurrency is allowed.
Thus, all the Concurrency is allowed.
transactions necessarily Thus, multiple transactions
execute serially one after the can execute concurrently.
other.
Serializable
Serial schedules lead to less
schedules improve both
resource utilization and CPU
resource utilization and CPU
throughput.
throughput.
Serial Schedules are less Serializable Schedules are
efficient as compared to always better than serial
serializable schedules. schedules.
(due to above reason) (due to above reason)
Types of Non serial schedules
Non serial schedules are divided into serializability and the Non serial schedules. Let us first
discuss serializability.
There are two types of serializability which are as follows −
1. Conflict Serializable:
A schedule is called conflict serializable if it can be transformed into a serial schedule by swapping non-
conflicting operations. Two operations are said to be conflicting if all conditions satisfy:
1. They belong to different transactions
2. They operate on the same data item
3. At Least one of them is a write operation
Example:
Swapping is possible only if S1 and S2 are logically equal.
Example:
Swapping is possible only if S1 and S2 are logically equal.
Here, S1 = S2. That means it is non-conflict. Here, S1 ≠ S2. That means it is conflict.
• Conflict Equivalent
• In the conflict equivalent, one can be transformed to
another by swapping non-conflicting operations. In the
given example, S2 is conflict equivalent to S1 S1 can be
converted to S2 by swapping non-conflicting operations).
• Two schedules are said to be conflict equivalent if and only
if:
1. They contain the same set of the transaction.
2. If each pair of conflict operations are ordered in the same
way.
• Conflict Equivalent After swapping of non-conflict operations, the
schedule S1 becomes:
• Example:
T1 T2
Read(A)
Write(A)
Read(B)
Write(B)
Read(A)
Write(A)
Read(B)
Write(B)
Above two schedules is view equal because Final write operation in S1 is done by T3 and in S2,
the final write operation is also done by T3.
1. = 3! 6
Example: 2. S1 T1 T2 T3
3. S2 T1 T3 T2
4. S3 T2 T3 T1
5. S4 T2 T1 T3
6. S5 T3 T1 T2
7. S6 T3 T2 T1
Taking first schedule S1
Schedule S
With 3 transactions, the total number of
possible schedule