69 lines
2.6 KiB
Markdown
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
|
|
|
|
- 
|
|
- 
|
|
- 
|
|
|
|
# Precedence Graph
|
|
|
|
- Used to determine if a schedule is serialisable.
|
|
- It is serialisable if the graph has no cycles.
|
|
|
|
## Example Using Serial Schedule
|
|
|
|
- 
|
|
- This schedule is serialisable because the graph is acyclic. ex. No directed cycle.
|
|
|
|
## Example Using Non-Serial Schedule
|
|
|
|
- 
|
|
- 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
|
|
|
|
- 
|
|
- This schedule is non-serialisable since the graph is cyclic.
|
|
|
|
## Example 4
|
|
|
|
- 
|
|
- 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
|
|
- 
|
|
The graph is serialisable since there are no directed cycles.
|
|
|
|
1. T2.1 -> T1.1, T1.1 -> T2.2, T2.2 -> T1.2
|
|
- 
|
|
The graph is not serialisable since there is a directed cycle
|
|
|
|
1. T1.1 -> T2.1, T1.2 -> T2.1
|
|
- 
|
|
The graph is serialisable since there are no directed cycles.
|
|
|
|
1. T1.1 -> T2.2, T2.1 -> T1.2, T1.2 -> T2.2
|
|
- 
|
|
The graph is not serialisable since there are directed cycles
|