In this article, we will discuss Shadow Paging in DBMS.
Shadow Paging is a recovery technique that provides atomicity and durablity in database system.
It does not require the use of log in a single user environment. However, a multiuser environment requires log for concurrency control.
Shadow Paging maintains 2 page table. A current page table and shadow page table.
When a transaction begins, all the entries of the current page table are copied to the shadow page table. In simple words, the ith entry of the current page table and shadow page table points to the same address or data.
When a page is to be modified, a new page that is the copy of the page to be modified is written somewhere else in the memory and then it is modified. The old copy of the page is not modified. The entries of the current page table are modified to point to the newly created page. The shadow page table always points to the old unmodified pages.
In simple words, the old pages are referenced by the shadow page table and pages that have been modified are referenced by the current page table.
To recover from any failure during the transaction, it is sufficient to free all the modified pages and discard the current page table. Old unmodified data is available through the shadow page table.
If the transaction is performed successfully, the entries of the shadow page table are discarded and the current page table is again copied to the shadow page table.
This technique is classified as NO-UNDO/NO-REDO.