This project simulates a real-time thread scheduling system using native POSIX threads (pthreads) in C++. It implements three fundamental scheduling strategies:
- FIFO (First-In-First-Out)
- EDF (Earliest Deadline First)
- RM (Rate Monotonic Scheduling)
The goal is to emulate real-time operating system behavior, manually controlling when threads are allowed to run, preempt, or terminate — rather than relying on the OS scheduler.
- Thread lifecycle control with
pthread_cond_tandpthread_mutex_t - Simulation of three major real-time scheduling algorithms
- Deadline and period enforcement via timestamp comparison
- Preemption handling and safe task switching
- Logs and traces to validate scheduler behavior over 240 intervals
- Thread coordination via
resume,init, andpreemptconditions
- Picks the first thread from the ready queue.
- No preemption — the current thread runs until it completes its task.
- Always runs the thread with the earliest deadline.
- Supports preemption — if a new thread arrives with a closer deadline, the current task is interrupted.
- Priority is based on the shortest period.
- Like EDF but with static priority assignment.
- Requires manual implementation of preemptive logic (optional for extra credit).
- Linux/macOS (POSIX-compatible)
g++with-pthreadand C++17 support
make
./main <0|1|2>
# 0 = FIFO, 1 = EDF, 2 = RM