GithubHelp home page GithubHelp logo

zachstence / schedulersimulator Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 1.0 448 KB

A C++ program that simulates various scheduling algorithms. Done as a part of CS 4328 Operating Systems.

C++ 100.00%

schedulersimulator's Introduction

SchedulerSimulator

A C++ program that simulates various CPU scheduling algorithms. This project was done as part of my CS 4328 Operating Systems class at Texas State University. I have included the assignment sheet on the repository, and plan on adding more features to my code in the future as a fun exercise.

Downloading

Simply clone my GitHub repository and you have all the code ready to go. No extra requirements to install.

$ git clone https://github.com/zachstence/SchedulerSimulator

Running Simulations

First, compile the main class

$ g++ main.cpp

One scheduler at a time

To simulate one scheduling algorithm with a specified arrival rate, service time and quantum length (only used in RR), run the following command, choosing from the following algorithms

  1. First Come First Serve (FCFS)
  2. Shortest Remaining Time First (SRTF)
  3. Highest Response Ratio Next (HRRN)
  4. Round Robin (RR) with specified quantum length

$ ./a.out <scheduler> <arrival rate> <service time> <quantum length>

For example:

$ ./a.out 2 10 0.06 0.01
 Avg. Turnaround Time :  0.094
           Throughput :  9.933
        Avg. CPU Util :  0.593
  Avg. in Ready Queue :  0.344

All schedulers with results saved

To simulate all the scheduling algorithms with arrival rates from 1-30 processes/second, a service time of 0.06 seconds, and quantum lengths of 0.01 and 0.2 seconds (for round robin), simply provide '-1' as the scheduler choice

$ ./a.out -1
Simulating FCFS...done
Simulating SRTF...done
Simulating HRRN...done
Simulating RR(0.01)...done
Simulating RR(0.2)...done
Finished all simulations.

The results will be saved in 5 CSV files, each named for its corresponding scheduler. The CSV files have 4 columns (arrival rate, average turnaround time, throughput, and average processes in the ready queue), each holding values for a different iteration. These files can then easily be imported into a spreadsheet application to make graphs from the CSV results like I have included on this repo.

Report

I have written a short report detailing my observations based on the output of my code and the graphs I have generated.


Zach Stence, 3/29/2019

schedulersimulator's People

Contributors

zachstence avatar

Stargazers

Aly Hussein  avatar

Watchers

James Cloos avatar  avatar

Forkers

enemerson

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.