GithubHelp home page GithubHelp logo

mnwrhsn / scheddl Goto Github PK

View Code? Open in Web Editor NEW

This project forked from dahallgren/scheddl

0.0 1.0 0.0 8 KB

Python API for Linux SCHED_DEADLINE scheduler

License: MIT License

C 79.99% Python 20.01%

scheddl's Introduction

scheddl - SCHED_DEADLINE for Python

SCHED_DEADLINE is a CPU scheduler available in the Linux kernel since version 3.14 based on the Earliest Deadline First (EDF) and Constant Bandwidth Server (CBS) algorithms, supporting resource reservations: each task scheduled under such policy is associated with a budget Q (aka runtime), and a period P, corresponding to a declaration to the kernel that Q time units are required by that task every P time units, on any processor. This makes SCHED_DEADLINE particularly suitable for real-time applications, like multimedia or industrial control, where P corresponds to the minimum time elapsing between subsequent activations of the task, and Q corresponds to the worst-case execution time needed by each activation of the task.

scheddl is a module that provides a Python API for the Linux SCHED_DEADLINE scheduler.

Requirements

  • Linux kernel >= 3.14

Example

Here is how to set the current scheduler to SCHED_DEADLINE and run a periodic task each 50 ms.

import scheddl

dl_args = (
    20 * 1000 * 1000, # runtime in nanoseconds
    50 * 1000 * 1000, # deadline in nanoseconds
    50 * 1000 * 1000  # time period in nanoseconds
)

scheddl.set_deadline(*dl_args)

while True:
    periodic_task(*args, **kwargs)
    scheddl.sched_yield()

The SCHED_RESET_ON_FORK flag could be passed with scheddl.RESET_ON_FORK as an optional fourth argument to scheddl.set_deadline.

scheddl.set_deadline(20000000, 50000000, 50000000, scheddl.RESET_ON_FORK)

When this flag is set, children do not inherit privileged scheduling policies, SCHED_DEADLINE in this case.

Documentation

See man pages for sched(7), sched_setattr(2)

scheddl's People

Contributors

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