![]() |
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:
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)
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: C++
Java
Python3
C#
Javascript
Output:
Equivalent Serial Schedule is :T2 T3 T1
Time Complexity: O(N) |
Reffered: https://www.geeksforgeeks.org
Graph |
Type: | Geek |
Category: | Coding |
Sub Category: | Tutorial |
Uploaded by: | Admin |
Views: | 15 |