寄托天下
查看: 44|回复: 3
打印 上一主题 下一主题

[未归类] 问个OS里关于TLB和CACHE的问题 [复制链接]

Rank: 11Rank: 11Rank: 11Rank: 11

声望
3110
寄托币
48275
注册时间
2003-9-1
精华
44
帖子
1491

荣誉版主 GRE斩浪之魂 Golden Apple

跳转到指定楼层
楼主
发表于 2007-1-1 03:39:24 |只看该作者 |倒序浏览
是OS课上的一个问题。

The question is like this:

In a Slorais OS, cache hit ratio is h1, access time is t1, TLB hit ratio is h2, access time is t2, main memory acess time is t3. What is the average access time?

My answer is as follows:
h1t1+ (1-h1)(t1+t3) + h2t2 + (1-h2)(t2+t3)

The reason is: to access a word in memory, it needs two steps. First is to get the page table for that word. This page table may be in TLB, then it is h1t1. If not in TLB, it may be in main memory --here is my question. If page table is not in TLB, where should the CPU look for it? main memory? or cache? Do you have any idea about it? Right now, I think page table will be in main memory, so the access time is (1-h1)(t1+t3).

The second step is to get the word. It may be in cache, then the access time is h2t2. If not, it should be in main memory, and the access time is (1-h2)(t2+t3).

不确定的地方就是如果PAGE TABLE ENTRY 不在TLB里,那么接下来一般去哪里找?CACHE? MAIN MEMOY? 我觉得应该和具体的CACHE设计有关。但是不知道一般OS课上都是怎么教的? 看了STALLINGS 的那本书,上面的意思好像是CACHE里只放DATA, 不放PAGE TALBE 的东东。 不知道这么理解对不对?

BTW,题目是根据记忆写的,有可能有的地方不够严密。

另外帮忙看看其他地方有没有问题。 多谢!

新年快乐!
0 0

使用道具 举报

Rank: 11Rank: 11Rank: 11Rank: 11

声望
795
寄托币
42412
注册时间
2005-3-2
精华
21
帖子
2081

荣誉版主 挑战ETS奖章 寄托之心勋章 Aries白羊座 GRE斩浪之魂

沙发
发表于 2007-1-2 09:17:05 |只看该作者
友情帮顶
happy new year!:loveliness:
色不迷人人自迷。
天佑中华!!Bless bless bless

使用道具 举报

Rank: 11Rank: 11Rank: 11Rank: 11

声望
3110
寄托币
48275
注册时间
2003-9-1
精华
44
帖子
1491

荣誉版主 GRE斩浪之魂 Golden Apple

板凳
发表于 2007-1-2 12:04:20 |只看该作者
多谢,多谢。我已经问了我的一个同学,基本上有答案了,呵呵。

使用道具 举报

Rank: 9Rank: 9Rank: 9

声望
35
寄托币
14861
注册时间
2005-3-16
精华
29
帖子
64

Scorpio天蝎座 荣誉版主

地板
发表于 2007-1-2 12:38:54 |只看该作者
CPU发来虚地址,首先在TLB中查找相应页表,

若TLB中存放着对应页表,则称为TLB命中。
      若该页表对应物理地址的数据在CACHE中,则称为CACHE命中;
      否则,在内存中取相应地址对应的数据。
若TLB中未查到对应页表,则访问内存中的页表,根据页表在内存中读取数据,并将内存中的页表项装入TLB。

我是这么理解的,不知道对不对,仅贡参考。
I Believe I Can Fly
I Believe I Can Touch The Sky

使用道具 举报

RE: 问个OS里关于TLB和CACHE的问题 [修改]

问答
Offer
投票
面经
最新
精华
转发
转发该帖子
问个OS里关于TLB和CACHE的问题
https://bbs.gter.net/thread-587557-1-1.html
复制链接
发送
回顶部