Concurrency Flashcards

1
Q

Definition of transaction

A

Is a sequence of actions that are executed on a shared database to perform some higher-level function
-> basic unit of change in the DBMS

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

ACID

A
  • Atomicity
  • Consistency
  • Isolation
  • Durability: effects after commit persist
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Definition Schedule

A
  • DBMS gets as input a set of transactions and executes a schedule
    -> gets list of actions from a set of transactions (must appear in the same order as in the transaction
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Types of Schedules

A
  • Serial schedule: Schedule that does not interleave the actions of different transactions
  • Equivalent schedules: For any database state, the effect (on the set of objects in the database) of executing the first schedule is identical to the effect of the executing the second schedule
  • Serializable schedule: A schedule that is equivalent to some execution of the transaction
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

2PL / Strict 2PL

A
  • Rule 1: Each transaction obtains a shared lock before reading and an exclusive lock before writing
  • Rule 2: A transaction cannot request additional locks once it releases any locks (not serializable!)
  • Strict 2PL:
    -> Rule 3: All locks released when the transaction aborts
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Deadlocks

A
  • Cycle of transactions waiting for locks to be released by each other
    -> Deadlock detection: Create waits-for-graph and check for cycles
    -> Deadlock prevention: Transactions are assigned priorities based on timestamps (Wait-Die, Wound-wait)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Kung-Robinson Model

A
  • Optimistic approach
  • Key idea: Timestamp ordering is imposed on transactions, and validation phase checks that all conflicting actions occurred in the same order
  • If this is not the case, abort the transaction that started later
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Validation steps

A
  1. For all I and j such that Ti < Tj, check that Ti completes before Tj begins
  2. […] Ti completes before Tj begins its Write phase AND the intersection of WriteSet(Ti) and ReadSet(Tj) is empty
  3. Intersection of WriteSet(Ti) and WriteSet(Tj) is empty
How well did you know this?
1
Not at all
2
3
4
5
Perfectly