This simulator was created for my CMP 426 - Operating Systems project. It simulates the execution of tasks on the CPU with varying scheduling algorithms in real time.
To run this program from the command line, first compile with javac
,
then run with java
, supplying the proper arguments:
java src/os/Driver /path/to/input_file.txt time_slice
javac src/os/Driver
java src/os/Driver ./input.txt 2
The input file should contain space-separated values containing the Process Name (or Process ID), the arrival time, and the CPU burst time.
P0 0 4
P1 1 2
A sample input file is provided in the repository.
This program simulates the execution of the tasks in real time. Therefore, a task that whose burst time is 5 will take 5 real seconds to execute in simulation. You may change the speed of the simulation by supplying a third argument to the program with the amount of time (in milliseconds) that a simulation second should take.
java os/Driver ./input.txt 2 500
The above example will cause each simulation second to last 0.5 real seconds (or 500 milliseconds).
For instantaneous execution, this value should be set to zero.
In the future I plan to implement additional scheduling algorithms, such as Multilevel Feedback Queue.