Skip to main content

An implementation of the response-time analyses (RTAs) verified by the PROSA project

Project description

pyRTA — Response-Time Analysis in Python

The Python response-time-analysis package (pyRTA) implements the response-time analyses (RTAs) formally verified in the PROSA project.

It provides Python models for real-time task parameters (arrivals, execution, deadlines, priorities) and ready-to-use analyses for fixed-priority (FP), earliest-deadline-first (EDF), and FIFO schedulers, including support for non-preemptive segments and restricted-supply models.

Features and Design

  • Arrival models: periodic, periodic with jitter, sporadic, and arbitrary arrival curves, expressed either as minimum-separation vectors (i.e., "delta-min vectors") or as a list of steps and a prefix horizon.
  • Preemption models: fully preemptive, fully non-preemptive, floating non-preemptive segments, and segmented limited-preemptive.
  • Supply models: ideal processor and rate-delay model.
  • Analyses: FP, EDF, and FIFO response-time analysis.
  • Discrete time: pyRTA uses a discrete time model (model.Duration is an alias of int). Task parameters should be specified using an appropriate resolution (e.g., in nanoseconds or processor cycles).

Installation

pyRTA is a pure Python package that can be installed from PyPI.

With the uv package manager (recommended):

uv add response-time-analysis

With pip:

pip install response-time-analysis

Quickstart

Compute a response-time bound for a task under fixed-priority (FP), earliest-deadline-first (EDF), and first-in-first-out (FIFO) scheduling on an ideal uniprocessor:

from response_time_analysis import edf, fifo, fp
from response_time_analysis.model import (
    WCET,
    Deadline,
    FullyPreemptive,
    IdealProcessor,
    Periodic,
    Priority,
    Task,
    taskset,
)

# Two periodic tasks with implicit deadlines; higher priority has the larger numeric value as in Linux
tsk1 = Task(Periodic(period=5), FullyPreemptive(WCET(1)), Deadline(5), Priority(2))
tsk2 = Task(Periodic(period=10), FullyPreemptive(WCET(6)), Deadline(9), Priority(1))

supply = IdealProcessor()

tasks = taskset(tsk1, tsk2)

# RTA assuming uniprocessor fixed-priority scheduling.
solution = fp.rta(tasks, tsk2, supply)
assert solution.bound_found()
assert solution.response_time_bound == 8

# RTA assuming uniprocessor earliest-deadline first scheduling.
solution = edf.rta(tasks, tsk2, supply)
assert solution.bound_found()
assert solution.response_time_bound == 7

# RTA assuming uniprocessor FIFO scheduling.
solution = fifo.rta(tasks, supply)
assert solution.bound_found()
assert solution.response_time_bound == 7

# Use the horizon parameter to prevent the RTA from diverging.
tsk3 = Task(Periodic(period=9), FullyPreemptive(WCET(3)), Deadline(20), Priority(3))
overload = taskset(tsk1, tsk2, tsk3)
solution = fifo.rta(overload, supply, horizon=1000)
assert solution.bound_found() is False
assert solution.search_space is None
assert solution.response_time_bound is None

See the test cases in tests/test_usage_examples.py for further examples.

Development

  • Run tests with uv run pytest
  • Type-check with uvx basedpyright
  • Lint and format with uvx ruff check --fix

Disclaimer

While PROSA verifies the underlying RTA theory, the implementations in pyRTA are not verified themselves — this is just a regular Python library.

However, pyRTA serves as the underlying RTA of the POET foundational response-time analysis tool, which formally certifies the outputs of unverified analyses to formally prove that the particular analysis results are correct (i.e., it verifies the output of each run, rather than the full implementation). Please refer to the POET paper for a more in-depth explanation.

Contributions, Feedback, Questions

Please use the project's issue tracker or contact Björn Brandenburg.

A Github mirror is available and accepts pull requests.

Attribution

When using the pyRTA library in academic work, please cite the paper underlying the verified RTAs implemented in this library:

@inproceedings{BB:20,
  author       = {Sergey Bozhko and
                  Bj{\"{o}}rn B. Brandenburg},
  title        = {Abstract Response-Time Analysis: {A} Formal Foundation for the Busy-Window
                  Principle},
  booktitle    = {Proceedings of the 32nd Euromicro Conference on Real-Time Systems (ECRTS 2020)},
  pages        = {22:1--22:24},
  year         = {2020}
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

response_time_analysis-0.1.1.tar.gz (13.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

response_time_analysis-0.1.1-py3-none-any.whl (21.0 kB view details)

Uploaded Python 3

File details

Details for the file response_time_analysis-0.1.1.tar.gz.

File metadata

  • Download URL: response_time_analysis-0.1.1.tar.gz
  • Upload date:
  • Size: 13.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.24 {"installer":{"name":"uv","version":"0.9.24","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for response_time_analysis-0.1.1.tar.gz
Algorithm Hash digest
SHA256 d6f545b0d99aeeb8f18f59e9bf4becde081a334fd2e536f7f79741cb72c5c3e1
MD5 0a994bfb06d5ad2f802e5a4da75ff806
BLAKE2b-256 e15ae33db8a0e4b9bedb7a5da1818edc39974defc84b55e90743c915940c8fa3

See more details on using hashes here.

File details

Details for the file response_time_analysis-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: response_time_analysis-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 21.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.24 {"installer":{"name":"uv","version":"0.9.24","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for response_time_analysis-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 96eb9f9445db8716dacee63d3c2476833227ce173ab7279ade12799ba51a51c4
MD5 3d12ad36ac32ae455aa2d9cf16a7f8a9
BLAKE2b-256 536c28b3f06a667ffadfad0b04c4ef895fb52c85122c8974e5cc9da4e78f1af4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page