This repository contains a virtual memory manager program implemented in C++. The program simulates a virtual memory system with a translation lookaside buffer (TLB) and a page table. It takes input addresses from a file and translates them to physical addresses using the TLB and page table.
- Translation Lookaside Buffer (TLB) with a size of 16 entries.
- Page table with a size of 256 entries.
- Physical memory with a size of 65536 bytes.
- Supports reading addresses from a .txt file.
- Simulates values stored at physical addresses using a .bin file
- Calculates TLB hit rate and page table hit rate.
-
Clone the repository:
git clone https://github.com/your-username/Virtual-Memory-Manager.git
-
Compile the
virtualmemorymanager.cpp
file using a C++ compiler:g++ virtualmemorymanager.cpp -o virtualmemorymanager
-
Generate the physical memory file using the
datagen.cpp
file:g++ datagen.cpp -o datagen ./datagen
-
Create a file named
inputs.txt
and populate it with the virtual addresses you want to translate. Each address should be on a new line. -
Run the
virtualmemorymanager
executable:./virtualmemorymanager
-
The program will read the virtual addresses from the
inputs.txt
file, translate them to physical addresses using the TLB and page table, and display the results on the console. -
The TLB hit rate and page table hit rate will be calculated and printed at the end of the execution.
virtualmemorymanager.cpp
: Contains the main implementation of the virtual memory manager program. It reads virtual addresses from a file, performs address translation, and displays the results.datagen.cpp
: Generates the physical memory file (physical_memory.bin
) filled with random data. This file is required for the virtual memory manager program to function properly.
Contributions to this virtual memory manager project are welcome. If you find any issues or have suggestions for improvements, please open an issue or submit a pull request.
This project is licensed under the MIT License.