操作系统导论OSTEP 第38章作业答案 廉价冗余磁盘阵列(RAID)

问题1

linux.> ./raid.py -R 20 -n 5 -L 5 -s 1 -5 LS -c
ARG blockSize 4096
ARG seed 1
ARG numDisks 4
ARG chunkSize 4k
ARG numRequests 5
ARG reqSize 4k
ARG workload rand
ARG writeFrac 0
ARG randRange 20
ARG level 5
ARG raid5 LS
ARG reverse False
ARG timing False

LOGICAL READ from addr:2 size:4096
  read  [disk 2, offset 0]   
LOGICAL READ from addr:15 size:4096
  read  [disk 3, offset 5]   
LOGICAL READ from addr:9 size:4096
  read  [disk 1, offset 3]   
LOGICAL READ from addr:13 size:4096
  read  [disk 1, offset 4]   
LOGICAL READ from addr:1 size:4096
  read  [disk 1, offset 0]   
  
linux.> ./raid.py -R 20 -n 5 -L 5 -s 1 -5 LA -c
ARG blockSize 4096
ARG seed 1
ARG numDisks 4
ARG chunkSize 4k
ARG numRequests 5
ARG reqSize 4k
ARG workload rand
ARG writeFrac 0
ARG randRange 20
ARG level 5
ARG raid5 LA
ARG reverse False
ARG timing False

LOGICAL READ from addr:2 size:4096
  read  [disk 2, offset 0]   
LOGICAL READ from addr:15 size:4096
  read  [disk 0, offset 5]   
LOGICAL READ from addr:9 size:4096
  read  [disk 1, offset 3]   
LOGICAL READ from addr:13 size:4096
  read  [disk 1, offset 4]   
LOGICAL READ from addr:1 size:4096
  read  [disk 1, offset 0]

可见左对称和左不对称布局之间有区别。

问题2

linux.> ./raid.py -R 20 -n 5 -L 0 -s 1 -c -C 8k
ARG blockSize 4096
ARG seed 1
ARG numDisks 4
ARG chunkSize 8k
ARG numRequests 5
ARG reqSize 4k
ARG workload rand
ARG writeFrac 0
ARG randRange 20
ARG level 0
ARG raid5 LS
ARG reverse False
ARG timing False

LOGICAL READ from addr:2 size:4096
  read  [disk 1, offset 0]   

LOGICAL READ from addr:15 size:4096
  read  [disk 3, offset 3]   

LOGICAL READ from addr:9 size:4096
  read  [disk 0, offset 3]   

LOGICAL READ from addr:13 size:4096
  read  [disk 2, offset 3]   

LOGICAL READ from addr:1 size:4096
  read  [disk 0, offset 1]

-C值只能是4096的倍数。

问题3

linux.> ./raid.py -R 20 -n 5 -L 0 -s 1 -C 8k -r -c
ARG blockSize 4096
ARG seed 1
ARG numDisks 4
ARG chunkSize 8k
ARG numRequests 5
ARG reqSize 4k
ARG workload rand
ARG writeFrac 0
ARG randRange 20
ARG level 0
ARG raid5 LS
ARG reverse True
ARG timing False

LOGICAL READ from addr:2 size:4096
  read  [disk 1, offset 0]   

LOGICAL READ from addr:15 size:4096
  read  [disk 3, offset 3]   

LOGICAL READ from addr:9 size:4096
  read  [disk 0, offset 3]   

LOGICAL READ from addr:13 size:4096
  read  [disk 2, offset 3]   

LOGICAL READ from addr:1 size:4096
  read  [disk 0, offset 1] 

问题4

linux.> ./raid.py -R 20 -n 5 -L 1 -S 8k -W seq -c
ARG blockSize 4096
ARG seed 0
ARG numDisks 4
ARG chunkSize 4k
ARG numRequests 5
ARG reqSize 8k
ARG workload seq
ARG writeFrac 0
ARG randRange 20
ARG level 1
ARG raid5 LS
ARG reverse False
ARG timing False

LOGICAL READ from addr:0 size:8192
  read  [disk 0, offset 0]   
  read  [disk 2, offset 0]   

LOGICAL READ from addr:2 size:8192
  read  [disk 1, offset 1]   
  read  [disk 3, offset 1]   

LOGICAL READ from addr:4 size:8192
  read  [disk 0, offset 2]   
  read  [disk 2, offset 2]   

LOGICAL READ from addr:6 size:8192
  read  [disk 1, offset 3]   
  read  [disk 3, offset 3]   

LOGICAL READ from addr:8 size:8192
  read  [disk 0, offset 4]   
  read  [disk 2, offset 4] 

linux.> ./raid.py -R 20 -n 5 -L 1 -S 16k -W seq -c
ARG blockSize 4096
ARG seed 0
ARG numDisks 4
ARG chunkSize 4k
ARG numRequests 5
ARG reqSize 16k
ARG workload seq
ARG writeFrac 0
ARG randRange 20
ARG level 1
ARG raid5 LS
ARG reverse False
ARG timing False

LOGICAL READ from addr:0 size:16384
  read  [disk 0, offset 0]   
  read  [disk 2, offset 0]   
  read  [disk 1, offset 1]   
  read  [disk 3, offset 1]   

LOGICAL READ from addr:4 size:16384
  read  [disk 0, offset 2]   
  read  [disk 2, offset 2]   
  read  [disk 1, offset 3]   
  read  [disk 3, offset 3]   

LOGICAL READ from addr:8 size:16384
  read  [disk 0, offset 4]   
  read  [disk 2, offset 4]   
  read  [disk 1, offset 5]   
  read  [disk 3, offset 5]   

LOGICAL READ from addr:12 size:16384
  read  [disk 0, offset 6]   
  read  [disk 2, offset 6]   
  read  [disk 1, offset 7]   
  read  [disk 3, offset 7]   

LOGICAL READ from addr:16 size:16384
  read  [disk 0, offset 8]   
  read  [disk 2, offset 8]   
  read  [disk 1, offset 9]   
  read  [disk 3, offset 9]   

linux.> ./raid.py -R 20 -n 5 -L 4 -S 16k -W seq -c
ARG blockSize 4096
ARG seed 0
ARG numDisks 4
ARG chunkSize 4k
ARG numRequests 5
ARG reqSize 16k
ARG workload seq
ARG writeFrac 0
ARG randRange 20
ARG level 4
ARG raid5 LS
ARG reverse False
ARG timing False

LOGICAL READ from addr:0 size:16384
  read  [disk 0, offset 0]     read  [disk 1, offset 0]     read  [disk 2, offset 0]     read  [disk 0, offset 1]   
LOGICAL READ from addr:4 size:16384
  read  [disk 1, offset 1]     read  [disk 2, offset 1]     read  [disk 0, offset 2]     read  [disk 1, offset 2]   
LOGICAL READ from addr:8 size:16384
  read  [disk 2, offset 2]     read  [disk 0, offset 3]     read  [disk 1, offset 3]     read  [disk 2, offset 3]   
LOGICAL READ from addr:12 size:16384
  read  [disk 0, offset 4]     read  [disk 1, offset 4]     read  [disk 2, offset 4]     read  [disk 0, offset 5]   
LOGICAL READ from addr:16 size:16384
  read  [disk 1, offset 5]     read  [disk 2, offset 5]     read  [disk 0, offset 6]     read  [disk 1, offset 6]

当请求大小增加时,底层IO模式也会增加;对于8KB、12KB、16KB的请求大小,RAID-4和RAID-5的IO效率更高。

问题5

linux.> ./raid.py -n 100 -D 4 -t -L 0 -c
ARG blockSize 4096
ARG seed 0
ARG numDisks 4
ARG chunkSize 4k
ARG numRequests 100
ARG reqSize 4k
ARG workload rand
ARG writeFrac 0
ARG randRange 10000
ARG level 0
ARG raid5 LS
ARG reverse False
ARG timing True


disk:0  busy: 100.00  I/Os:    28 (sequential:0 nearly:1 random:27)
disk:1  busy:  93.91  I/Os:    29 (sequential:0 nearly:6 random:23)
disk:2  busy:  87.92  I/Os:    24 (sequential:0 nearly:0 random:24)
disk:3  busy:  65.94  I/Os:    19 (sequential:0 nearly:1 random:18)

STAT totalTime 275.7

linux.> ./raid.py -n 100 -D 4 -t -L 1 -c
ARG blockSize 4096
ARG seed 0
ARG numDisks 4
ARG chunkSize 4k
ARG numRequests 100
ARG reqSize 4k
ARG workload rand
ARG writeFrac 0
ARG randRange 10000
ARG level 1
ARG raid5 LS
ARG reverse False
ARG timing True


disk:0  busy: 100.00  I/Os:    28 (sequential:0 nearly:1 random:27)
disk:1  busy:  86.98  I/Os:    24 (sequential:0 nearly:0 random:24)
disk:2  busy:  97.52  I/Os:    29 (sequential:0 nearly:3 random:26)
disk:3  busy:  65.23  I/Os:    19 (sequential:0 nearly:1 random:18)

STAT totalTime 278.7

linux.> ./raid.py -n 100 -D 4 -t -L 4 -c
ARG blockSize 4096
ARG seed 0
ARG numDisks 4
ARG chunkSize 4k
ARG numRequests 100
ARG reqSize 4k
ARG workload rand
ARG writeFrac 0
ARG randRange 10000
ARG level 4
ARG raid5 LS
ARG reverse False
ARG timing True


disk:0  busy:  78.48  I/Os:    30 (sequential:0 nearly:0 random:30)
disk:1  busy: 100.00  I/Os:    40 (sequential:0 nearly:3 random:37)
disk:2  busy:  76.46  I/Os:    30 (sequential:0 nearly:2 random:28)
disk:3  busy:   0.00  I/Os:     0 (sequential:0 nearly:0 random:0)

STAT totalTime 386.1

linux.> ./raid.py -n 100 -D 4 -t -L 5 -c
ARG blockSize 4096
ARG seed 0
ARG numDisks 4
ARG chunkSize 4k
ARG numRequests 100
ARG reqSize 4k
ARG workload rand
ARG writeFrac 0
ARG randRange 10000
ARG level 5
ARG raid5 LS
ARG reverse False
ARG timing True


disk:0  busy: 100.00  I/Os:    28 (sequential:0 nearly:1 random:27)
disk:1  busy:  95.84  I/Os:    29 (sequential:0 nearly:5 random:24)
disk:2  busy:  87.60  I/Os:    24 (sequential:0 nearly:0 random:24)
disk:3  busy:  65.70  I/Os:    19 (sequential:0 nearly:1 random:18)

STAT totalTime 276.7

问题6

linux.> ./raid.py -n 100 -D 16 -t -L 5 -c
ARG blockSize 4096
ARG seed 0
ARG numDisks 16
ARG chunkSize 4k
ARG numRequests 100
ARG reqSize 4k
ARG workload rand
ARG writeFrac 0
ARG randRange 10000
ARG level 5
ARG raid5 LS
ARG reverse False
ARG timing True


disk:0  busy:  58.72  I/Os:     6 (sequential:0 nearly:2 random:4)
disk:1  busy:  57.00  I/Os:     5 (sequential:0 nearly:1 random:4)
disk:2  busy:  67.89  I/Os:     6 (sequential:0 nearly:1 random:5)
disk:3  busy:  30.39  I/Os:     3 (sequential:0 nearly:1 random:2)
disk:4  busy:  82.00  I/Os:     8 (sequential:0 nearly:1 random:7)
disk:5  busy:  69.50  I/Os:     6 (sequential:0 nearly:0 random:6)
disk:6  busy:  86.35  I/Os:     8 (sequential:0 nearly:1 random:7)
disk:7  busy:  77.98  I/Os:     7 (sequential:0 nearly:1 random:6)
disk:8  busy:  57.45  I/Os:     6 (sequential:0 nearly:2 random:4)
disk:9  busy:  69.61  I/Os:     7 (sequential:1 nearly:0 random:6)
disk:10  busy:  65.25  I/Os:     7 (sequential:0 nearly:2 random:5)
disk:11  busy:  25.92  I/Os:     3 (sequential:0 nearly:1 random:2)
disk:12  busy:  74.54  I/Os:     8 (sequential:0 nearly:3 random:5)
disk:13  busy: 100.00  I/Os:    11 (sequential:0 nearly:3 random:8)
disk:14  busy:  31.31  I/Os:     3 (sequential:0 nearly:1 random:2)
disk:15  busy:  57.91  I/Os:     6 (sequential:0 nearly:1 random:5)

STAT totalTime 87.2

每个RAID级别的性能随着磁盘数量的增加变高。

问题7

linux.> ./raid.py -n 100 -D 16 -t -L 4 -c -w 100
ARG blockSize 4096
ARG seed 0
ARG numDisks 16
ARG chunkSize 4k
ARG numRequests 100
ARG reqSize 4k
ARG workload rand
ARG writeFrac 100
ARG randRange 10000
ARG level 4
ARG raid5 LS
ARG reverse False
ARG timing True


disk:0  busy:  4.73  I/Os:     8 (sequential:0 nearly:4 random:4)
disk:1  busy:  7.45  I/Os:    16 (sequential:0 nearly:11 random:5)
disk:2  busy:  4.90  I/Os:    12 (sequential:0 nearly:9 random:3)
disk:3  busy:  5.91  I/Os:    10 (sequential:0 nearly:5 random:5)
disk:4  busy:  4.73  I/Os:    10 (sequential:0 nearly:6 random:4)
disk:5  busy:  5.43  I/Os:    10 (sequential:0 nearly:6 random:4)
disk:6  busy:  10.55  I/Os:    20 (sequential:0 nearly:13 random:7)
disk:7  busy:  5.91  I/Os:    16 (sequential:0 nearly:12 random:4)
disk:8  busy:  2.85  I/Os:     8 (sequential:0 nearly:6 random:2)
disk:9  busy:  7.09  I/Os:    12 (sequential:0 nearly:6 random:6)
disk:10  busy:  13.50  I/Os:    24 (sequential:0 nearly:14 random:10)
disk:11  busy:  9.26  I/Os:    20 (sequential:0 nearly:14 random:6)
disk:12  busy:  5.91  I/Os:    10 (sequential:0 nearly:5 random:5)
disk:13  busy:  6.66  I/Os:    14 (sequential:0 nearly:9 random:5)
disk:14  busy:  3.79  I/Os:    10 (sequential:1 nearly:6 random:3)
disk:15  busy: 100.00  I/Os:   200 (sequential:0 nearly:130 random:70)

STAT totalTime 854.9

全部改为写入后,随着磁盘数增加,RAID-4的性能基本不变,而其他RAID级别的性能会提高,100次随机写入所需的时间下降。

问题8

linux.> ./raid.py -n 100 -D 4 -t -L 5 -c -W seq -S 16k
ARG blockSize 4096
ARG seed 0
ARG numDisks 4
ARG chunkSize 4k
ARG numRequests 100
ARG reqSize 16k
ARG workload seq
ARG writeFrac 0
ARG randRange 10000
ARG level 5
ARG raid5 LS
ARG reverse False
ARG timing True


disk:0  busy: 100.00  I/Os:   100 (sequential:66 nearly:33 random:1)
disk:1  busy: 100.00  I/Os:   100 (sequential:66 nearly:33 random:1)
disk:2  busy: 100.00  I/Os:   100 (sequential:66 nearly:33 random:1)
disk:3  busy: 100.00  I/Os:   100 (sequential:66 nearly:33 random:1)

STAT totalTime 23.3

随着磁盘数量的增加,性能略有提高,但不像随机的工作负载那么明显;读取和写入几乎没有区别;RAID-0性能最高,RAID-4和RAID-5其次性能一样,RAID-1性能最低;随着请求大小的增加(指定4KB、8KB、12KB、16KB)所需时间增加。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

刷子c

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值