Giter Site home page Giter Site logo

algo-sim's Introduction

Scheduling Algorithms in Python

This repository contains Python implementations of four different scheduling algorithms:

  • First Come, First Serve (FCFS)
  • Shortest Job First (SJF)
  • Round Robin (RR)
  • Two Layer Process Time - Waiting Time (TLPS-WT)

Each implementation consists of a Python class that represents a scheduling algorithm, along with a Process class that represents a process that can be scheduled by the algorithm. The implementations include methods for adding processes to the scheduler, executing the scheduler, and calculating the average waiting time of the processes.

Installation

To use these scheduling algorithms, you will need Python 3 installed on your computer. You can download Python 3 from the official website: https://www.python.org/downloads/

Once you have Python 3 installed, you can clone this repository to your local machine using the following command:

git clone https://github.com/HabiburRahman1/scheduler_algorithm_simulation.git

Usage

Each scheduling algorithm implementation is contained in a separate Python file (fcfs.py, sjf.py, and round_robin.py). To use an implementation, you can import the corresponding class into your Python code and create an instance of the class:


from fcfs import FCFS

scheduler = FCFS()

To add processes to the scheduler, you can create Process objects and add them to the scheduler using the add_process method:

from fcfs import FCFS, Process

scheduler = FCFS()

process1 = Process(1, 0, 10)
process2 = Process(2, 2, 5)
process3 = Process(3, 5, 2)

scheduler.add_process(process1)
scheduler.add_process(process2)
scheduler.add_process(process3)

To execute the scheduler and calculate the average waiting time, you can call the execute method and the get_average_waiting_time method:

scheduler.execute()

average_waiting_time = scheduler.get_average_waiting_time()
print("Average waiting time:", average_waiting_time)

Contributing

If you find a bug or would like to suggest an improvement to these scheduling algorithm implementations, please create a GitHub issue or submit a pull request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

I hope this helps! Let me know if you have any questions.

algo-sim's People

Contributors

bithabib avatar

Stargazers

 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.