0% found this document useful (0 votes)
14 views

MODULE V Part 3

1) Concurrency refers to the simultaneous execution of transactions that may access the same database items. It allows for multi-user systems like airline reservation systems. 2) Concurrency control is needed to prevent errors from collisions during concurrent transaction execution. It addresses issues like lost updates, dirty reads, and unrepeatable reads. 3) Interleaved processing involves executing commands from different processes alternately by suspending and resuming processes. Parallel processing uses multiple CPUs to execute transactions simultaneously.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views

MODULE V Part 3

1) Concurrency refers to the simultaneous execution of transactions that may access the same database items. It allows for multi-user systems like airline reservation systems. 2) Concurrency control is needed to prevent errors from collisions during concurrent transaction execution. It addresses issues like lost updates, dirty reads, and unrepeatable reads. 3) Interleaved processing involves executing commands from different processes alternately by suspending and resuming processes. Parallel processing uses multiple CPUs to execute transactions simultaneously.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 16

MODULE V PART 3

At the end of the session you will be able to

● Explain interleaved and parallel execution of


transactions.
● Explain about the need for concurrency control.

2
CONCURRENCY

3
What is Concurrency ?

● Simultaneous execution of transactions, which


may access the same database item.
● Multiuser Systems.
○ Airline reservation systems, Banking,
Stock exchange,Online shopping sites etc.

4
Concurrency Control

● To prevent collisions.
● To prevent errors and inconsistencies in the
database

5
Interleaved &
Parallel
Execution

6
Interleaved Processing
● In multiprogramming operating systems.
● Execute some commands from one process, then
suspend that process and execute some commands
from the next process and so on.
● A process is resumed at the point where it was
suspended whenever it gets its turn to use the
CPU again.

7
Interleaved Processing

8
Parallel Processing

● Multiple CPUs.

9
Need for
Concurrency
Control The Lost Update Problem

The temporary Update or Dirty Read Problem

Incorrect Summary Problem

The Unrepeatable Read Problem

10
Consider the
scenario
An airline reservations database in which a record is
stored for each airline flight.

Each record includes the number of reserved seats on


that flight as a named data item, among other
information.

Figure (a) shows a transaction T1 that transfers N


reservations from one flight whose number of reserved
seats is stored in the database item named X to another
flight whose number of reserved seats is stored in the
database item named Y.

Figure (b) shows a simpler transaction T2 that just


reserves M seats on the first flight (X) referenced in
transaction T1. 11
The Lost Update Problem

Suppose that transactions T1and T2 are submitted at approximately the same time.
T2 reads the value of X before T1 changes it in the database, and hence the updated value resulting from T1 is lost.
For example, if X = 80 at the start ,N = 5 , and M = 4 , the final result should be X = 79.
In the interleaving of operations, it is X = 84 because the update in T1 that removed the five seats from X was lost.

12
The Temporary Update or Dirty Read Problem

T1 updates item X and then fails before completion, so the system must change X back to its original value.
Before it can do so, however, transaction T2 reads the temporary value of X, which will not be recorded permanently in the
database .
The value of item X that is read by T2 is called dirty data because it has been created by a transaction that has not completed
and committed yet

13
The Incorrect Summary Problem

Transaction T3 is calculating the total number of reservations on all the flights; meanwhile,
transaction T1 is executing.
If the interleaving of operations occurs, the result of T3 will be off by an amount N because T3
reads the value of X after N seats have been subtracted from it but reads the value of Y before
those N seats have been added to it. 14
The Unrepeatable Read Problem
A transaction T reads the same item twice and the item is changed by another
transaction T’ between the two reads.

Hence, T receives different values for its two reads of the same item.

For example, if during an airline reservation transaction, a customer inquiries about seat
availability on several flights. When the customer decides on a particular flight, the
transaction then reads the number of seats on that flight a second time before completing the
reservation, and it may end up reading a different value for the item.

15
THANK YOU

16

You might also like