Giter VIP home page Giter VIP logo

linux-tlb-addressing's Introduction

On-demand paging

On-demand paging using translation lookaside buffer.

Description

This repository contains a very simple simulation of an on-demand paging system, insipred by Virtual Memory management system for Linux.

This simulation aims at performing virtual to physical memory address translation, utilizing a translation lookaside buffer (TLB).

We create a virtual memory space of addresses, a TLB of 16 entries, and a single-layer page table (we assume that the page table is of unlimited space).

Then, we read a series of logical addresses from the addresses file in which all addresses are stored as unsigned integer numbers and we convert then into physical addresses.

Every logical address consists of:

  • an 8-bit page number
  • an 8-bit offset (within the page)

After an address is read from the file, we search for it in the TLB. We consider the 2 following cases:

  • Page fault. In this case, if the address does not exist in the page table, we open the binary content file, we read the corresponding page, we store it both in the TLB and the page table and we extract the signed byte which is stored in this physical address.
  • Page hit. In this case, we just extract the signed byte which is stored in the corresponding physical address.

The TLB is updated using the Least Recently Used (LRU) policy.

For every logical address we read from the file, we print:

  • The logical address read
  • The physical address to which the logical address is translated
  • The signed byte which is stored in the corresponding physical address

In the end, we print the following statistics:

  • The page fault ratio
  • The TLB hit ratio

Execution

In order to execute the software, use a Terminal Emulator and navigate to the src directory.

Then, to compile and build the software type the following command:

make

After you have successfully built the software, execute it using the following command:

./vmm DIRECTORY PAGE_TABLE_SIZE

where:

  • DIRECTORY is the path to the directory which contains both the address file and the page file
  • PAGE_TABLE_SIZE is the size of the page table and must be a positive power of 2 and at least equal to 256

For example, to execute the software using a the relative path to the default files directory and a page table of 512 frames, use the following command:

./vmm ../files 512

linux-tlb-addressing's People

Contributors

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