CONCURRENCY AND SCHEDULING Flashcards

1
Q

What is concurrency?

A

Multiple transactions are allowed to run simultaneously in the system

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

What are the advantages of using concurrency?

A

Increased processor and disk utilization: leading to better transaction throughput. One transaction can be using the CPU while another transaction reads from the disk.

Reduced average response time for transactions: Short transactions need not to wait for long ones

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

What are the expectations of concurrency control?

A

Isolation is maintained: Users must be able to execute each transactions as if they were the only user.
DBMS handles the details of interleaving various TXNs

Consistency is maintained: Transactions must leave the DB in a consistent state
DBMS handles the details of enforcing integrity constraints

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

What problems can be caused by concurrency?

A

Dirty Read/ Reading Uncommitted data
Lost update problem
Inconsistent analysis problem

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

Describe dirty read

A

Occurs because of a WriteRead conflict
It occurs when one transaction is allowed to see the intermediate results of another transaction before it is committed.

*See doc for pic

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

What is dirty data?

A

Data written by an uncommitted transaction due to system failure or rollback

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

Describe the lost update problem

A

Occurs because of a Write Write conflict
An apparently successfully completed update operation by one user can be overridden by another user.

*See notes for pic

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

Describe the inconsistent analysis problem

A

Occurs when a transaction reads several values form the database but a second transaction updates some of them during the execution of the first.

*See notes for pic

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

What is a schedule?

A

Sequences that indicate the order in which instructions of concurrent transactions are executed

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

What is a serial schedule?

A

A schedule where one transaction executes fully before the next transaction starts.
A serial schedule is one that does not interleave the actions of different transactions

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

What is a non-serial schedule?

A

A schedule where two transactions are interleaved

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

What situations may lead to the interleaving of transactions?

A

Individual Transactions might be slow- don’t want to block other users during execution

Disk access may be slow- let some transactions use CPUs while others accessing disk!

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

What is the prerequisite for interleaving transactions?

A

DBMS must pick an interleaving or schedule such that isolation and consistency are maintained

Must be as if the transactions had executed serially!

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

When is a schedule said to be not serializable?

A

An interleaved schedule is said to be not serializable if it gives different results from any serial schedule

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

What are equivalent schedules?

A

A and B are equivalent schedules if, for any database state, the effect on DB of executing A is identical to the effect of executing B

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

What is a serializable schedule?

A

A serializable schedule is a schedule that is equivalent to some serial execution of the transactions

17
Q

What is concurrency control?

A

The general process of ensuring that transactions preserve consistency, when executing simultaneously.
Interactions among concurrently executing transactions, can cause the database to become inconsistent, even when there is no system failure.
Thus, the timings of different transactions need to be regulated in some manner.

18
Q

What are the two main approaches to concurrency control?

A

Pessimistic approach: Locks

Optimistic Approach: Timestamps, multi-version, validation

19
Q

What is concurrency control

A

Concurrency control: The process of managing simultaneous operations on the database without having them interfere with one another.