GithubHelp home page GithubHelp logo

scheduler-cpp's Introduction

Load balancing task scheduler

This tool implements a resource allocation system where tasks from different projects are efficiently allocated to available resources based on priorities.

Each resource executes 1 task and the resource is fully occupied until this task is completed. Scheduler balances the computational resources to all projects equally (regardless of queue length, lots of activity on one project does not clog the processing of others)

Priority Functionality

Tasks are allocated based on their assigned priorities. The scheduling algorithm ensures that higher-priority tasks are given precedence over lower-priority tasks. This feature ensures that critical tasks are completed in a timely manner, maintaining efficient resource utilization.

Equal Project Importance

To prevent any single project from disproportionately hogging resources, the scheduler equally distributes resources among all projects. This approach ensures that every project receives fair access to available resources, regardless of the number of tasks or their durations.

Usage

  1. Navigate to the project folder.

  2. Open the terminal in the current directory and run:

       ./bin/main -n <number-of-resources> -p <number-of-projects>
    

The tool accepts the following parameters:

       1. `-n`: Total number of resources available.

       2. `-p`: Total number of projects.

              Default location is the root of this project if not provided by the user.

Both of the parameters are optional but recommended based on the use case. The default values are n=3 and p=5 which can be changed in file src/constants.cpp

Example 1: For Number of resources = 12 Number of projects = 50

     ./bin/main -n 12 -p 50

Example 2: This will run the program with default values: Number of resources = 3 Number of projects = 5

     ./bin/main

Task simulation

Arrival of tasks and completion of tasks has been simulated to verify the functionality. Tasks are generated randomly with a random number denoting its priority. Tasks are also completed randomly for simulation.

Stopping the Program

The program can be stopped by sending an interrupt signal using Ctrl + C in the terminal where it is running. Upon receiving the interrupt signal, the program will gracefully terminate and clean up any resources that were in use.

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.