Computer Science Engineering (CSE) Exam  >  Computer Science Engineering (CSE) Questions  >  Consider the following transactions with data... Start Learning for Free
Consider the following transactions with data items P and Q initialized to zero:
T1 :read (P);
read (Q);
if P = 0 then Q := Q + 1 ;
write (Q).
T2 : read (Q);
read (P);
if Q = 0 then P := P + 1 ;
write (P).
Any non-serial interleaving of T1 and T2 for concurrent execution leads to
  • a)
    a serializable schedule
  • b)
    a schedule that is not conflict serializable
  • c)
    a conflict serializable schedule
  • d)
    a schedule for which a precedence graph cannot be drawn
Correct answer is option 'B'. Can you explain this answer?
Verified Answer
Consider the following transactions with data items P and Q initialize...
Let S be a non-serial schedule, without loss of generality assume that T1 has started earlier than T2. The first instruction of T1 is read(P) and the last instruction of T2 is write(P), so the precedence graph for S has an edge from T1 to T2, now since S is a non-serial schedule the first instruction of T2(read(Q)) should be executed before last instruction of T1(write(Q)) and since read and write are conflicting operations, the precedence graph for S also contains an
edge from T2 to T1, So we will have a cycle in the precedence graph which implies that any non serial schedule with T1 as the earliest transaction will not be conflict serializable.
In a similar way we can show that if T2 is the earliest transaction then also the schedule is not conflict serializable.
View all questions of this test
Most Upvoted Answer
Consider the following transactions with data items P and Q initialize...
Explanation:

To determine whether the given non-serial interleaving of T1 and T2 for concurrent execution leads to a schedule that is conflict serializable or not, we need to analyze the dependencies and possible conflicts between the operations in the two transactions.

Step 1: Identify Read and Write Operations
Let's analyze the operations in each transaction:
T1: Read(P), Read(Q), If P=0 then Q:=Q+1, Write(Q)
T2: Read(Q), Read(P), If Q=0 then P:=P+1, Write(P)

Step 2: Identify Conflicting Operations
In order to determine conflict serializability, we need to identify conflicting operations. Conflicts occur when two operations access the same data item and at least one of them is a write operation. In this case, the conflicting operations are:

T1 Write(Q) and T2 Read(Q)
T2 Write(P) and T1 Read(P)

Step 3: Draw Precedence Graph
To determine whether the given schedule is conflict serializable or not, we can draw a precedence graph. The nodes of the graph represent the transactions, and the edges represent the conflicts between the operations. If the graph is acyclic, then the schedule is conflict serializable.

Precedence Graph:
T1 -> T2 (T1 precedes T2)

Step 4: Analyze the Precedence Graph
Since the precedence graph is acyclic, we can conclude that the given non-serial interleaving of T1 and T2 for concurrent execution leads to a schedule that is conflict serializable. Therefore, option B is the correct answer.
Free Test
Community Answer
Consider the following transactions with data items P and Q initialize...
A
Explore Courses for Computer Science Engineering (CSE) exam

Top Courses for Computer Science Engineering (CSE)

Consider the following transactions with data items P and Q initialized to zero:T1 :read (P);read (Q);if P = 0 then Q := Q + 1 ;write (Q).T2 : read (Q);read (P);if Q = 0 then P := P + 1 ;write (P).Any non-serial interleaving of T1 and T2 for concurrent execution leads toa)a serializable scheduleb)a schedule that is not conflict serializablec)a conflict serializable scheduled)a schedule for which a precedence graph cannot be drawnCorrect answer is option 'B'. Can you explain this answer?
Question Description
Consider the following transactions with data items P and Q initialized to zero:T1 :read (P);read (Q);if P = 0 then Q := Q + 1 ;write (Q).T2 : read (Q);read (P);if Q = 0 then P := P + 1 ;write (P).Any non-serial interleaving of T1 and T2 for concurrent execution leads toa)a serializable scheduleb)a schedule that is not conflict serializablec)a conflict serializable scheduled)a schedule for which a precedence graph cannot be drawnCorrect answer is option 'B'. Can you explain this answer? for Computer Science Engineering (CSE) 2024 is part of Computer Science Engineering (CSE) preparation. The Question and answers have been prepared according to the Computer Science Engineering (CSE) exam syllabus. Information about Consider the following transactions with data items P and Q initialized to zero:T1 :read (P);read (Q);if P = 0 then Q := Q + 1 ;write (Q).T2 : read (Q);read (P);if Q = 0 then P := P + 1 ;write (P).Any non-serial interleaving of T1 and T2 for concurrent execution leads toa)a serializable scheduleb)a schedule that is not conflict serializablec)a conflict serializable scheduled)a schedule for which a precedence graph cannot be drawnCorrect answer is option 'B'. Can you explain this answer? covers all topics & solutions for Computer Science Engineering (CSE) 2024 Exam. Find important definitions, questions, meanings, examples, exercises and tests below for Consider the following transactions with data items P and Q initialized to zero:T1 :read (P);read (Q);if P = 0 then Q := Q + 1 ;write (Q).T2 : read (Q);read (P);if Q = 0 then P := P + 1 ;write (P).Any non-serial interleaving of T1 and T2 for concurrent execution leads toa)a serializable scheduleb)a schedule that is not conflict serializablec)a conflict serializable scheduled)a schedule for which a precedence graph cannot be drawnCorrect answer is option 'B'. Can you explain this answer?.
Solutions for Consider the following transactions with data items P and Q initialized to zero:T1 :read (P);read (Q);if P = 0 then Q := Q + 1 ;write (Q).T2 : read (Q);read (P);if Q = 0 then P := P + 1 ;write (P).Any non-serial interleaving of T1 and T2 for concurrent execution leads toa)a serializable scheduleb)a schedule that is not conflict serializablec)a conflict serializable scheduled)a schedule for which a precedence graph cannot be drawnCorrect answer is option 'B'. Can you explain this answer? in English & in Hindi are available as part of our courses for Computer Science Engineering (CSE). Download more important topics, notes, lectures and mock test series for Computer Science Engineering (CSE) Exam by signing up for free.
Here you can find the meaning of Consider the following transactions with data items P and Q initialized to zero:T1 :read (P);read (Q);if P = 0 then Q := Q + 1 ;write (Q).T2 : read (Q);read (P);if Q = 0 then P := P + 1 ;write (P).Any non-serial interleaving of T1 and T2 for concurrent execution leads toa)a serializable scheduleb)a schedule that is not conflict serializablec)a conflict serializable scheduled)a schedule for which a precedence graph cannot be drawnCorrect answer is option 'B'. Can you explain this answer? defined & explained in the simplest way possible. Besides giving the explanation of Consider the following transactions with data items P and Q initialized to zero:T1 :read (P);read (Q);if P = 0 then Q := Q + 1 ;write (Q).T2 : read (Q);read (P);if Q = 0 then P := P + 1 ;write (P).Any non-serial interleaving of T1 and T2 for concurrent execution leads toa)a serializable scheduleb)a schedule that is not conflict serializablec)a conflict serializable scheduled)a schedule for which a precedence graph cannot be drawnCorrect answer is option 'B'. Can you explain this answer?, a detailed solution for Consider the following transactions with data items P and Q initialized to zero:T1 :read (P);read (Q);if P = 0 then Q := Q + 1 ;write (Q).T2 : read (Q);read (P);if Q = 0 then P := P + 1 ;write (P).Any non-serial interleaving of T1 and T2 for concurrent execution leads toa)a serializable scheduleb)a schedule that is not conflict serializablec)a conflict serializable scheduled)a schedule for which a precedence graph cannot be drawnCorrect answer is option 'B'. Can you explain this answer? has been provided alongside types of Consider the following transactions with data items P and Q initialized to zero:T1 :read (P);read (Q);if P = 0 then Q := Q + 1 ;write (Q).T2 : read (Q);read (P);if Q = 0 then P := P + 1 ;write (P).Any non-serial interleaving of T1 and T2 for concurrent execution leads toa)a serializable scheduleb)a schedule that is not conflict serializablec)a conflict serializable scheduled)a schedule for which a precedence graph cannot be drawnCorrect answer is option 'B'. Can you explain this answer? theory, EduRev gives you an ample number of questions to practice Consider the following transactions with data items P and Q initialized to zero:T1 :read (P);read (Q);if P = 0 then Q := Q + 1 ;write (Q).T2 : read (Q);read (P);if Q = 0 then P := P + 1 ;write (P).Any non-serial interleaving of T1 and T2 for concurrent execution leads toa)a serializable scheduleb)a schedule that is not conflict serializablec)a conflict serializable scheduled)a schedule for which a precedence graph cannot be drawnCorrect answer is option 'B'. Can you explain this answer? tests, examples and also practice Computer Science Engineering (CSE) tests.
Explore Courses for Computer Science Engineering (CSE) exam

Top Courses for Computer Science Engineering (CSE)

Explore Courses
Signup for Free!
Signup to see your scores go up within 7 days! Learn & Practice with 1000+ FREE Notes, Videos & Tests.
10M+ students study on EduRev