concurrency control Flashcards

(36 cards)

1
Q

concurrency control

A

the process of managing simultaneous operations on the database without having them interfere with one another

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

concurrency control prevents

A

interference when two or more users are accessing database simultaneously and at least one is updating data

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

although two transactions may be correct in themselves,

A

interleaving of operations may produce an incorrect result

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

three examples of potential problems caused by concurrency

A

lost updates, uncommitted data, inconsistent retrievals

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

lost update problem

A

occurs when a successfully completed update is overwritten by another transaction

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

uncommitted data problem

A

occurs when one transaction accesses the intermediate results of another transaction before they are committed, and the second transaction is then rolled back

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

lost update example

A

T1 withdraws $10 from 100
T2 deposits 100 into same account
incorrectly overlapping transactions may lead to final balance of $90, with T2’s update being lost

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

inconsistent retrievals problem

A

occurs when a transaction reads several values, but a different transaction updates some of them in the midst of this process

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

inconsistent retrievals example

A

T6 is totaling 3 account balances. T5 is also transferring $10 from acc x to acc z after x is totaled but before z is, so T6 has a result that is $10 too high

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

serializable schedule

A

a schedule of a transaction’s operations in which the interleaved execution of all active transactions yields the same results as if those transactions were executed in serial order

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

because waiting for one transaction to finish before starting any others may be inefficient, the built-in scheduler ensures

A

efficient use of the DBMS and CPU by interleaving operations when possible. if transactions access unrelated data, there is no conflict among their operations

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

methods for scheduling conflicting operations in concurrent transactions

A

locking methods, timestamping

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

lock granularity

A

refers to the size of the locked resource

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

scale for size of locked resource

A

database-level -> table-level -> page-level -> row-level

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

database-level means ______, while row-level means ______

A

slow data access, significant overhead

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

an exclusive lock

A

prohibits other users from reading the locked resource

17
Q

a shared lock

A

allows other users to read the locked resource, but they cannot update it

18
Q

optimistic locking assumes that

A

no transaction conflicts will occur

19
Q

with optimistic locking, DBMS processes

A

a transaction to a temporary file and checks whether conflict occurred. if not, transaction finished. if so, the transaction is repeated until there is not conflict.

20
Q

optimistic locking is acceptable for applications with

A

few update operations

21
Q

pessimistic locking assumes that

A

conflicts will occur

22
Q

with pessimistic locking, locks are issued

A

before a transaction is processed, and then the locks are released

23
Q

two-phase locking (2PL)

A

guarantees serializability

24
Q

T/F: 2PL is one of the most common techniques used to achieve serializability

25
growing phase 2PL
transactions are allowed to obtain as many locks as necessary
26
shrinking phase 2PL
once the first lock is released, no additional locks can be obtained
27
two-phase locking doesn't prevent
deadlocks
28
deadlock
an impasse that may result when two (or more) transactions are waiting for locks held by the other to be released
29
3 basic techniques for controlling deadlocks
deadlock prevention, deadlock detection, deadlock avoidance
30
deadlock prevention
abort a transaction if possibility of deadlock, reschedule transaction for later execution
31
deadlock detection
DBMS periodically tests database for deadlocks. if found, one transaction ('victim') is rolled back
32
deadlock avoidance
transactions obtain all needed locks before execution
33
timestamp
a unique identifier created by DBMS that indicates the relative starting time of a transaction
34
transactions are ordered globally so that
older transactions with smaller timestamps get priority in the event of conflict
35
timestamp conflict is resolved by
rolling back and restarting the associated transaction - no locks, so no deadlocks
36
timestamping demands
a lot of system resources (both memory and processing overhead)