标题: Intel系统编程手册 Cache那章一段英文不是很明白 请教~~ [打印本页] 作者: 317316abcd 时间: 2010-03-31 23:08 标题: Intel系统编程手册 Cache那章一段英文不是很明白 请教~~ 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。作者: bigrat023 时间: 2010-04-01 10:02
我觉得应该是:
难道最后的”or“是表示先后关系?——“有效的cache line会先写入内存再设为无效”作者: 317316abcd 时间: 2010-04-01 12:52
我的想法是既然cache line 都无效了 那怎么还会写入内存呢 不是在写cache时才写内存吗,无效的cache能写吗?作者: qtdszws 时间: 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。
你考虑下SMP 就好理解了。作者: 317316abcd 时间: 2010-04-02 00:36
能不能帮忙具体解释下这句?{:3_190:}作者: irp 时间: 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.