Coder Social home page Coder Social logo

schedviz-linux's Introduction

SchedViz-Linux

A visualizer for exploring the effect of priorities on the Linux scheduler

Implementation

The program starts with creating child processes using fork(). The number of child processes depends on what the COLUMNS variable is set to.

Every child process has an incrementing counter. When the counter reaches the specific priority PERIOD value, the color of the terminal cells changes.

The order of the colors is as follows:
red ๐Ÿ Š green ๐Ÿ Š yellow ๐Ÿ Š blue ๐Ÿ Š purple ๐Ÿ Š cyan ๐Ÿ Š gray ๐Ÿ Š black

Usage

Here, we can see how a process is impacted by the priority. The priority values range from -20 to 19, where -20 is the highest priority and 19 is the lowest. To change the priority of a process, we can use setpriority().

Default task priority (0)

In the first example, we make use of a task's default priority value. We can see that the jobs simply increase their counter and alter their colors in this instance. There appear to be lines moving through the terminal as well. This is because simultaneously started processes will update their colors at the same time.

Lower task priority (19)

When we use a lower priority, we can see that the majority of the processes start in red and change at the same time (and in a different way than before). This is because the processes in the scheduler occur (relatively) infrequent, and they practically are in sync.

It will eventually fall out of sync, but the initial stage is what matters.

Higher task priority (-20)

If we increase the priority to the highest possible value, we can see that the processes move from top to bottom based on color. This means that the top ones are already updating/scheduled while the bottom ones aren't. This is because they get a lot of CPU time, hence high priority.

This too will eventually get out of sync.

License

SchedViz-Linux, and the project this was based on by Moritz KLammler, is released under the MIT License.

schedviz-linux's People

Contributors

wilmox avatar

Stargazers

 avatar

Watchers

 avatar  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.