Question: Compare the shadow paging recovery scheme with the log-based recovery schemes in terms of ease implementation and overhead cost.

Shadow paging: It considers the database to be made up of a number of fixed size disk pages. A directory with n entries is constructed, where the enter image description here entry points to the enter image description here database page on disk. The directory is kept in main memory if it is not too large & all read & write references, to the database pages on disk go through it. When a transaction begin executing, the current directory, whose entries point to the most recent or current database pages on disk, is copied into a shallow directory the shadow directory is then saved on disk while the current directory is used by the transaction. During transaction execution the shadow directory is never modified when a write_item operation is performed, a new copy of the modified database page is not overwritten. Instead, the new page is written elsewhere, on same previously unused disk block. The current directory entry is modified to point the new disk block, whereas the shadow directory is not modified & continues to the point to the old unmodified disk block.

Log Based Recovery: It is one of the most widely used structure for database modifications recording is the log. Log can be defined as a sequence of log records, recording all the update activities in the database. Log record contains various fields such as transaction identifier, data item identifier, old value & new value. Whenever a transaction performs a write ,it is essential that the log record for that write be created before the database is modified. Once a log record exists, we can output the modification to the database if that is desirable. Also, we have the ability to undo a modification that has already been output to the database. We undo it by using the old-value field in log records.

Comparison: In terms of overhead cost: in Shadow paging system, the overhead of log-record output is eliminated & the recovery from crashes is significantly faster since no undo or redo operations are needed.

In terms of implementation: All logs are written on to the stable storage & the database is updated when a transaction commits, thus implementation is not easy as compared to Shadow paging recovery.

enter image description here

mumbai university (mu) • 38 views
written 4 months ago by gravatar for Vighnesh Iyer Vighnesh Iyer0
Please log in to add an answer.