Git Product home page Git Product logo

cache-replacement-policies's Introduction

Cache-Replacement-Policies

Implementation of popular memory management algorithms including LRU and Second Chance ๐Ÿ’พ

Modern computers have different types of memories, varying in size, retrieval speed and price. In order to get the most out of it, Cache Algorithms were invented. They optimize instructions that a computer program or a hardware-maintained structure can utilize in order to manage a cache of information stored on the computer.

Caching improves performance by keeping recent or often-used data items in memory locations that are faster or computationally cheaper to access than normal memory stores. When the cache is full, the algorithm must choose which items to discard to make room for the new ones. We implement two of the most popular algorithms, namely:

  • Least Recently Used - known as the LRU is a Greedy Algorithm where the page to be replaced is least recently used. The idea is based on Locality Of Reference, stating that a page that has been unused for a great amount of time is more likely to remain unused, ergo should be removed
  • Second Chance - the candidate pages for removal are considered in a Round Robin Matter, and a page that has been accessed between consecutive considerations will not be replaced. The page replaced is the one that, when considered in a round robin matter, has not been accessed since its last consideration

Compilation & Execution:

In order to compile the source code, type: make
In order to execute the program, type: ./p2 -f1 <First File> -a <Algorithm: LRU / Second Chance> -fn <Number Of Frames> -f2 <Second File> -fr <Lines Read Per File> -tr <Number Of Actions>

After a successful simulation execution, the program prints the number of Page Faults, which in our case is equal to the number of new Disk Reads, as those are the result of a page missing in the cache memory. The total number of Disk Writes executed throughout the simulation after memory cleanup (includes the Dirty Files remaining in the hashtables), and number of available pages, are printed as well.

Further Information:

We include a readME PDF file that contains an extensive description of the project set up, the inner workings of the respective algorithms and my design choices. A brief description of the contents of corresponding files is given. This PDF is written in Greek!

Built as part of the course: Operational Systems , Winter of 2019. University of Athens, DiT.

cache-replacement-policies's People

Contributors

jacobmaciejewski avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.