6. Concurrency Flashcards

1
Q

Lock-Based Protocols
1- ___ (X) mode
2- ___(S) mode

A

Exclusive

Shared

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

Exclusive (X) mode

Data item can be both ___. X-lock is requested using lock-X instruction.

A

Read and written

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

Shared (S) mode

Data item can only be ___. S-lock is requested using lock-S instruction.

A

Read

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

Deadlock

Happens when at least two ___ want the lock of ___

A

Transactions

Each other

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

Starvation

Transaction needs to rollback beacause other transactions are constantly getting the desired ___

A

Lock

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

Two-Phase Locking Protocol
1- ___ phase - ___obtain / ___ release Locks
2- ___ phase - ___ Obtain / ___release Locks

A

Growing / Can, Can’t

Shrinking Can’t, Can

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

Graph-Based Protocols

A lock can only be obtained if the ___ lock is already obtained by the ___ transaction. We can’t ___unlocked items

A

Parent
Same
Re-lock

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

Deadlock prevention protocols
Ensure that the system does not enter into a ___ state. Some prevention strategies:
1- Require that the transaction locks ___ before executing
2- ___ all data items and only allow locking in that ___

A

Deadlock
Everything
Order

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

Wait-die scheme
Order transactions ___ while younger transactions ___
Wound-wait
Older transactions force younger ones to ___
Younger transactions ___
Timeout-based
Wait for only a specified amount of time then is ___

A
Wait 
Rollback
Rollback
Wait
Rollback
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q
Deadlock Detection (Wait-for graph)
The system is in a deadlock state if and only if the wait-for graph has a \_\_\_.
A

Cycle

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

Intention Lock Modes
1- ___ (IS) - ___ locks at lower levels of tree
2- ___ (IX) - ___ or ___ locks at lowers level of the tree
3- ___ (SIX) - a ___ lock, with the possibility of
having exclusive or shared locks at lower levels of the tree.

A

1- Intention-shared / Shared
2- Intention-exclusive / Exclusive or shared
3- Shared and intention-exclusive / Shared

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

Multiple Granularity Locking Scheme
Before requesting IS or S lock, all ancestors nodes must be locked in ___
Before requesting IX, SIX or X lock, all ancestors nodes must be locked in ___
Leaf nodes are always locked in __, since they have no descendants
Locks are acquired in ___ oder
Locks are released during transaction in ___ order or at the end in ___ order
Cannot ___ locks

A
IS or IX
IX or SIX
S or X
Root-to-leaf
Leaf-to-root / any
Reacquire
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Timestamp Ordering
Read needs to take ___ time than largest ___ time saved, otherwise save new read time
Write needs to take ___ time than largest ___ and ___ time saved, otherwise save new ___ time

A
More
Write 
More 
Read and Write
Write
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Multiversion Timestamp Ordering

Equal to Timestamp ordering but we access version Qk that has the ___ W-Timestamp

A

Largest

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

Snapshot Isolation

  • Each transaction is given its own ___ of the database
  • Updates are kept in the snapshot until the transaction ___
  • Reqad Request never __ or ___
A

Snapshot
Commits
Wait or fail

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

Validation Steps in Snapshot Isolation
1- ___ wins - first concurrent transaction to commit
2- ___ wins - first concurrent transaction to get the lock to the item

A

First Commiter

First Updater

17
Q

Serializable snapshot isolation (SSI)
A transaction is rolled back when it has both an incoming ___ conflict and an outgoing ___ conflict (almost like a cicle in theory)

A

read-write

read-write