Académique Documents
Professionnel Documents
Culture Documents
Declaration:
Evaluator’s comments:
_______________________________________________
If the scheduler succeeds in setting all of T,‘s locks, then it submits Ti’s operations to
the DM as soon as it receives them. After the DM acknowledges the processing of
T,‘s last database operation, the scheduler may release all of l-j’s locks.
If, on the other hand, an)’ of the locks requested in T,‘s Start
conflicts with locks presently held by other transactions, then the
scheduler does not grant any of T,‘s locks. Instead, it inserts T,
along with its lock requests into a waiting queue. Every time the
scheduler releases the locks of a completed transaction, it examines
the waiting queue to see if it can grant all of the lock requests of
any waiting transactions. If so, it then sets all of the locks for each
such transaction and continues processing as just described.
It states that, if a more recent transaction has already written the value of an object,
then a less recent transaction does not need to have written its change.
For example:
Assuming that the timestamp of T1 is less than that of T2, T1's write is discarded
1. Deadlock Prevention :
2. Deadlock Avoidance :
PART-B
A Lock is a variable associated with each data item hat describes the status of the
item with respec to possible operations hat can be applied to it.The process of
manipulaing the value of locks s called as locking.
binary locks
shared/exlusive locks
Shared mode: denoted by S. if the transcation requires shared lock on any data item
then the ranscation can read but cannot write tht data item.
READ_TS(X) =TS(T)
WRITE_TS(X) =TS(T)
Three phases
Read Phase: In this phase a transcation reads he iems from the database into
it’s the data local variable.
Validation Phase:In this phase validation test is performed to check whether
the updated values of local variables can be copied into the database wihou
causing any inconsencies.
Write Phase: If the validation phase is successful for a transcation then the
database can be updated with the new updated values of local variables.
DEADLOCK AVOIDANCE:
A simple way o detect a state of deadlocks is for the system to construct and
maintain wait-for-graph,
The idea is to maintain two page tables during the life of a transaction: the current
page table and the shadow page table. When the transaction starts, both tables are
identical. The shadow page is never changed during the life of the transaction. The
current page is updated with each write operation. Each table entry points to a page
on the disk. When the transaction is committed, the shadow page entry becomes a
copy of the current page table entry and the disk block with the old data is released. If
the shadow is stored in nonvolatile memory and a system crash occurs, then the
shadow page table is copied to the current page table. This guarantees that the shadow
page table will point to the database pages corresponding to the state of the database
prior to any transaction that was active at the time of the crash, making aborts
automatic.
To commit a transaction :
* Flush all modified pages in main memory to disk.
* Output current page table to disk.
* Make the current page table the new shadow page table, as follows:
1. Keep a pointer to the shadow page table at a fixed (known) location on disk.
2. To make the current page table the new shadow page table, simply update the
pointer to point to current page table on disk.
- Once pointer to shadow page table has been written, transaction is committed.
- No recovery is needed after a crash: New transactions can start right away, using the
shadow page table.
- Pages not pointed to from current/shadow page table should be freed