Led a 3-person team in the design and implementation of this project.
This project was developed as part of the 2025-2026 Fall Semester Operating Systems Course, with the goal of simulating the task scheduling logic of the FreeRTOS kernel in a PC (Linux/POSIX) environment.
The project implements a 4-level priority queue structure and a Multi-level Feedback Queue (MLFQ) scheduling algorithm for managing both Real-Time and User tasks.
The simulation is built around a structure called the "Dispatcher", which operates according to the following rules:
-
Real-Time Tasks (Priority 0):
- Operates on FCFS (First Come First Served) logic.
- Has the highest priority.
- Executed without interruption (non-preemptive) until completion.
-
User Tasks (Priority 1, 2, 3):
- Operates in a three-level Multi-level Feedback Queue structure.
- Time Quantum (q): 1 second.
- If a task runs for 1 second without completing, its priority is decreased (e.g. P1 -> P2).
- If all tasks drop to the lowest level (Priority 3), Round Robin scheduling takes over.
This project has been tested on both Linux and Windows platforms and was developed using the following compiler versions:
Both the Linux binary and the Windows .exe file (via cross-compilation) were produced in this environment.
- Linux Compiler (GCC):
gcc (GCC) 15.2.1 20251211 - Windows Cross Compiler (MinGW-w64):
x86_64-w64-mingw32-gcc (GCC) 15.2.1 20250808
Environment used for native compilation on Windows as an alternative:
- Windows Compiler (MSYS2):
gcc (Rev2, Built by MSYS2 project) 14.2.0
The project directory structure is as follows:
FreeRTOS_PC_Scheduler/
bin/ # Compiled output files
FreeRTOS/ # FreeRTOS kernel source files
include/ # Project header (.h) files
common.h
FreeRTOSConfig.h
job_loader.h
job_queue.h
job_worker.h
scheduler.h
xtask.h
lib/ # External libraries
src/ # Source (.c) files
job_loader.c
job_queue.c
job_worker.c
main.c
scheduler.c
xtask.c
giris.txt # Simulation input data
Makefile # Build configuration
README.md # Project documentation
This project was prepared using POSIX standards. The following steps can be used to compile the project:
Open a terminal in the project directory and run the following command:
make # Linux/WSL Environment
mingw32-make # Windows EnvironmentThis will produce an executable named freertos_sim.
To clean previous builds:
mingw32-make clean # Windows
make clean # LinuxTo start the simulation, pass the compiled program and the task list text file as an argument:
# If you are using Windows:
.\bin\windows\freertos_sim.exe .\giris.txt
# If you are using Linux/WSL:
./bin/linux/freertos_sim giris.txtEach line in the file represents one task, in the following format:
<arrival_time>, <priority>, <duration>
Example:
12, 0, 1 (arrives at second 12, Priority 0 (RT), duration 1s)
12, 1, 2 (arrives at second 12, Priority 1 (User), duration 2s)
13, 3, 6 (arrives at second 13, Priority 3 (User), duration 6s)
When the program runs, you will see the task states and color-coded output in the terminal. Below is the output produced by the provided giris.txt file:
