shadow paging wiki

shadow paging wiki

In computer science, shadow paging is a technique for providing atomicity and durability (two of the ACID properties) in database systems. A page in this context refers to a unit of physical storage (probably on a hard disk), typically of the order of 1 to 64 KiB.

Shadow paging is a copy-on-write technique for avoiding in-place updates of pages. Instead, when a page is to be modified, a shadow page is allocated. Since the shadow page has no references (from other pages on disk), it can be modified liberally, without concern for consistency constraints, etc. When the page is ready to become durable, all pages that referred to the original are updated to refer to the new replacement page instead. Because the page is “activated” only when it is ready, it is atomic.

当页要被更改的时候,新开一个页,在这个页上改完之后,原子地替换掉原来的页。就是把对原来页的引用全部指向这个shadow page。

If the referring pages must also be updated via shadow paging, this procedure may recurse many times, becoming quite costly. One solution, employed by the Write Anywhere File Layout (WAFL) file system is to be lazy about making pages durable (i.e., write-behind caching). This increases performance significantly by avoiding many writes on hotspots high up in the referential hierarchy (e.g., a file system superblock) at the cost of high commit latency.

如果记录引用的页也是用shadow page技术实现,那么就可能无穷递归。write-behind caching可以解决这个问题,这通过以高提交延迟为代价避免在引用层次结构(例如,文件系统超级块)中的较高热点上进行多次写入,从而显着提高了性能。主要就是最后搞一下记录引用的页,不要老是一改记录引用指向的元数据就换shadow page。

Write-ahead logging is a more popular solution that uses in-place updates.

Shadow paging is similar to the old master-new master batch processing technique used in mainframe database systems. In these systems, the output of each batch run (possibly a day’s work) was written to two separate disks or other form of storage medium. One was kept for backup, and the other was used as the starting point for the next day’s work.

很像old-new反复切换的技术。

Shadow paging is also similar to purely functional data structures, in that in-place updates are avoided.

熟悉函数式编程的话,会知道not in-place其实就是immutable。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值