[請益] 記憶體分配與BNF語法

作者: luxylu ( 露西露 )   2013-06-06 00:14:03
有100個program 每個program各1,000,000個words
要把它放進記憶體內 記憶體分別有cache memory disk
其每個字元的Access Time分別是1、7、5000個cycle clock,
每處理一個字元的cost分別是$10、1、0.01元
現在有300萬元 考慮90-10 rule下設計最快速的分配方式?其平均access時間是?
(Assume that the program follows the 90-10 rule and that accesses
within the top 10% and bottom 90% are uniformly distributed:
that is , 90% of the time is spread evenly over 10% of the code
and the other 10% of the time is spread evenly over 10% of the code
and the other 10% of the time is spread evenly overthe other 90% of the code.)
Access Time Cost per word
Cache 1 $10
Memory 7 $1
Disk 5000 $0.01
問題2
<line> ::= <expression>
<expression> ::= <expression> "+" <term>| <expression> "-" <term>| <term>
<term> ::= <term> "*" <primary expression>| <term> "/" <primary expression> |
<primary expression>
<primary expression> ::= 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9
8 + 9 * 3 - 4
我畫的樹構造長這樣不知道對不對==
<line>
|
<expression>
|
/ - \
<expr> <term>
/ \
/ + \ 4
<expr> <term>
/ \
<term> / * \
/ <term> <pri expr>
<pri expr> | |
| <pri expr> 3
8 |
9

Links booklink

Contact Us: admin [ a t ] ucptt.com