This repository contains an x86 (32-bit) assembly implementation of a contiguous memory allocation system. It simulates how an operating system manages memory blocks or how a file system allocates space on a disk.
The simulator models a memory space (8MB total) divided into blocks of 8KB. For the purpose of this simulation, the logic is scaled down to 1024 addressable units. The project consists of two main tasks:
- Task 1: Unidimensional Memory Allocation Simulates a 1D memory array where files are allocated contiguously using a First-Fit strategy.
- Task 2: Bidimensional Memory Allocation
Extends the simulation to a 2D memory grid (matrix). Note: The
CONCRETEoperation is not implemented in this version.
The simulator supports the following commands:
- ADD (1): Allocate a contiguous range of blocks for a file.
- GET (2): Retrieve the start and end indices of a file.
- DELETE (3): Free all blocks associated with a specific file.
- DEFRAGMENTATION (4): Reorganize memory to eliminate external fragmentation by moving all allocated files to the beginning of the memory space.
- CONCRETE (5 - Task 2 only): Not implemented.
src/: Contains the x86 assembly source code (task1.s,task2.s).tests/: Input and expected output files for automated testing.scripts/: Python scripts for testing (checker.py) and generating test cases (generator.py).docs/: Original project requirements in Romanian (PDF).Makefile: Build instructions for compiling the assembly code.
To build and run this project, you need:
- A Linux environment (or WSL on Windows).
gccwith 32-bit support (gcc-multilib).makeandpython3.
Run the following command in the root directory:
makeThis will generate two executables: task1 and task2.
You can use the provided checker script to verify the implementation:
python3 scripts/checker.py- Language: x86 Assembly (32-bit, AT&T Syntax).
- System Calls: Uses Linux system calls for I/O and file management.
- Memory Strategy: First-Fit for contiguous allocation.
This project was developed as part of the Computer Systems Architecture (ASC) course at the University of Bucharest, 2024-2025.