A professional desktop application that simulates Memory Allocation using Segmentation, built for Operating Systems coursework.
- Segmentation-based memory management with real-time visualization
- Two allocation algorithms: First Fit & Best Fit
- Dynamic process creation with configurable segments
- Automatic hole merging on deallocation
- Rollback support — if any segment fails, entire allocation is undone
- Three-panel GUI: Controls | Memory Map | Data Tables
- Dark modern theme with smooth, professional styling
- Live statistics: total/used/free memory, fragmentation percentage
- Export screenshots of the memory visualization
- Complete input validation and error handling
Each memory block displays:
- Segment name and owning process
- Start and end addresses
- Block size in KB
- Color coding: purple/blue/green for processes, gray dashed for holes, dark for reserved
| Component | Technology |
|---|---|
| Language | Python 3.10+ |
| GUI Framework | PySide6 (Qt 6) |
| Packaging | PyInstaller |
| Architecture | Clean OOP (MVC-like) |
memory assignment/
├── main.py # Application entry point
├── requirements.txt # Python dependencies
├── test_cases.py # Automated test suite (10 tests)
├── build_exe.py # Standalone EXE build script
├── README.md # This file
├── models/ # Data model classes
│ ├── __init__.py
│ ├── segment.py # Segment (name, size, base address)
│ ├── process.py # Process (name, list of segments)
│ ├── hole.py # Hole (start address, size)
│ └── memory_block.py # MemoryBlock + BlockType enum
├── core/ # Business logic engine
│ ├── __init__.py
│ └── memory_manager.py # MemoryManager (allocation, deallocation, merging)
└── gui/ # GUI layer
├── __init__.py
├── styles.py # Dark theme QSS stylesheet
├── memory_view.py # Custom memory visualization widget
└── main_window.py # Main application window
- Python 3.10 or newer
- pip package manager
# 1. Install dependencies
pip install -r requirements.txt
# 2. Run the application
python main.py
# 3. (Optional) Run tests
python test_cases.py# Generate a standalone executable
python build_exe.pyThe executable will be created in the dist/ folder. You can distribute it without requiring Python to be installed.
pyinstaller --onefile --windowed --name "MemoryAllocSimulator" main.pyScans holes in address order and allocates the segment to the first hole large enough to hold it.
- Advantage: Fast — stops at the first suitable hole.
- Disadvantage: Tends to fragment the beginning of memory.
Scans all holes and selects the smallest hole that can fit the segment.
- Advantage: Minimizes wasted space per allocation.
- Disadvantage: Slower scan; can produce many tiny unusable holes.
If a process has multiple segments and any segment cannot be allocated, the entire process allocation is rolled back — all partially allocated segments are freed and holes are restored to their pre-allocation state.
Run them: python test_cases.py
- Operating Systems Course — University Project
This project is for educational purposes.