Sei sulla pagina 1di 3

Tutorial 10 Questions

1. Explain what is meant by a transaction. Why are transactions important


units of operation in a DBMS?

Answer: A transaction is a logical unit of work on the database. It can be an


entire program, a part of a program, or a single statement such as 'INSERT' or
'UPDATE'. In the database context, the execution of an application program can
be though of as one or more transactions with non database processing taking
place in between.

2. The consistency and reliability aspects of a transaction are due to the


'ACIDity' properties of transactions. Discuss each of these properties and how
they relate to the concurrency control and recovery mechanism. Give examples
to illustrate your answer.

Answer:

• Atomicity- Either the effects of all or none of its operations remain when a
transaction is completed (committed or aborted respectively). In other words,
to the outside world a committed transaction appears to be indivisible, atomic.
A transaction is an indivisible unit of work that is either performed in its entirety
or not performed at all ("all or nothing" semantics).
• Consistency- Every transaction must leave the database in a consistent state,
i.e., maintain the predetermined integrity rules of the database (constraints
upon and among the database's objects). A transaction must transform a
database from one consistent state to another consistent state.

• Isolation- Transactions cannot interfere with each other. Moreover, an


incomplete transaction is not visible to another transaction. Providing isolation
is the main goal of concurrency control.

• Durability- Effects of successful (committed) transactions must persist through


crashes.
3. Describe, with examples, the types of problems that can occur in a multi-user
environment when concurrent access to the database is allowed.

Answer: When two users are accessing the database simultaneously and at least
one is updating data, there ma be interference that can result in consistencies.

Although two transactions may be perfectly correct in themselves, the interleaving


of the operation in this way may produce an incorrect result, thus compromising
the integrity and consistency of the database. Types of problems include ' lost
update system', ' uncommitted dependency problem', ' inconsistent analysis
problem'.

4. Discuss the types of failure that may occur in a database environment?

Answer :

The lost update problem : An apparent successful completed update operation by


one user can be overridden by another user.

The uncommitted dependency: Occurs when one transaction is allowed to see the
intermediate results of another transaction before it has been committed.

The inconsistent analysis problem : Occurs when a transaction reads several


values from the database but the second transaction updates some of them during
the execution of the first.

5. The lost update problem : Tran T1 and T2 start nearly the same time, both read
the balance as $100. T2 increases balx by $100 to $200 and stored the update in
the database. Meanwhile, Transaction T1 decrements its cop of balx by $10 to $90
and stores this value in the database, overwriting the previous update, thereby
losing the $100 previously added to the balance.

6. The uncommitted dependency problem: T4 updates balx to $200, but it aborts


the transaction so that balx, should be restored to its orginal value of $100.
However, by this time T3 has read the new balx ($200) and is using the value as
the basis of the $10 reduction, giving a new incorrect balance of $190 instead of
$90.
7.

8. nonconflict serializable schedual:

Potrebbero piacerti anche