- 1、本文档共7页,可阅读全部内容。
- 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
Offline Cache缓存调度算法实验报告
Offline Cache实验报告学院:软件学院 学号:201421031059 姓名:吕吕Question DescriptionConsider the management problem between adjacent levels:1)Main memory with n data items from a set U2)Cache can hold kn items Simplest version with no direct-mapping or other restrictions about where items can be1)Suppose cache is full initially 2)Holds k data items to start with Given a memory request d from U1)If d is stored in the cache we can access it quickly2) If not then we call it a cache miss and (since the cache is full) we must bring it into cache and evict some other data item from the cache which one to evict? Question: Given a sequence D=d1,d2,…,dm of elements from U corresponding to memory requests, Find a sequence of evictions (an eviction schedule) that has as few cache misses as possible。二、Common?cache replacement?algorithm comparison2.1 Traditional cache replacement algorithm2.1.1 FIFO(First Input First Output)Algorithm Idea: The algorithm?eliminate?the page first to enter the?cache?.Advantage: The realization is simple.Disadvantage: Rarely used in practice,?because ?page fault rate of the algorithm?is high.2.1.2 LRU(Least Recently Used)Algorithm Idea: If the data has recently been visited, then in the future probability of access is also higher. Therefore, to eliminate the data most long time without access. LRU algorithm is based on recency .Advantage: The realization of LRU is simple and?the extra expenses are very few. Moreover, LRU’s effect is obvious and the LRU have been widely used in practice.Disadvantage: Periodical and episodic batch operation?will cause the?LRU hit?rate decreasing sharply and the serious cache pollution?situation.The most common implementation is to use a linked list to cache the data, the detailed implementation of the algorithm as following:1 New data is inserted into the list head;2 Whenever the cache hit (i.e. the cache data is accessed), data will be moved to the list head;3 When the list is full, the tail data of the list data is discarded.2.1.3 LF
文档评论(0)