[请益] 内存分配与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