Database Systems the Complete book 阅读笔记 chapter 13

本文详细介绍了磁盘的机械结构,包括组成层级和大型2008年硬盘的具体参数。讨论了磁盘控制器在访问延迟、寻道时间、旋转延迟和传输时间上的角色。接着,提出了加速访问二级存储的方法,如将常用块放在一起以减少寻道时间,使用多磁头独立访问的小型磁盘,镜像磁盘以提高并发访问,并通过磁盘调度算法和预取技术优化性能。此外,文章还涉及了磁盘故障类型及校验和在恢复中的应用,特别讨论了RAID 1、4、5和6的不同层次和功能,以应对磁盘故障。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

## 13.2 Disk

# 13.2.1 Mechanics of Disk: 首先给出一副Disk的结构图

- 

- 组成结构的顺序是:disk --> platter --> surface --> track --> block -->sector --> byte\

          对于 large vintage-2008 disk 来说: 1 disk --> 1*8 platter --> 1*8*2 surface -->1*8*2*2^16 track -->1*8*2*2^16*64 block -->1*8*2*2^16*64*4 sector -->1*8*2*2^16*64*4*2^12 byte

# 13.2.2 The Disk Controller

- Accessing (reading or writing) delay

- seek time : 探针定位到cylinder

- rotational latency: 定位到该cylinder的第一个sector

- transfer time: 读写进行时的时间消耗

- 时间消耗比:seek time > rotational latency > transfer time

## 13.3 Accelerating Access to Secondary Storage , 加速到外部存储区的访问

1. Place blocks that are accessed together on the same cylinder, so we can often avoid seek time, and possibly rotational latency as well.

2. Divide the data among several smaller disks rather than one large one. Having more head assemblies that can go after blocks independently can increase the number of block accesses per unit time.

3. “Mirror” a disk: making two or more copies of the data on different disks. In addition to saving the data in case one of the disks fails, this strategy, like dividing the data among several disks, lets us access several blocks at
once.

4. Use a disk-scheduling algorithm, either in the operating system, in the DBMS, or in the disk controller, to select the order in which several requested blocks will be read or written.

- 书里面提到了一些列的算法,如磁盘调度算法比First in First serve 好在那个,这些就不写了。

5. Prefetch blocks to main memory in anticipation of their later use.


## 13.4 Disk Failures

- intermittent failure :间断错误,重新读写

- media decay : 媒体损坏,某些sector无法读取

- write failure:断电导致的写了一半另一半没办法写下去

- disk crash:最严重的整个disk crash

# 13.4.2 Checksums

# 13.4.5 Recovery from Disk Crashes

- RAID 1 

- 作用:解决一个disk crash

  - 实现方式:每个data disk 有一个redundancy,一个crash另一个过去

- RAID 4

- 作用:解决一个disk crash

- 实现:可以几个data disk 对一个 redundancy,图片说明如下:

                 上述 disk 4 是modolu-2 运算后的redundancy disk

- 缺点:每次update需要多次计算和更新多个disk的值,不能处理多个disk crash的情况

- RAID 5

- RAID4 之上对于计算和更新多个disk的值得一种提升。细节没具体看。

- RAID 6

- 作用:能够同时解决两个disk crash的错误

- 实现方法:如果有4个data disk 则有 3个redundancy。

- 图片说明:(运算方式:异或)

                  

- 关于data disk 和 redundant disk的数量关系:

           

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值