Skip to content

Real-time process scheduling simulator using the Rate-Monotonic (rate) and Earliest-Deadline-First (edf) algorithms for scheduling strategies

License

Notifications You must be signed in to change notification settings

brunoribeirol/cpu-scheduling

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Status

Repository Size Language Count Commit Activity License

Real-time CPU Scheduling Simulation

👀 Overview

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.

📝 Input File Format

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

🛠️ Build Instructions

  1. Ensure you are on a Linux, Unix, or macOS system.
  2. Compile using make with the desired algorithm name as a parameter:
    • Rate-Monotonic:
      make rate
    • Earliest-Deadline-First:
      make edf

⚙️ Execution

Run the compiled executable with the input file:

  • For Rate-Monotonic:
    ./rate [input_file]
  • For Earliest-Deadline-First:
    ./edf [input_file]

📥 Example Input

For example, given an input file named input.txt with the following content:

165
T1 50 25
T2 80 35

📤 Output File

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

🧪 Test Instructions

  • 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
  • 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
    
    

About

Real-time process scheduling simulator using the Rate-Monotonic (rate) and Earliest-Deadline-First (edf) algorithms for scheduling strategies

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published