Transactions and concurrency
הוצג
מילון מונחים
| English | משמעות |
|---|---|
| transaction/trænˈsækʃn/ | transaction |
| atomicity | atomicity |
| consistency | consistency |
| isolation/ˌaɪsəˈleɪʃn/ | isolation |
| durability | durability |
| serializability | serializability |
| two-phase locking | two-phase locking |
| isolation levels | isolation levels |
English
All or nothing
- A transaction is all-or-nothing, and ACID names the four promises: atomicity (all or nothing), consistency (constraints keep true), isolation (interleaving looks serial), durability (commits survive the crash).

{exercise:uni-cs0805-acid}
אימונים
The A in ACID stands for —
רמת קושי 1/5 · 100 מטבעות + בונוס קטן בהשלמה הראשונה היום
All or nothing: the transaction commits completely or not at all.
English
The lost update, bank edition
- T1 reads 100, T2 reads 100, T1 writes 90, T2 writes 120: the 10-unit withdrawal vanished — the same race as unit 7.3, now with money.
R1(A) R2(A) W2(A) W1(A)ends 90 with T2's deposit lost;R1(A) W1(A) R2(A) W2(A)ends 110 — equal to serial T1-then-T2. Serializability means: equal to some serial order.
{exercise:uni-cs0805-schedule}
אימונים
R1(A) R2(A) W2(A) W1(A) from 100 with -10/+20 ends —
רמת קושי 1/5 · 100 מטבעות + בונוס קטן בהשלמה הראשונה היום
T1 writes last from its stale read: 100 - 10 = 90, the deposit lost.
English
Locks and levels
- Two-phase locking: reads and writes lock, locks held to commit — one transaction waits and the outcome equals a serial order. Deadlock is the price: the detector kills a victim, which retries.
- Isolation levels name the anomalies you accept: read-uncommitted allows dirty reads (T2 sees T1's uncommitted 90 that later rolls back); read-committed removes them; repeatable-read stabilises re-reads; serializable removes phantoms. Keep transactions short — locks held through user input are deadlock bait.
{exercise:uni-cs0805-levels}
אימונים
Reading another transaction uncommitted rollback requires fixing to at least —
רמת קושי 1/5 · 100 מטבעות + בונוס קטן בהשלמה הראשונה היום
Read-committed shows only committed data - the dirty read ends there.