![]() |
VOOZH | about |
Scheduling is the process of determining the order in which transactions are executed. When multiple transactions run concurrently, scheduling ensures that operations are executed in a way that prevents conflicts or overlaps between them.
Schedules in which transactions execute one after another without interleaving., i.e., no transaction starts until a running transaction has ended are called serial schedules.
Example: Consider the following schedule involving two transactions T1 and T2 .
In the above table R(A) and W(A) denotes that a read and write operation is performed on some data item 'A' respectively, denoting a serial schedule since the transactions perform serially in the order T1 —> T2 .
Transactions execute in an interleaved manner in Non-Serial Schedule.
Non-serial schedules are of two types:
A non-serial schedule that behaves like a serial schedule.
There are two types of serializable schedules:
i. Conflict Serializable: A schedule is conflict serializable if it can be converted into a serial schedule by swapping non-conflicting operations.
Two operations conflict when:
ii. View Serializable: A Schedule is called view serializable if:
Note: Conflict-serializable schedules are a subset of view-serializable schedules. (Conflict-serializable ⊂ View-serializable.)
Schedules that do not preserve serial equivalence and may lead to inconsistencies if not handled carefully.
They are classified into the following types:
i. Recoverable Schedule: Recoverable schedules are those in which a transaction commits only after all transactions whose values it has read have also committed.
Example: Consider the following schedule involving two transactions T1 and T2 .
This is a recoverable schedule since T1 commits before T2 , that makes the value read by T2 correct. There can be three types of recoverable schedule:
ii. Cascading Schedule: A schedule where:
iii. Cascadeless Schedule: A schedule where:
Example: Consider the following schedule involving two transactions T1 and T2 .
This schedule is cascadeless. Since the updated value of A is read by T2 only after the updating transaction i.e. T1 commits.
Example: Consider the following schedule involving two transactions T1 and T2 .
It is a recoverable schedule but it does not avoid cascading aborts. It can be seen that if T1 aborts, T2 will have to be aborted too in order to maintain the correctness of the schedule as T2 has already read the uncommitted value written by T1 .
iv. Strict Schedule: It's a stronger form of cascadeless schedule that follows the following rules:
Example: Consider the following schedule involving two transactions T1 and T2 .
This is a strict schedule since T2 reads and writes A which is written by T1 only after the commit of T1 .
v. Non-Recoverable Schedule: A schedule where:
Example: Consider the following schedule involving two transactions T1 and T2.
T2 read the value of A written by T1, and committed. T1 later aborted, therefore the value read by T2 is wrong, but since T2 committed, this schedule is non-recoverable.
Summary of Relationships
The following Venn diagram shows the hierarchical relationship among the different types of schedules:
Question: Consider the following schedule:
S:R1(A), W2(A), Commit2, W1(A), W3(A), Commit3, Commit1
Which of the following is true?
(A) The schedule is view serializable schedule and strict recoverable schedule(
B) The schedule is non-serializable schedule and strict recoverable schedule
(C) The schedule is non-serializable schedule and is not strict recoverable schedule.
(D) The Schedule is serializable schedule and is not strict recoverable schedule
Solution: The schedule can be depicted as:
The schedule is view-serializable because it matches the serial order T1 → T2 → T3 (initial read, intermediate writes, and final write all match this order).