Example: main memory, cache Nonvolatile storage Information usually survives crashes – Example: disk and tape Stable storage Information never lost – Not actually possible, so approximated via replication or RAID to devices with independent failure modes Goal is to assure transaction atomicity failures cause loss of information on volatile storage Recovery Record to stable storage information about all modifications by a transaction Most common is logging Log on stable storage, each log record describes single transaction write operation, including name Transaction item name Data value Old value New <Ti starts> written to log when transaction Ti starts <Ti commits> written when Ti commits Log must reach stable storage before operation on data occurs Log-Based Recovery Algorithm errors Using the log, system can handle any volatile memory Undo(Ti) restores value of all data updated by Ti Redo(Ti) sets values of all data in transaction Ti to new values Undo(Ti) and redo(Ti) must be idempotent Multiple executions must have the same result as one execution If system fails, restore state of all updated data via log If log contains <Ti starts> without <Ti commits>, undo(Ti) If log contains <Ti starts> and <Ti commits>, redo(Ti)
Example: main memory, cache Nonvolatile storage – Information usually survives crashes Example: disk and tape Stable storage – Information never lost Not actually possible, so approximated via replication or RAID to devices with independent failure modes Goal is to assure transaction atomicity failures cause loss of information on volatile storage Recovery Record to stable storage information about all modifications by a transaction Most common is logging Log on stable storage, each log record describes single transaction write operation, including Transaction name Data item name Old value New value <Ti starts> written to log when transaction Ti starts <Ti commits> written when Ti commits Log must reach stable storage before operation on data occurs Log-Based Recovery Algorithm Using the log, system can handle any volatile memory errors Undo(Ti) restores value of all data updated by Ti Redo(Ti) sets values of all data in transaction Ti to new values Undo(Ti) and redo(Ti) must be idempotent Multiple executions must have the same result as one execution If system fails, restore state of all updated data via log If log contains <Ti starts> without <Ti commits>, undo(Ti) If log contains <Ti starts> and <Ti commits>, redo(Ti)
OS-UNIT-3.docx