《CSAPP》(第3版)答案(第六章)(一)

P22

x=12x=\frac{1}{2}x=21​

P23

Tavg_seek=4msT_{avg\_seek} = 4msTavg_seek​=4ms
Tavg_rotation=12∗115000∗60s/min∗1000ms/s=2msT_{avg\_rotation} = \frac{1}{2} *\frac{ 1}{15000} * 60s/min * 1000ms/s = 2msTavg_rotation​=21​∗150001​∗60s/min∗1000ms/s=2ms
Tavg_transfer=115000∗1800∗60s/min∗1000ms/s=0.005msT_{avg\_transfer} = \frac{1}{15000} * \frac{1}{800} * 60s/min * 1000ms/s = 0.005msTavg_transfer​=150001​∗8001​∗60s/min∗1000ms/s=0.005ms
→\to→
Taccess=6.005msT_{access} = 6.005msTaccess​=6.005ms

P24

  • A
    文件块存储在同一柱面且连续存储。只需要一次寻道。
    Tavd_seek=4msT_{avd\_seek}=4msTavd_seek​=4msTavg_rotation=2msT_{avg\_rotation}=2msTavg_rotation​=2ms
    文件大小2MB,块大小512B,总计4000块。每个磁道1000块,所以总计转4转,即:
    Ttransfer=Trotation=Tmax_rotation∗4=16msT_{transfer}=T_{rotation}=T_{max\_rotation}*4=16msTtransfer​=Trotation​=Tmax_rotation​∗4=16ms所以,Ttotal=22msT_{total}=22msTtotal​=22ms
  • B
    最坏情况:所有块随机分布Ttotal=4000∗(Tavg_seek+Tavg_rotation)=24sT_{total} = 4000 * (T_{avg\_seek} + T_{avg\_rotation}) = 24sTtotal​=4000∗(Tavg_seek​+Tavg_rotation​)=24s

P25

Cache m c B E S t s b
1. 32 1024 4 4 64 24 6 2
2. 32 1024 4 256 1 30 0 2
3. 32 1024 8 1 128 22 7 3
4. 32 1024 8 128 1 29 0 3
5. 32 1024 32 1 32 22 5 5
6. 32 1024 32 4 8 24 3 5

P26

Cache m c B E S t s b
1. 32 2048 8 1 256 21 8 3
2. 32 2048 4 4 128 23 7 2
3. 32 1024 2 8 64 25 6 1
4. 32 1024 32 2 16 23 4 5

P27

  • A
    t=0x45, 地址范围:0x08A4~0x08A7
    t=0x38, 地址范围:0x0704~0x0707
  • B
    0x1238~0x123B

P28