Files
G4G0-1/Semester 2/Database Systems/Week 5/Week 5 Database Systems.md

69 lines
2.6 KiB
Markdown

# Conflict Serialisability
If a concurrent schedule organises conflicting operations in the same way as a serial schedule, the results are the same.
This is called conflict serialisability, which can be tested using precedence graphs.
## Directed Graph
- ![](Pasted%20image%2020240213131718.png)
- ![](Pasted%20image%2020240213131802.png)
- ![](Pasted%20image%2020240213131815.png)
# Precedence Graph
- Used to determine if a schedule is serialisable.
- It is serialisable if the graph has no cycles.
## Example Using Serial Schedule
- ![](Pasted%20image%2020240213132227.png)
- This schedule is serialisable because the graph is acyclic. ex. No directed cycle.
## Example Using Non-Serial Schedule
- ![](Pasted%20image%2020240213132603.png)
- This schedule is serialisable due to being acyclic.
- It is equivalent due to
- T2 reading the written value of X from T1
- T1 reading the value of X from the database
- T1 is the last transaction to write Y
- T2 is the last transaction to write X
## Example Using Non-Serialisable Schedule
- ![](Pasted%20image%2020240213133455.png)
- This schedule is non-serialisable since the graph is cyclic.
## Example 4
- ![](Pasted%20image%2020240213161136.png)
- Cyclic graph, non serialisable.
# Tutorial Questions: Chapter 28
1. What is a serial schedule?
A serial schedule is an order of operations where each is complete before a new operation starts. Ex. No interleaves operations.
2. Why is a serial schedule considered correct?
Each operation is either successful or aborted before a new operation starts, meaning every operation is correct and the database is consistent.
3. What is a serialisable schedule?
A serialisable schedule is a concurrent schedule with an acyclic precedence graph. The operation is the same as a serial schedule.
4. Why is a serialisable schedule considered correct?
Since the operation is functionally the same as a serial schedule, we can consider it correct.
5. The precedence graph is serialisable since it is acyclic. No directed cycles.
6. T1.1 -> T2.2, T1.2 -> T2.1, T1.2 -> T2.2, T1.2 -> T3.1, T2.2 -> T3.1
- ![](Pasted%20image%2020240213172304.png)
The graph is serialisable since there are no directed cycles.
1. T2.1 -> T1.1, T1.1 -> T2.2, T2.2 -> T1.2
- ![](Pasted%20image%2020240213172509.png)
The graph is not serialisable since there is a directed cycle
1. T1.1 -> T2.1, T1.2 -> T2.1
- ![](Pasted%20image%2020240213172702.png)
The graph is serialisable since there are no directed cycles.
1. T1.1 -> T2.2, T2.1 -> T1.2, T1.2 -> T2.2
- ![](Pasted%20image%2020240213172509.png)
The graph is not serialisable since there are directed cycles