Giter Site home page Giter Site logo

timgarvin / process-scheduler_-_shortest-job-first-version Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 7 KB

Schedules a set of simulated processes in a single processor system and a multi-processor system using the Shortest Job First (SJF) scheduling algorithm.

C++ 100.00%
c-plus-plus c-plus-plus-11 process-scheduler process-scheduler-simulator multithreading multi-threading doubly-linked-list vector vectors normal-distribution randomization data-structure data-structures linux putty winscp

process-scheduler_-_shortest-job-first-version's Introduction

Description

This C++11 program simulates the scheduling of a set of k processes in a single processor system and also a multi-processor system using the Shortest Job First (SJF) scheduling algorithm (the optimal algorithm choice for minimizing process waiting times). In this case, k = 50, but this program is also generalized enough to allow user input to define k instead. All that would be needed is the implementation of a user prompt. Each "process" is generated in a Doubly Linked List using a normal distribution function to randomize the cycles and memory footprints. Each node ("process") in the Doubly Linked List stores the process ID, the randomly generated number of CPU cycles, and the randomly generated memory footprint for each process. Each node ("process") in the Doubly Linked List also stores a pointer to the next node ("process") and the previous node ("process") in the Doubly Linked List of processes. I chose the Doubly Linked List as my data structure because it's about as simple as a Linked List, but is more optimized because you can go forwards or backwards through the Doubly Linked List. This helps to minimize the number of times you need to traverse through the Doubly Linked List of processes. Since the number of traversals through the Doubly Linked List are minimized, when compared to the more traditional Linked List data structure, this also should improve general runtime and actual execution time.

Compilation and Execution

  • Compile: g++ -std=c++0x 'process-scheduler-(sjf).cpp' -o 'process-scheduler-(sjf)'
  • Run Program: ./'process-scheduler-(sjf)'

Program Output

  • This program prints output to the screen and also to two separate files: 'SJF Output (multi-processor).txt' and 'SJF Output (single processor).txt'.
    • The screen output lists the values for each process generated.
    • The file outputs lists each step taken during the process scheduling process and the resulting Average Waiting Times and Total Cycles.

Technologies Used

  • C++11
  • Linux
  • PuTTY
  • WinSCP

Data Structures Used

  • Doubly Linked List

Notes

  • This program should be compiled and executed in a Linux Operating System environment.

process-scheduler_-_shortest-job-first-version's People

Contributors

timgarvin avatar

Watchers

 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.