This project implements a real-time process scheduling simulator using the Rate-Monotonic (rate) and Earliest-Deadline-First (edf) algorithms for scheduling strategies. The program reads a set of tasks as input. Then it simulates the execution of these tasks in a real-time environment, following either the rate
or edf
scheduling algorithms.
The input file should have the following format:
[TOTAL TIME]
[TASK NAME 1] [PERIOD 1] [CPU BURST 1]
[TASK NAME 2] [PERIOD 2] [CPU BURST 2]
...
[TASK NAME n] [PERIOD n] [CPU BURST n]
[TOTAL TIME]
: Total simulation time.- Should be an integer
[TASK NAME i]
: Name of the i-th task.[PERIOD i]
: Period of the i-th task.- Should be an integer
[CPU BURST i]
: CPU burst time for the i-th task.- Should be an integer
- Ensure you are on a Linux, Unix, or macOS system.
- Compile using
make
with the desired algorithm name as a parameter:- Rate-Monotonic:
make rate
- Earliest-Deadline-First:
make edf
- Rate-Monotonic:
Run the compiled executable with the input file:
- For Rate-Monotonic:
./rate [input_file]
- For Earliest-Deadline-First:
./edf [input_file]
For example, given an input file named input.txt
with the following content:
165
T1 50 25
T2 80 35
The output file should be names as algorithm.out
, where algorithm
is the schedulling strategy addopted (rate
or edf
). The format follows strict guidelines as provided in the assignment.
EXECUTION BY RATE
[T1] for 25 units - F
[T2] for 25 units - H
[T1] for 25 units - F
[T2] for 5 units - L
[T2] for 20 units - H
[T1] for 25 units - F
[T2] for 15 units - F
idle for 10 units
[T1] for 15 units - K
LOST DEADLINES
[T1] 0
[T2] 1
COMPLETE EXECUTION
[T1] 3
[T2] 1
KILLED
[T1] 1
[T2] 1
-
First, ensure the file has execution permissions. You can do this with the
chmod
command:chmod +x test.sh
-
Then you need to run the
make
commands to generate the executables:make rate
make edf
-
After that, you can run the script with the command:
- If you want to run all tests:
./test.sh all
- If you want to run a specific test:
-
./rate tests/rate/input/[number_of_test].txt
./rate tests/rate/input/04.txt
-
./edf tests/edf/input/[number_of_test].txt
./edf tests/edf/input/12.txt
-
- If you want to run all tests:
-
The folder should be organized as follows:
. ├── Makefile ├── real.c ├── edf ├── rate ├── test.sh ├── tests │ ├── edf │ │ ├── input │ │ │ ├── 01.txt │ │ │ ├── N.txt │ │ ├── out │ │ │ ├── 01.txt │ │ │ ├── N.txt │ ├── rate │ │ ├── input │ │ │ ├── 01.txt │ │ │ ├── N.txt │ │ ├── out │ │ │ ├── 01.txt │ │ │ ├── N.txt