• edited by
23,673 views
73 73 votes

Consider the following schedule $S$ of transactions $T1$ and $T2:$

$${\begin{array}{l|l}
\textbf{T1}&    \textbf{T2} \\\hline
\text{Read(A)} \\
\text{A = A – 10}\\
&   \text{Read(A) }\\  
&  \text{Temp = 0.2*A} \\
& \text{Write(A)} \\
& \text{Read(B)} \\    
\text{Write(A)}\\
 \text{Read(B)}\\
\text{B = B + 10}\\
\text{Write(B)} \\
& \text{B = B + Temp}  \\  
& \text{Write(B)}\\ 
\end{array}}$$

Which of the following is TRUE about the schedule $S$ ?

  1. $S$ is serializable only as $T1, T2$
  2. $S$ is serializable only as $T2, T1$
  3. $S$ is serializable both as $T1, T2$ and $T2, T1$
  4. $S$ is not serializable either as $T1,T2$ or as $T2,T1$

10 Answers

Best answer
80 80 votes

There is a cycle in the precedence graph - so the given schedule is not Conflict Serializable. 

If a schedule is view serializable but not conflict serializable it MUST have one or more blind writes. Here, there are no blind writes. So, the given schedule is not even view serializable. 

Option D is the Answer. 

 
• edited by
4 flags:
✌ Low quality (RahulVerma3 “Wrong Process”)
✌ Edit necessary (Jayanthc137 “Please look https_guru's answer below for complete clarity and correct solution.”)
✌ Edit necessary (jayy_patel “Not "View Serializable" does not mean not "Serializable"”)
✌ Edit necessary (Patel_And_Patel “this answer is not solved by correct concept”)
84 84 votes

$\color{red}\text{Correct option is D but it is not what you think.}$

$\color{red}\text{Just a slight modification in the given schedule}$
$\color{red}\text{will change the answer of this question.}$ 

$\color{red}\text{Debunking a Major Misconception:}$

Majority of aspirants has misconception that serializability is same as view serializability. They think view serializability is necessary and sufficient for serializability. But it is not so. You may potentially loose marks in future GATE Exam if your concepts are not correct. To justify this, I'll give counter example (just a slight variation of this question) at the end.

Since computations are also given along with read and write operations, just checking view serializability is not enough to conclude that given schedule is not serializable. Because every view serializable schedule is serializable but not every serializable schedule is view serializable.

From NPTEL:

Nptel Serializability

It may so happen that given schedule is neither CS nor VS but serializable just because of detailed behaviour of transactions are given. Its just coincidence the wrong answers posted here are getting correct option. Even faulty clock shows correct time twice a day.

General Serializability definition from Ullman:

Ullman Serializability Definition

(Based on above definiton, we'll analyze the GATE question.)

From Ullman:

Schedule from Ullman

In above example, given schedule is neither CS nor VS but it is serializable. Its equivalent to serial schedule $(T1,T2)$ and $(T2,T1)$ both. If this example had been given in the question, then the answer would have been option $C$.


Now, coming to the given question.
We have to check if the effect (final database state) of given schedule in question is equal to effect of SOME serial schedule (where transactions execute one after another without interleaving)..

Assume that initially $A=x$ and $B=y$. Effect of given schedule -

given question soln

If we execute above schedule, then final value of $A$ and $B$ will be $x-10$ and $y+0.2x$ respectively.

If there are $n$ transactions in schedule then $n!$ serial schedules are possible. Since there are two transactions involved in given schedule, only $2!(=2)$ serial schedules are possible. Now, Let's check effect of both serial schedule.

Effect of serial schedule $S_1 : (T1, T2)$ -

Serial Schedule 1

Effect of serial schedule $S_2 : (T2,T1)$ -

Serial Schedule 2

We can see that effect of given schedule is neither equal to effect of $S_1$ nor equal to effect of $S_2$.

So, given schedule is neither serializable as $T1, T2$ nor as $T2, T1$. Option D is correct.


Now consider the following schedule $S_{t}$ which is variation of given question, where I replaced $Temp = 0.2*A$ with $Temp = A$ :

Effect of $S_t$ -

Effect of serial schedule $S_{t1} : (T1,T2)$ -

Effect of serial schedule $S_{t2} : (T2, T1)$ -

We can easily see that for every initial database state, effect of $S_t$ is equal to effect of serial schedule $S_{t1} : (T1, T2)$.

So, schedule $S_t$ is serializable only as $T1,T2$. Here, option A is correct, not option D.
But $S_t$ is neither view serializable nor conflict serializable even though $S_t$ is serializable.


Note: 

  • When computations are given in the Schedule, we have to check for general serializability.
  • When computations are not given and only Read and Write operations are given then in that case, Serializability $\equiv$ View Serializability.
  • When computations and blind writes are not there, Serializability $\equiv$ View Serializability $\equiv$ Conflict Serializability.
• edited by
6 6 votes

For a schedule to be serializable check as follows : 

a) check for CSS(sufficient but not necessary) : since cycle in precedence graph. so not CSS.

b) check for VSS (sufficient and necessar): since no blind write it is not VSS.

thus not serializable(equivalent to any serial schedule).

Only serial schedule is possible either as T1->T2 or T2->T1.

4 4 votes
Ans is Option D which is saying that each transaction should run individually that is T1 separate and T2 separate
0 0 votes
no option correct as there is cycle in precedence graph therfore it is not VSS means not serializable!!
Answer:
Position:
Show:

Related questions

51 51 votes
7 answers 7 answers
25.4k
25.4k views
Ishrat Jahan asked Nov 2, 2014
25,411 views
Which level of locking provides the highest degree of concurrency in a relational database ?PageTableRowPage, table and row level locking allow the same degree of concurr...
82 82 votes
13 answers 13 answers
44.2k
44.2k views
Ishrat Jahan asked Nov 1, 2014
44,182 views
Consider a system with $2$ level cache. Access times of Level $1$ cache, Level $2$ cache and main memory are $1$ $ns$, $10$ $ns$, and $500$ $ns$ respectively. The hit rat...
50 50 votes
2 answers 2 answers
12.8k
12.8k views
Ishrat Jahan asked Nov 2, 2014
12,820 views
Consider a table $T$ in a relational database with a key field $K$. A $B$-tree of order $p$ is used as an access structure on $K$, where $p$ denotes the maximum number of...
51 51 votes
4 answers 4 answers
17.4k
17.4k views
Ishrat Jahan asked Nov 2, 2014
17,411 views
Consider two tables in a relational database with columns and rows as follows:$$\overset{\text{Table: Student}}{\begin{array}{|c|c|c|} \hline \textbf {Roll_no} & \textbf{...