VOOZH about

URL: https://www.geeksforgeeks.org/dbms/equivalent-serial-schedule-of-conflict-serializable-schedule-in-dbms/

⇱ Equivalent Serial Schedule of Conflict Serializable Schedule in DBMS - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Equivalent Serial Schedule of Conflict Serializable Schedule in DBMS

Last Updated : 23 Jul, 2025

Prerequisite: Conflict Serializability, Precedence Graph

Conflict Serializable Schedule: A schedule is called conflict serializable if it can be transformed into a serial schedule by swapping non-conflicting operations. The serial schedule of the Conflict Serializable Schedule can be found by applying topological Sorting on the Precedence Graph of the Conflict Serializable Schedule.

Note: Precedence Graph of Conflict Serial Schedule is always directed acyclic graph.

Approach: Follow to below steps to find topological sorting of Precedence Graph:

  • Find the indegree of all nodes for the given Precedence Graph and store it in an auxiliary array.
  • Now For each node having indegree 0 perform the following:
    • Print the current node T as the order of the topological sort.
    • Let the node T be the node with in-degree 0.
    • Remove T and all edges connecting to T from the graph.
    • Update indegree of all nodes after the above steps.
  • After the above steps, the topological sort of the given precedence graph can be calculated.

Below is the illustration of the above approach:

Let, the Conflict Serial Schedule be S: R2(A) W2(A) R3(C) W2(B) W3(A) W3(C) R1(A) R2(B) W1(A) W2(B)

👁 Image

  • Here node T2 has indegree 0.
  • So, select T2 and remove T2 and all edges connecting from it.
  • Now T3 has indegree 0. So, select T3 and remove the edge T3→T1.
  • At the end select T3. So the topological Sorting is T2, T3, T1.
  • Hence, the equivalent serial schedule of given conflict serializable schedule is T2→T3→T1, i.e., S2: R2(A) W2(A) W2(B) R3(C) W3(A) W3(C) R1(A) R2(B) W1(A) W1(B).

There may be more than one equivalent serial schedule of the conflict serializable schedule.

Below is the implementation to get the Serial Schedule of CSS using Topological Sorting:


Output: 
Equivalent Serial Schedule is :T2 T3 T1

 

Time Complexity: O(N)
Auxiliary Space: O(N)

Comment

Explore