Cache Algorithms
1. 平均内存引用时间

T = average memory reference time
m = miss ratio = 1 - (hit ratio)
Tm = time to make a main memory access when there is a miss (or, with multi-level cache, average memory reference time for the next-lower cache)
Th = the latency: the time to reference the cache when there is a hit
E = various secondary effects, such as queuing effects in multiprocessor systems
平均内存引用时间 = 丢失率 * 丢失时加入时间 + 命中时引用时间(延迟) + 多种次要影响(比如多级处理器排队等待时间)
参考 https://en.wikipedia.org/wiki/Cache_algorithms
2. 替换算法
关键词:research 、 traditional 、 大内存 、 遍历周期
OPT (The theoretically optimal page replacement algorithm)
This algorithm cannot be implemented in a general purpose operating system because it is impossible to compute reliably how long it will be before a page is going to be used, except when all software that will run on a system is either known beforehand and is amenable to static analysis of its memory reference patterns, or only a class of applications allowing run-time analysis.
无法实现
NRU (Not recently used)
It is an algorithm that favours keeping pages in memory that have been recently used.
3. referenced, modified
2. referenced, not modified
1. not referenced, modified
0. not referenced, not modified
从最低级(0级)选择随机页删除
FIFO (First-in, first-out)
最简单的页替换算法,可用List和LinkedHashMap 实现
LRU (The least recently used)
LRU works on the idea that pages that have been most heavily used in the past few instructions are most likely to be used heavily in the next few instructions too.
在前面几条指令中使用频繁的页面很可能在后面的几条指令中频繁使用。
反过来说,已经很久没有使用的页面很可能在未来较长的一段时间内不会被用到。
Random
Random replacement algorithm replaces a random page in memory.
NFU (Not frequently used)
The not frequently used (NFU) page replacement algorithm requires a counter, and every page has one counter of its own which is initially set to 0.
Cache Algorithms的更多相关文章
- Cache replacement policies 缓存实现算法
Cache replacement policies - Wikipedia https://en.wikipedia.org/wiki/Cache_replacement_policies Cach ...
- 浅析LRU(K-V)缓存
LRU(Least Recently Used)算法是缓存技术中的一种常见思想,顾名思义,最近最少使用,也就是说有两个维度来衡量,一个是时间(最近),一个频率(最少).如果需要按优先级来对缓存中的K- ...
- C++ Core Guidelines
C++ Core Guidelines September 9, 2015 Editors: Bjarne Stroustrup Herb Sutter This document is a very ...
- weblogic JDBC Connection Pools--转官方文档
http://docs.oracle.com/cd/E13222_01/wls/docs81/ConsoleHelp/jdbc_connection_pools.html#1106016 JDBC C ...
- MIT 6.S081 聊聊xv6中的文件系统(上)
前言 Lab一做一晚上,blog一写能写两天,比做Lab的时间还长( 这篇博文是半夜才写完的,本来打算写完后立刻发出来,但由于今天发现白天发博点击量会高点,就睡了一觉后才发(几十的点击量也是点击量啊T ...
- Ehcache(2.9.x) - API Developer Guide, Cache Eviction Algorithms
About Cache Eviction Algorithms A cache eviction algorithm is a way of deciding which element to evi ...
- rbd cache (一)
cache 1.why The existence of cache is based on a mismatch between the performance characteristics of ...
- Machine Learning Algorithms Study Notes(2)--Supervised Learning
Machine Learning Algorithms Study Notes 高雪松 @雪松Cedro Microsoft MVP 本系列文章是Andrew Ng 在斯坦福的机器学习课程 CS 22 ...
- [ZZ] Cache
http://blog.sina.com.cn/s/blog_6472c4cc0102duzr.html 处理器微架构访问Cache的方法与访问主存储器有类似之处.主存储器使用地址编码方式,微架构可以 ...
随机推荐
- Shiro权限总结
参考学习地址 shiro 瞅完就会用(ssm+shiro) Spring Shiro配置实现用户认证和授权 anon:它对应的过滤器里面是空的,什么都没做,另外.do和.jsp后面的*表示参 ...
- python 的None 探究
a = None b = None print id(a),id(b),id(None) # 9430224 9430224 9430224 可能在别的环境下运行不是这个数,但是这三个数应该是一样的. ...
- js ParseUrl
js ParseUrl function parseURL(url) { var a = document.createElement('a'); a.href = url; return { sou ...
- Rabbitmq 基本属性
MQ全称为Message Queue, 是一种分布式应用程序的的通信方法,它是消费-生产者模型的一个典型的代表,producer往消息队列中不断写入消息,而另一端consumer则可以读取或者订阅队列 ...
- Spring依赖注入:注解注入
注解注入顾名思义就是通过注解来实现注入, Spring和注入相关的常见注解有Autowired.Resource.Qualifier.Service.Controller.Repository.Com ...
- 使用select实现多并发的socket的功能
select是一个io多路复用的io模型,也叫做事件驱动的io模型,我们今天用select来实现一个多并发的socket的聊天的程序 先看下server端的代码 import socket impor ...
- python的进程间的数据交互
#先来看下如何实现多进程 # multiprocessing 这个是python的多进程的模块,我们会用到这个模块的很多方法 from multiprocessing import Process i ...
- centos7装NVIDIA显卡驱动
一.系统及显卡 系统:centos7.5 64位 显卡:gtx 1060 前几天主要是有一个人脸识别的项目测试,需要用到显卡去测试性能,然后装显卡的过程折腾了一下,特此记录. 二.安装过程 1. 下载 ...
- [leetcode]543. Diameter of Binary Tree二叉树直径
Given a binary tree, you need to compute the length of the diameter of the tree. The diameter of a b ...
- WebMagic写的网络爬虫
一.前言 最近因为有爬一些招聘网站的招聘信息的需要,而我之前也只是知道有“网络爬虫”这个神奇的名词,具体是什么.用什么实现.什么原理.如何实现比较好都不清楚,因此最近大致研究了一下,当然,研究的并不是 ...