作者ponwar87123 (干我屁事喔北七)
看板Grad-ProbAsk
标题[理工] 台科大资工所资概几题
时间Fri Jan 17 14:42:11 2020
恳请各位大大帮看这几题,谢谢!
1.
https://imgur.com/n3va90I
想问这题的解题逻辑
(a)直接MAX-Allocation
(b)照着sequence算,资源都够,都可以完成就是safe(我写safe)
(c)我没假设x为多少,因为不管多少只有p3能做,
然後就p3做完,得到一些资源,所以变x+1...一个一个弄
最後我发现x=0也是safe state,所以我写0
2.
https://imgur.com/gijGhGV
主要想问
(b)在waiting对吧?因为要等IO完成才能竞争CPU
(c)可以继续running(?)因为他可以边做边IO
3.
https://imgur.com/1fTVLs0
我写
(a)RR
(b)Priority Scheduling
(c)Shortest Job First,我也不知道为什麽我写这个凭直觉
4.
https://imgur.com/EvH3A9B
想问(c)
我写execution-time
5.
https://imgur.com/E1ljobP
(a)这题我写$s1 $s3,因为在ID的是lw那个指令
在decode的时候就会去读所有需要的register了吧?
(b)我写2,在WB的是add $t2,$t1,$t1,所以应该写回t2了吧?
(c)我写10 cycles,(5-1)+6 = 10,其中因为有load-use所以有插nop进去
6.
https://imgur.com/ecMZdhh
(a)1+(5/100)*100 = 6 cycles
(b)1+(5/100)*10+(1/100)*100 = 2.5 cycles
--
※ 发信站: 批踢踢实业坊(ptt.cc), 来自: 101.9.172.153 (台湾)
※ 文章网址: https://webptt.com/cn.aspx?n=bbs/Grad-ProbAsk/M.1579243334.A.821.html
※ 编辑: ponwar87123 (101.9.172.153 台湾), 01/17/2020 15:06:45
1F:推 mistel: 3.b priority应该不对,因为进同一个Queue的优先权都是一 01/17 17:08
2F:→ mistel: 样的,课本是拿FCFS做例子 我自己觉得没有一定 01/17 17:08
3F:→ mistel: 4.c 总而言之VM就是要page可以relocatable,这样一个分页 01/17 17:10
4F:→ mistel: 才能在swapping space跟physical memory之间移动,或者也 01/17 17:10
5F:→ mistel: 可以说虚拟位址要到执行时才会跟physical address产生关 01/17 17:10
6F:→ mistel: 联,总之exe time是对的 01/17 17:10
7F:推 mistel: 其他应该都没问题 01/17 17:18
那这样3b要写什麽
所以4.c load-time是没有的罗?
刚刚查了一下洪逸上课讲的,multilevel queues似乎也可以用RR?
※ 编辑: ponwar87123 (101.9.172.153 台湾), 01/17/2020 18:43:03
8F:推 mistel: 我发现我讲错了,execution time不是relocatable,答案还 01/17 20:59
9F:→ mistel: 是execution time没错,我晚点再查一下 01/17 20:59
10F:推 ok8752665: 4.C只有excution time没错 前面两个是static binding 01/17 21:05
11F:→ ok8752665: 也就是logical address= physical address 01/17 21:06
12F:→ ok8752665: 3.B就写FCFS阿 反正同一个queue 谁先做都好 01/17 21:09
13F:→ mistel: execution time出来的code好像没有特别的称呼 01/17 21:10
了解
谢谢各位大神
※ 编辑: ponwar87123 (101.9.172.153 台湾), 01/17/2020 21:31:04