Giter Site home page Giter Site logo

datbk206 / cpu-scheduling-simulation Goto Github PK

View Code? Open in Web Editor NEW

This project forked from sarracini/cpu-scheduling-simulation

0.0 1.0 0.0 319 KB

Some C programs to simulate three CPU scheduling algorithms for a multi-core computing system consisting of four homogeneous CPU’s

License: MIT License

C 100.00%

cpu-scheduling-simulation's Introduction

CPU-Scheduling-Simulation

Some C programs to simulate three CPU scheduling the following three algorithms for a multi-core computing system consisting of four homogeneous CPU’s:

  • FCFS (first-coming-first-serving) scheduling.
  • RR (round robin) scheduling with time quantum q=2 milliseconds, q=12 milliseconds, q=50 milliseconds, respectively.
  • Three-level feedback-queue (FBQ) preemptive scheduling with q1=10 milliseconds and q2=30 milliseconds, respectively.

Program will calculate and answer all the following questions for each of the above CPU schedulers:

  1. What is the average waiting time?

  2. What is the average turnaround time?

  3. When does the CPU finish all these processes? What is average CPU utilization by this time point? (At any time instance, CPU utilization is 400% if all 4 CPUs are running, 300% if only 3 CPUs are running, 200% for 2 CPUs, 100% for only 1 CPU, 0% if no CPU is running.)

  4. How many context switches occur in total during the execution?

  5. Which process is the last one to finish?

Build

Compile with:

$ gcc fcfs.c input_output.c
$ gcc rr.c input_output.c
$ gcc fbq.c input_output.c

Notes

Sample static CPU workload (CPULoad.dat) is given to run with each file.

Usage

Run first come first serve with:

$ fcfs  < CPULoad.dat

Run round robin with any time slice:

$ rr 2  < CPULoad.dat

Run three level feedback queue with any two time slices:

$ fbq 10 30  < CPULoad.dat

License

MIT © Ursula Sarracini

cpu-scheduling-simulation's People

Contributors

sarracini avatar

Watchers

James Cloos avatar

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.