Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: CI - Test Assembly Implementation

on:
push:
pull_request:
branches: [ main, master ]

jobs:
test-task1:
name: Test Task 1 (Unidimensional)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y gcc-multilib make python3
- name: Build Task 1
run: make task1
- name: Run Task 1 Tests
run: python3 scripts/checker.py task1

test-task2:
name: Test Task 2 (Bidimensional)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y gcc-multilib make python3
- name: Build Task 2
run: make task2
- name: Run Task 2 Tests
run: python3 scripts/checker.py task2
21 changes: 21 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Compiler and flags
AS = gcc
ASFLAGS = -m32 -no-pie

# Directories
SRC_DIR = src
BIN_DIR = .

# Targets
all: task1 task2

task1: $(SRC_DIR)/task1.s
$(AS) $(ASFLAGS) $< -o $(BIN_DIR)/$@

task2: $(SRC_DIR)/task2.s
$(AS) $(ASFLAGS) $< -o $(BIN_DIR)/$@

clean:
rm -f task1 task2

.PHONY: all clean
73 changes: 54 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,28 +1,63 @@
# Informatii utile
# Contiguous Memory Allocation Simulator (x86 Assembly)

Rezolvarea temei de laborator la materia Arhitectura sistemelor de calcul din anul universitar 2024 - 2025 Universitatea Bucuresti.
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.

## Explicatie a fiecarui folder
## Project Overview

- Folderul "Cerinta temei":
Contine doar fisierul unde este prezentata cerinta impreuna cu niste exemple.
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:

- Folderul "Date de intrare":
Contine un folder numit "tests" unde se gasesc o serie de input-uri (si output-urile folosite de scripturile de verificare) care au fost oferite pentru a ne verifica tema inainte de predarea acesteia.
- **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 `CONCRETE` operation is not implemented in this version.

- Folderul "Scripturi de verificare pentru Linux sau masina virtuala de Linux":
Contine script-urile folosite pentru verificarea temei pentru testarile facute direct pe Linux sau pe o masina virtuala de Linux.
## Supported Operations

- Folderul "Scripturi de verificare pentru Windows Subsystem for Linux (WSL)":
Contine script-urile folosite pentru verificarea temei pentru testarile facute pe Windows Subsystem for Linux (WSL).
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.*

- Folderul "Tema (deja compilata)":
Contine cele doua programe scrise in assembly x86_32 sintaxa AT&T deja compilate care indeplinesc cerintele care se pot gasi in folderul mentionat mai sus (puncte 80 / 100 --> OPERATIA CONCRETE NU ESTE IMPLEMENTATA).
## Repository Structure

- Folderul "Tema (source code)":
Contine cele doua fisiere cu codul assembly x86_32 sintaxa AT&T din care au fost compilate programele din folder-ul anterior.
- `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.

- Folderul "TEMA GATA DE FOLOSIT":
Cum sugereaza numele folder-ul contine necesarul pentru corecta functionare a celor doua programe impreuna cu script-urile de verificare, astfel se poate rula script-ul direct in acest folder, acesta fiind gata de utilizat. Pentru mai multe informatii in legatura cu script-ul faceti referinta la link-ul de mai jos.
______________________________________________________________________________________________________________________________________________________________________________________
## **Consultati urmatorul link pentru alte informatii utile:** https://github.com/iancuivasciuc/csa/tree/master/project
## Getting Started

### Prerequisites

To build and run this project, you need:
- A Linux environment (or WSL on Windows).
- `gcc` with 32-bit support (`gcc-multilib`).
- `make` and `python3`.

### Building the Project

Run the following command in the root directory:
```bash
make
```
This will generate two executables: `task1` and `task2`.

### Running Tests

You can use the provided checker script to verify the implementation:
```bash
python3 scripts/checker.py
```

## Technical Details

- **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.

## License

This project was developed as part of the Computer Systems Architecture (ASC) course at the University of Bucharest, 2024-2025.

This file was deleted.

This file was deleted.

Loading
Loading