您的位置:首页 > 移动开发

《CSAPP》存储器层次结构:在程序中利用局部性

2010-06-27 23:39 267 查看
在学习csapp, 看完了第六章。标记一下, 所以直接引用csapp书中内容了:

Putting It Together: Exploiting Locality in Your Programs (The Impact of Caches on Program Performance)

Programmers who understand the nature of the memory hierarchy can exploit this understanding to write

more efficient programs, regardless of the specific memory system organization. In particular, we recommend

the following techniques:

 Focus your attention on the inner loops where the bulk of the computations and memory accesses

occur.

 Try to maximize the spatial locality in your programs by reading data objects sequentially, in the order

they are stored in memory.

 Try to maximize the temporal locality in your programs by using a data object as often as possible

once it has been read from memory.

 Remember that miss rates are only one (albeit important) factor that determines the performance

of your code. The number of memory accesses also plays an important role, and sometimes it is

necessary to trade off between the two.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: