


















































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!



















































Until now, our concept of database has been one in
which programs accessing the database are run one
at a time (serially). Often this is indeed the case.
However, there are also numerous applications in
which more than one program, or different
executions of the same program, run simultaneously
(concurrently). This is where TRANSACTION
MANAGEMENT comes in handy
Example #
Statistical database, such as census data, where
many people may be querying the database at
once. Here, as long as no one is changing the
data, we do not really care in what order the
processes read data. We can let the operating
system schedule simultaneous read requests.
Here we want to allow maximum concurrent
operations, so time can be saved
SPEED
Important Terms
Important Terms (cont…)
Two-phase locking protocol -- is a discipline
that transactions can use to ensure serializability.
The first phase is characterized by the monotonic
acquisition of new locks or the strengthening of
existing locks. The second phase involves the
monotonic downgrade or release of existing locks.
This lock is the most important technique for
Important Terms (cont…)
Important Terms (cont…)
Transaction -- is simply a single execution of a
program. This program may be a simple query expressed in one of the query languages or an elaborate host language program with embedded calls to a query language. Several independent executions of the same program may be in progress simultaneously; each is a different transaction
Main Idea
To a large extent, transaction management can be seen as an attempt to make complex operations appear atomic. That is, they either occur in their entirety or do not occur at all, and if they occur, nothing else apparently went on during the time of their occurrence. The normal approach to ensuring atomicity of transactions is ‘serialization’, which forces transactions to run concurrently in a way that makes it appear that they ran one-at-a-time (serially).
Items
Locks
The most common way in which access to items is controlled is by “locks.” Lock manager is the part of a DBMS that records, for each item I, whether one or more transactions are reading or writing any part of I. If so, the manager will forbid another transaction from gaining access to I, provided the type of access (read or write) could cause a conflict, such as the duplicate selling of an airline seat.
Example of locks
Example of locks (cont…)
The most common solution to this problem is to provide a lock on A. Before reading A, a transaction T must lock A, which prevents another transaction from accessing A until T is finished with A. Furthermore, the need for T to set a lock on A prevents T from accessing A if some other transaction is already using A. T must wait until the other transaction unlocks A, which it should do only after finishing with A.