Skip to main content

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}
}

Metadata

Release files for response-time-analysis 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for response-time-analysis 0.1.1
File Size Uploaded
response_time_analysis-0.1.1.tar.gz 13.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for response-time-analysis 0.1.1
File Interpreter ABI Platform
response_time_analysis-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 33.9 kB

Release files / response_time_analysis-0.1.1.tar.gz

Download URL response_time_analysis-0.1.1.tar.gz
Size 13.0 kB
Tags Source
SHA-256 checksum
How to use checksums
d6f545b0d99aeeb8f18f59e9bf4becde081a334fd2e536f7f79741cb72c5c3e1
BLAKE2b-256 checksum
How to use checksums
e15ae33db8a0e4b9bedb7a5da1818edc39974defc84b55e90743c915940c8fa3
Upload date
Uploaded using Trusted Publishing?
What is 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}

Release files / response_time_analysis-0.1.1-py3-none-any.whl

Download URL response_time_analysis-0.1.1-py3-none-any.whl
Size 21.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
96eb9f9445db8716dacee63d3c2476833227ce173ab7279ade12799ba51a51c4
BLAKE2b-256 checksum
How to use checksums
536c28b3f06a667ffadfad0b04c4ef895fb52c85122c8974e5cc9da4e78f1af4
Upload date
Uploaded using Trusted Publishing?
What is 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}

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page