CSE200 HW4 Dbms
CSE200 HW4 Dbms
PART-1
(PDF file)
Q3.Using a suitable example justify how strict two phase locking can lead to deadlock?
Ans :
Do with ppt and pdf file……in this folder………..
PART-2
Ans :
Rollback:
This is used for undoing the work done in the current transaction. This command also
releases the locks if any hold by the current transaction. The command used in SQL for this
is simply:
ROLLBACK;
Savepoint:
This is used for identifying a point in the transaction to which a programmer can later roll
back. That is it is possible for the programmer to divide a big transaction into subsections
each having a savepoint defined in it. The command used in SQL for this is simply:
SAVEPOINT savepointname;
For example:
UPDATE…..
DELETE….
SAVEPOINT e1;
INSERT….
UPDATE….
SAVEPOINT e2;
……
It is also possible to define savepoint and rollback together so that programmer can achieve
rollback of part o a transaction. Say for instance in the above
Commit:
This is used to end the transaction and make the changes permanent. When commit is
performed all save points are erased and transaction locks are released. In other words
commit ends a transaction and marks the beginning of a new transaction. The command
used in SQL for this is simply:
COMMIT;
Or
Ans :
Whether the consumer uses immediate or deferred update mode depends on how many
consumers share the rowset and how they use the rowset. In most cases, the primary user of
immediate update mode is a single consumer that wants to transmit changes immediately to the
data store. Consumers use deferred update mode for many reasons, including the following:
• Shared rowsets — If multiple consumers share a rowset, they often use notifications to
coordinate multiple changes. By using deferred update mode, consumers can coordinate
their changes locally in the rowset before transmitting them to the data store.
• Multiple changes to the same row — If a consumer makes multiple changes to the same
row, such as when multiple accessors are used or when users input changes at different
times, the row might be left in an invalid state. For example, if a key consists of several
columns and each column is changed in a separate call to IRowsetChange::SetData, the
intermediate states might be invalid. By using deferred update mode, the consumer can
buffer these changes in the rowset before transmitting them to the data store.
• Network traffic — If a rowset resides on one node in a network and the data store
resides on another node, transmitting changes from the rowset to the data store requires a
network call. By using deferred update mode, the consumer can batch changes to
multiple rows and send them across the network with a single call to
IRowsetUpdate::Update. This is particularly critical for wide area networks such as the
Internet, on which network calls are very expensive.
• Undoing changes — IRowsetUpdate::Undo enables the consumer to undo pending
changes. By using deferred update mode, consumers can expose an undo capability to
users without having to implement it.
OR
Before commit
After commit
Ans :
Q6.Using an example Justify why the Undo Pass of recovery procedure is Performed in
the backward direction and Redo Pass is performed in the forward direction?