Skip to content

MehranDanish2/Memory-Paging-Simulator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

4 Commits
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🧠 Virtual Memory Paging Simulator (C++)

A C++ simulation of a virtual memory system using paging and the Least Recently Used (LRU) page replacement algorithm. It handles address translation, page faults, memory allocation, and displays performance stats after simulated memory accesses.


πŸ“˜ Overview

This project models how an operating system manages virtual memory using a paging mechanism. It simulates virtual-to-physical address translation, detects page faults, allocates physical frames, and replaces pages using the LRU algorithm.

Key components include:

  • Page Table Management
  • Frame Table Tracking
  • Random Memory Access Simulation
  • Page Replacement Handling (LRU)
  • Console Reporting of Memory Stats

πŸ“ System Configuration

Configuration Value
Page Size 4096 bytes
Physical Memory 65536 bytes (64 KB)
Virtual Memory 131072 bytes (128 KB)
Physical Frames 16
Virtual Pages 32

✨ Features

  • βœ… Virtual to Physical Address Translation
  • ⚠️ Page Fault Handling
  • πŸ”„ LRU Page Replacement Strategy
  • πŸ“Œ Referenced & Modified Bit Management
  • πŸ“Š Page and Frame Table Display
  • πŸ§ͺ 20 Random Memory Accesses (Read/Write)
  • πŸ“ˆ Performance Statistics (Fault Rate, Usage)

πŸ› οΈ How to Compile & Run

πŸ”§ Compile:

g++ -std=c++11 paging_simulator.cpp -o paging_simulator
▢️ Run:
bash
Copy
Edit
./paging_simulator
πŸ–₯️ Output Example
Virtual & Physical Address Mapping

Page Fault Messages

Frame Allocation Logs

Page Replacements with LRU Info

Final Page Table & Frame Table Display

Page Fault Rate Summary

πŸ“š Educational Use
This simulator is perfect for:

Operating Systems coursework

Visualizing memory management

Learning about paging & LRU in C++

πŸ“„ License
Licensed under the MIT License.

🀝 Contributing
Contributions are welcome! Please open an issue or submit a pull request for improvements or feature ideas.

πŸ“¬ Contact
For issues, suggestions, or questions, feel free to open an issue on the GitHub repository.

About

A C++ simulation of a virtual memory system using paging and LRU page replacement. It translates virtual to physical addresses, handles page faults, manages page/frame tables, and displays performance stats after random memory accesses.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors