Showing posts with label Solved Exercises. Show all posts
Showing posts with label Solved Exercises. Show all posts

Thursday, April 2, 2020

Is the database schedule is recoverable?

Is the database schedule is recoverable? Recoverable schedule example problem, Practice problem based on recoverable schedules.


Recoverable schedule - solved exercise




Question:
Is the folloiwng schedule S is a recoverable schedule?
Sl.No.
T1
T2
1

W(A)
2
W(B)

3
W(A)

4

R(B)
5
Commit

6

Commit


A recoverable schedule:

A schedule is said to be a recoverable schedule if and only if each transaction commits only after all transactions from which it has read has committed.

  • Example 1: Let us consider a schedule S with three transactions T1, T2, and T3 which are working on two data items X and Y. Assume that, T1 has written a new value for X and T2 has written a new value for Y. If suppose, T3 consumes the values of X and Y that are produced by T1 and T2, then T3 must execute a commit only after T1 and T2 executed their commits. Now, the schedule is recoverable.

  • Example 2: Consider the schedule given in example 1. Assume that, T1 writes a new X first and T2 consumes and writes a new X. T3 works on data items X and Y and consumed X that was written by T2. In this case, T1 has to commit first, then T2, and finally T3. Now, the schedule is a recoverable schedule.

  • Example 3: Consider the schedule S given in example 1. If we assume that, T3 commits before either T1 or T2, then the schedule is not recoverable.


Solution:

 
In the given schedule, transaction T2 (refer serial number 4) reads the value of data item B that was written by transaction T1 (refer serial number 2). But, T1 (refer serial number 5) has committed before T2 (refer serial number 6). Hence, this schedule is recoverable schedule.

Is the schedule a serializable? Please work on this.


***********







Recoverable schedules in concurrent schedules
what is recoverable schedule
define recoverable schedules
recoverable schedules example
how to identify a recoverable schedule
check for recoverability in concurrent schedules



Schedule is conflict serializable - Exercise

Given schedule is conflict serializable or not exercise, Conflict serializability exercise, how to find whether a schedule is conflict serializable? conflict serializability example

 

Conflict Serializable Schedule - Solved Exercise


Question:
Consider a schedule S with five transactions T1, T2, T3 T4 and T5 as follows;
Sl.No.
T1
T2
T3
T4
T5
1
R(x)




2

W(x)



3


R(x)


4
R(y)




5



R(z)

6

W(y)



7
R(v)




8


W(v)


9



R(v)

10



W(y)

11




W(y)
12




W(z)

Is the schedule S conflict serializable?


Solution:
Conflict serializable schedule: A schedule is conflict serializable if it can be transformed into an equivalent serial schedule by swapping pairs of non-conflicting instructions. Two instructions conflict if they involve the same data item and at least one of them is a WRITE.
To find whether the given schedule is conflict serializable or not, we can draw precedence graph. Precedence graph can be constructed by carefully analyzing the conflicting instructions. For every conflicting instruction, an edge can be inserted into the precedence graph. At the end, if the graph has not formed a cycle, then we would say that the schedule S is conflict serializable, otherwise not.

Conflicting instructions and
the edge to be inserted
   
Precedence graph
Sl. No.: 1, 2
R1(x) and W2(x);
T1 → T2


Sl. No.: 4, 6
R1(y) and W2(y);
T1 → T2

Sl. No.: 7, 8
R1(v) and W3(v);
T1 → T3

Sl. No.: 8, 9
W3(v) and R4(v);
T3 → T4

Sl. No.: 6, 10
W2(y) and W4(y);
T2 → T4

Sl. No.: 10, 11
W4(y) and W5(y);
T4 → T5

Sl. No.: 5, 12
R4(z) and W5(z);
T4 → T5
Sl. No.: 4, 11
R1(y) and W5(y);
T1 → T5
Sl. No.: 6, 11
W2(y) and W5(y);
T2 → T5
Sl. No.: 4, 10
R1(y) and W4(y);
T1 → T4
Sl. No.: 2, 3
W2(x) and R3(x);
T2 → T3
As per the complete (last one) precedence graph, there exists no cycles. Hence, the given schedule S is conflict serializable.

***********









Conflict serializability solved exercise
conflict serializable schedule example
how to find whether a schedule is conflict serializable or not?
how to check a schedule is serializable or not?
use precedence graph for checking serializability
serializability solved exercise
concurrency and serializability

Featured Content

Multiple choice questions in Natural Language Processing Home

MCQ in Natural Language Processing, Quiz questions with answers in NLP, Top interview questions in NLP with answers Multiple Choice Que...

All time most popular contents

data recovery