Skip to content

AlinaaZaharia/Cache-Memory-Simulator-Python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

1 Commit
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Cache Memory Simulator

A desktop application built with Python and Tkinter that emulates different cache memory configurations, mapping techniques, and replacement/write policies.

πŸ“Œ Description

This project simulates the behavior of various cache memory architectures and policies to help understand their impact on memory access performance.

The simulator supports:

  • Direct-mapped cache
  • Fully associative cache
  • Set-associative cache (configurable ways)
  • Replacement policies: Least Recently Used (LRU), First-In-First-Out (FIFO), and Random
  • Write policies: Write-Back and Write-Through
  • Performance metrics: Cache hit/miss rate

🧠 Features

  • Desktop GUI using Tkinter
  • Custom cache configuration (size, block size, mapping type, policies)
  • Dynamic visualization of cache and main memory state
  • Read and write operations with real-time cache updates
  • Statistics tracking for hits and misses
  • Displays tag, valid and dirty bits for each cache line

πŸ”§ Technologies Used

  • Python 3.10+
  • Tkinter (GUI)
  • Object-Oriented Programming
  • Simulation algorithms for cache mapping and replacement
  • Data structures: lists, sets, dictionaries

πŸ—οΈ Project Structure

  • cache/ – core cache functionality (Cache, Line, MainMemory)
  • mappings/ – implementations for direct, set-associative, and fully associative mapping
  • replacement_policies/ – strategy modules: LRU, FIFO, Random
  • write_policies/ – logic for Write-Back and Write-Through
  • gui/ – Tkinter-based interface (SimulatorFrame)
  • utils/ – helpers for formatting, performance calculation

πŸ–₯️ User Interface

The application provides:

  • A configuration panel for:
    • Cache type selection
    • Block/cache size
    • Replacement and write policies
  • Buttons to start simulation, read data, write data
  • Live view of memory blocks and cache lines
  • Dashboard showing hit/miss stats

πŸ“ˆ Performance Metrics

  • Hit Rate: Percentage of memory accesses served from cache
  • Miss Rate: Percentage of memory accesses served from main memory
  • Live counters updated during each operation

πŸš€ Future Improvements

  • Add support for trace file imports
  • Enable cache flush and reset operations
  • Export stats to CSV or Excel
  • Add animations for memory block movement
  • Improve layout and styling with custom themes

πŸ“š References


About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages