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

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

P22

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

P23

T a v g _ s e e k = 4 m s T_{avg\_seek} = 4ms Tavg_seek=4ms
T a v g _ r o t a t i o n = 1 2 ∗ 1 15000 ∗ 60 s / m i n ∗ 1000 m s / s = 2 m s T_{avg\_rotation} = \frac{1}{2} *\frac{ 1}{15000} * 60s/min * 1000ms/s = 2ms Tavg_rotation=2115000160s/min1000ms/s=2ms
T a v g _ t r a n s f e r = 1 15000 ∗ 1 800 ∗ 60 s / m i n ∗ 1000 m s / s = 0.005 m s T_{avg\_transfer} = \frac{1}{15000} * \frac{1}{800} * 60s/min * 1000ms/s = 0.005ms Tavg_transfer=150001800160s/min1000ms/s=0.005ms
→ \to
T a c c e s s = 6.005 m s T_{access} = 6.005ms Taccess=6.005ms

P24

  • A
    文件块存储在同一柱面且连续存储。只需要一次寻道。
    T a v d _ s e e k = 4 m s T_{avd\_seek}=4ms Tavd_seek=4ms T a v g _ r o t a t i o n = 2 m s T_{avg\_rotation}=2ms Tavg_rotation=2ms
    文件大小2MB,块大小512B,总计4000块。每个磁道1000块,所以总计转4转,即:
    T t r a n s f e r = T r o t a t i o n = T m a x _ r o t a t i o n ∗ 4 = 16 m s T_{transfer}=T_{rotation}=T_{max\_rotation}*4=16ms Ttransfer=Trotation=Tmax_rotation4=16ms所以, T t o t a l = 22 m s T_{total}=22ms Ttotal=22ms
  • B
    最坏情况:所有块随机分布 T t o t a l = 4000 ∗ ( T a v g _ s e e k + T a v g _ r o t a t i o n ) = 24 s T_{total} = 4000 * (T_{avg\_seek} + T_{avg\_rotation}) = 24s Ttotal=4000(Tavg_seek+Tavg_rotation)=24s

P25

CachemcBEStsb
1.32102444642462
2.321024425613002
3.321024811282273
4.321024812812903
5.321024321322255
6.32102432482435

P26

CachemcBEStsb
1.322048812562183
2.322048441282372
3.32102428642561
4.321024322162345

P27

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

P28

  • A
    没有。🐴
  • B
    0x18F0-0x18F3
    0x00B0-0x00B3
  • C
    0x0E34-0x0E37
  • D
    0x1BDC-0x1BDF

P29

  • A
    在这里插入图片描述
  • B
read/writeaddrhit?value(or unknown)
read0x834No-
write0x836Yesunknown
read0xFFDYes0xC0

P30

  • A
    C = E ∗ B ∗ S = 128 B C = E * B * S = 128B C=EBS=128B
  • B
    在这里插入图片描述

P31

  • A
    在这里插入图片描述
  • B
paramvalue
CO0x02
CI0x06
CT0x38
hit?Yes
return0xEB

P32

  • A
    在这里插入图片描述
  • B
paramvalue
CO0x00
CI0x02
CT0xB7
hit?No
return

P33

0x1788-0x178B
0x16C8-0x16CB

P34

dst array:

c0c1c2c3
r0mmmm
r1mmmm
r2mmmm
r3mmmm

src array:

c0c1c2c3
r0mmhm
r1mhmh
r2mmhm
r3mhmh

P35

dst array:

c0c1c2c3
r0mhhh
r1mhhh
r2mhhh
r3mhhh

src array:

c0c1c2c3
r0mhhh
r1mhhh
r2mhhh
r3mhhh
  • 6
    点赞
  • 12
    收藏
    觉得还不错? 一键收藏
  • 6
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 6
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值