免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 3671 | 回复: 8
打印 上一主题 下一主题

Intel系统编程手册 Cache那章一段英文不是很明白 请教~~ [复制链接]

论坛徽章:
1
数据库技术版块每日发帖之星
日期:2015-08-03 06:20:00
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2010-03-31 23:08 |只看该作者 |倒序浏览
ALL writes are written to a cache line(when possible) and through to system memory。

重点下面这句不理解

When writing through to memory, invaild cache lines are never filled, and valid cache lines are either filled or invalidated。

论坛徽章:
0
2 [报告]
发表于 2010-04-01 10:02 |只看该作者
我觉得应该是:

“在对内存做写通过时(就是把cache里的内容写往memory),cache line里无效的行是不会写往内存的,而有效的cache line或者写往内存或者变为无效”

好像还是很费解。。。

难道最后的”or“是表示先后关系?——“有效的cache line会先写入内存再设为无效”

论坛徽章:
1
数据库技术版块每日发帖之星
日期:2015-08-03 06:20:00
3 [报告]
发表于 2010-04-01 12:52 |只看该作者
我的想法是既然cache line 都无效了 那怎么还会写入内存呢 不是在写cache时才写内存吗,无效的cache能写吗?

论坛徽章:
0
4 [报告]
发表于 2010-04-01 14:42 |只看该作者
>>ALL writes are written to a cache line(when possible) and through to system memory。

所有的写操作被提交到cahce line(如果可能,什么条件?),并且写入内存.

>>When writing through to memory, invaild cache lines are never filled, and valid cache lines are either filled or invalidated。

当写入内存时,无效的缓冲行不会被填充,而有效的缓冲行要么被填充(满足该条件?)要么被废弃(不满足?)。

论坛徽章:
1
程序设计版块每日发帖之星
日期:2015-09-23 06:20:00
5 [报告]
发表于 2010-04-01 17:52 |只看该作者
>> 我的想法是既然cache line 都无效了 那怎么还会写入内存呢 不是在写cache时才写内存吗,无效的cache能写吗?

你考虑下SMP 就好理解了。

论坛徽章:
1
数据库技术版块每日发帖之星
日期:2015-08-03 06:20:00
6 [报告]
发表于 2010-04-02 00:36 |只看该作者
能不能帮忙具体解释下这句?{:3_190:}

论坛徽章:
1
程序设计版块每日发帖之星
日期:2015-09-23 06:20:00
7 [报告]
发表于 2010-04-02 02:16 |只看该作者
读了下手册,下面是intel manual的write through cache type的完整描述:
Write-through (WT) — Writes and reads to and from system memory are cached. Reads come from cache lines on cache hits; read misses cause cache fills. Speculative reads are allowed. All writes are written to a cache line (when possible) and through to system memory. When writing through to memory, invalid cache lines are never filled, and valid cache lines are either filled or invalidated. Write combining is allowed. This type of cache-control is appropriate for frame buffers or when there are devices on the system bus that access system memory, but do not perform snooping of memory accesses. It enforces coherency between caches in the processors and system memory.

我的个人理解是,对UP的机器,要write的address存在两种情况:
1, cache line filled,  这时候,wt的cache line会被再次fill 最新的数据,然后写入RAM.
2, cache line not filled, 这时候,cpu会allocate (if cache not full) and fill cache line, 然后写入RAM.

对MP的机器,假设有A, B两个cpu, A write 某个address,对A来说同UP,对B来说, cache coherency protocal 会使B:
1, B cache line filled,  这时候,wt的cache line会被invalidate, 不会被filled.
2, B cache line not filled, 这时候,nothing to do.

<valid cache lines are either filled or invalidated.> 对A来说是filled (if possible),  对B来说
是invalidated.

以上是个人的理解,仅供参考。

论坛徽章:
0
8 [报告]
发表于 2010-04-02 18:22 |只看该作者
理论的东西?

论坛徽章:
0
9 [报告]
发表于 2010-04-15 10:22 |只看该作者
读了下手册,下面是intel manual的write through cache type的完整描述:
Write-through (WT) — Writes an ...
irp 发表于 2010-04-02 02:16



    #1楼的兄弟搞明白"write through"这个机制了吗,打开这个机制后,

1)系统内存的所有读写都会被缓存;
2)读来自cache行命中,未命中时会先填充cache行,再返回cache命中;
3)写的时候有点区别,会直接写到内存中区,如果有相应的cache行,就把这个cache行无效,把内容写到内存中;如果没有相应的cache行就不管cache行,光写到内存中就行。
   但在使能写合并时(Write combining is allowed),对命中cache行的写会先只修改cache,再由系统统一刷到内存中,系统有个统一刷的机制,这样可以提高吞吐量和效率,但会有不同步的问题,需慎重。

这种读写机制是为了防止系统中有能访问内存的设备不知道core修改了内存的内容,以保证其内容的同步。
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP