What is shadow paging in DBMS?

Shadow paging is one of the techniques that is used to recover from failure. We all know that recovery means to get back the information, which is lost. It helps to maintain database consistency in case of failure.

Concept of shadow paging

Now let see the concept of shadow paging step by step −

  • Step 1 − Page is a segment of memory. Page table is an index of pages. Each table entry points to a page on the disk.

  • Step 2 − Two page tables are used during the life of a transaction: the current page table and the shadow page table. Shadow page table is a copy of the current page table.

  • Step 3 − When a transaction starts, both the tables look identical, the current table is updated for each write operation.

  • Step 4 − The shadow page is never changed during the life of the transaction.

  • Step 5 − When the current 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.

  • Step 6 − The shadow page table is stored in non-volatile memory. If the system crash occurs, then the shadow page table is copied to the current page table.

The shadow paging is represented diagrammatically as follows −


The advantages of shadow paging are as follows −

  • No need for log records.
  • No undo/ Redo algorithm.
  • Recovery is faster.


The disadvantages of shadow paging are as follows −

  • Data is fragmented or scattered.

  • Garbage collection problem. Database pages containing old versions of modified data need to be garbage collected after every transaction.

  • Concurrent transactions are difficult to execute.