Git Product home page Git Product logo

cache_analysis's Introduction

Cache Analysis

In this Repository

  • Least Recently Used (LRU)
  • Clock Page Replacement
  • 2Q
  • Adaptive Replacement Cache (ARC)

Objectives

  • This repository aims to analyse different page replacement algorithms.
  • This repository contains implementations of the said page replacement algorithms, created in accordance with the relevant research papers.

References

How to use this project

  • Clone this Repository.
    $ git clone [email protected]:Inamul07/Cache_Analysis.git
    $ cd Cache_Analysis
  • Edit the main.c file to include the required replacement algorithm.
  • Then run this command in terminal,
    $ make
    

Algorithm Methods

Algorithm cache_name
Least Recently Used LRU
Clock Page Replacement CLOCK
Two Queue TWO_QUEUE
Adaptive Replacement Cache ARC

Methods

  • cache_init(cacheType cache_name, int capacity)
    • Initializes the respective cache with given capacity.
    • returns generic_cache*.
  • cache_access(generic_cache* cache, int page)
    • Performs the relevant cache operation.
    • Keeps an internal count of number of hits and misses.
    • returns void.
  • cache_analysis(generic_cache* cache)
    • Prints the buffer, total references, number of hits and misses and hit ratio.
    • returns void.
  • cache_print_buffer(generic_cache* cache)
    • Prints the buffer at that current state.
    • returns void.
  • cache_put_array(generic_cache* cache, int pages[], int size)
    • Performs the relevant cache operation for each data item from pages in a linear fashion.
    • returns void.
  • cache_destroy(generic_cache* cache)
    • free the memory allocated by the cache.
    • returns void.

For Cache Initialisation, Pass the appropriate cache_name to the cache_init() method. ( Refer Table for appropriate cache_name )
Example:

  • For Initialising LRU with a capacity of 3, cache_init(LRU, 3);
  • For Initialising TWO_QUEUE with a capacity of 5, cache_init(TWO_QUEUE, 5);.

Benchmarking

  • The data folder, at the root, contains test data generated by DataGenerator.java.
  • We use Google benchmark to benchmark the Cache Replacement Algorithms.
  • To run bench mark, execute the following command
    $ make benchmark
  • This prints the time taken by the cache algorithms along with their respective Hit Ratio.

cache_analysis's People

Contributors

inamul07 avatar narayana-dev 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.