vault backup: 2024-02-27 16:57:07

This commit is contained in:
2024-02-27 16:57:07 +00:00
parent 489895a046
commit 8f7a395bdb
24 changed files with 614 additions and 30 deletions

View File

@@ -64,3 +64,38 @@ Similarly to the previous issue, we can solve this by locking T3 until the data
- ![](Pasted%20image%2020240220132521.png)
We can solve this issue by locking the data items appropriately. By write locking balx and balz in T5, T6 must wait to modify or read any data from either of these data items to preserve consistency.
- ![](Pasted%20image%2020240220132550.png)
# Tutorial
1. .
1. Locks are used to preserve database consistency by disallowing reads and / or writes.
2. Locks are implemented by requiring transactions to request locks before reading or updating an item.
3. An exclusive lock is a write lock, restricting read and write access of the database item to the transaction that requested it.
4. An exclusive lock is granted if no other lock is currently in effect on a data item.
2. .
1. False, a durable transaction is where all changes to data are persistent, even through power loss or system failure. The statement is an example of atomicity.
2. True
3. True
4. False, mutual blocking of data access in 2PL causes a deadlock
3. .
1. .
| Time | Transaction 1 | Transaction 2 | balance |
| ---- | ---- | ---- | ---- |
| t1 | begin | | 100 |
| t2 | read_lock( balance ) | | 100 |
| t3 | read( balance ) | | 100 |
| t4 | balance:=balance-60 | begin transaction | 40 |
| t5 | … | wait | 40 |
| t6 | abort, rollback. <br>Release lock ( balance ) | wait | 100 |
| t7 | | read_lock( balance ) | 100 |
| t8 | | read( balance ) | 100 |
| t9 | | balance:=balance-10 | 90 |
| t10 | | write( balance ) | 90 |
| t11 | | commit.<br>Release lock ( balance ) | 90 |
# Laboratory
1. ![](Pasted%20image%2020240223101502.png)
2. ![](Pasted%20image%2020240223101441.png)
3. ![](Pasted%20image%2020240223102417.png)
4. ![](Pasted%20image%2020240223102717.png)