Code Monkey home page Code Monkey logo

lru-page-replacement-algorithm's Introduction

Least Recently Used Page Replacement Algorithm - LRU

This is an implementation of the Least Recently Used (LRU) page replacement algorithm.

Overview

This is a C program that implements the Least Recently Used (LRU) page replacement algorithm. The program reads a file containing a list of memory references, and simulates how the memory management system would operate with a given number of physical pages and page size.

Usage

The program calculates the number of page faults for a sequence of memory references (i.e., the memory reference trace in the .mem-files) when using the Least Recently Used (LRU) page replacement policy.

The program takes the number of physical pages, the page size, and the name of the trace file:

./lru no_phys_pages page_size filename

The program then returns the resulting number of page faults for that specific combination of number of pages and page size, for either mp3d.mem or mult.mem. Example execution:

 ./lru 4 256 mp3d.mem

Output:

No physical pages = 4, page size = 256
Reading memory trace from mp3d.mem... Read 100000 memory references
Result: 9218 page faults

Contributing

Contributions to this project are welcome. If you find a bug or want to suggest an improvement, please open an issue or submit a pull request. Or email me here: [email protected]

License

This code is released under the MIT License.

lru-page-replacement-algorithm's People

Contributors

frhd143 avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  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.