Skip to content

spyridon97/SJF-FCFS-Schedulers

Repository files navigation

README

This readme provides setup and execution instructions for the implementation of the second assignment of the operating systems class of the department of computer science of the Aristotle Univesity of Thessaloniki; the assignment pertains to the simulation of the scheduling of processes in a CPU (done by the operating system).

Running a simulation

  • To execute the code run it from a command line interface with admin rights using java -jar simulation.jar
  • You will be queried to enter a number of processes to simulate for, in any case the simulation will run the exact time needed until all processes are finished.
  • Select a scheduler to simulate and the program will write output to the xschedulerResults.txt

Execution flow of the program

  • The program is comprised of three packages, an application package, a system package and a scheduler package

  • The application package contains classes necessary to run the simulation

  • The system package contains models of system components such as the clock and the cpu

  • The scheduler package contains the scheduler interface which the other schedulers implement as well as the schedulers themselves

  • Upon starting the program a simulation object is created, system objects are initialized and processes with semi-random variables are generated by the process generator

  • After that the simulation iterates through 100.000 clock cycles or until all processes have been completed

  • In each clock cycle, the system checks for any new processes with that arrival time, the cpu executes the currently running process (Reducing the CPU burst by 1) and the scheduler checks if there needs to be a rescheduling (if the list of ready processes needs to be reordered or if the currently running process needs to be swapped out for another process).

  • Whenever a process is completed statistics are logged for that process

Data Structures used for the Project

Process lists: The simulation keeps two lists of processes:

  • A list of processes that have been generated but not added to the ready que (the NewProcessTemporaryList) and
  • A list of processes to model the ready queue

A process is moved from the temporary queue to the ready queue when the clock cycle is equal to the arrival time of the process. Essentially the temporary represents the processes that have not yet been created by the system, while the ready queue is an in order list of processes. Whenever a process is swapped out of the cpu the first process of the ready que is swapped in. The ordering and structure of the ready queue is always being kept up to date by the scheduler.

Functionally both the NewProcessTemporaryList and the ReadyProcessList are modeled by java ArrayList<>().

Releases

No releases published

Packages

No packages published

Languages