This project is a Python-based interactive Jupyter Notebook that simulates memory allocation using the First Fit algorithm and Round-Robin CPU scheduling. It features a GUI built with ipywidgets, matplotlib for real-time visualization, and a benchmarking component to analyze performance.
Process
Class: Represents a job with attributes for size and remaining execution time.MemoryNode
Class: Inherits from a generic doubly linked list Node
class to represent individual memory blocks (either free or allocated to a Process
).Memory
Class: The memory manager. It maintains a linked list of MemoryNode
s and implements the core algorithms:allocate(process)
: Implements the First Fit algorithm by traversing the list to find the first free block large enough.coalesce()
: Merges adjacent free memory blocks to reduce external fragmentation.compact()
: Rearranges memory by moving all allocated blocks to one end.Processor
Class: The CPU scheduler. Its run()
method contains the main simulation loop, implementing Round-Robin scheduling with a time quantum of 1. It orchestrates process allocation, execution, deallocation, and triggers memory management routines at specified intervals.