Skip to content
Skills Library
Programming · Planning

rtos-task-design

/rtos-task-design

Decompose firmware into RTOS tasks with deadline-derived priorities, queue-based communication, and priority-inversion defenses. Use when structuring FreeRTOS/Zephyr-class applications or debugging missed deadlines.

Repository
AI-SKILLS ↗
Licence
MIT
Last repository change
05.09.2026

Assessment and security

90/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content25 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
1
Scripts
0
HTML comments
0
URLs in SKILL.md
0
Deprecation

No signals detected. Repository changed on 05.09.2026, without references to retired models or APIs.

Licence

MIT, open: use and modify while retaining author attribution.

What it does and when to use it

Decompose firmware into RTOS tasks with deadline-derived priorities, queue-based communication, and priority-inversion defenses. Use when structuring FreeRTOS/Zephyr-class applications or debugging missed deadlines.

Original author description

Decompose firmware into RTOS tasks with deadline-derived priorities, queue-based communication, and priority-inversion defenses. Use when structuring FreeRTOS/Zephyr-class applications or debugging missed deadlines.

How it works

  1. Method
  2. Boundaries
Original SKILL.md headings · 68 lines, 445 words
SKILL.md preview
---
name: rtos-task-design
description: Decompose firmware into RTOS tasks with deadline-derived priorities, queue-based communication, and priority-inversion defenses. Use when structuring FreeRTOS/Zephyr-class applications or debugging missed deadlines.
---

# RTOS task design

An RTOS buys you preemptive scheduling; the design work is deciding
what deserves a task, which task must win the CPU when, and how tasks
talk without deadlocking or inverting priorities.

## Method

1. **Create tasks for rates and deadlines, not for nouns.**
   Group work by timing requirement: a 1kHz control loop task, a
   100Hz sensor task, a background comms task: not one task per
   peripheral. Each added task costs a stack (see
   embedded-memory-constraints) and context switches; most
   firmware needs 3-7 tasks, and same-rate cooperative work can
   share one.
2. **Derive priorities from deadlines.** Rate-monotonic as the
   default: shorter period = higher priority; deadline-critical
   control above telemetry above housekeeping. Verify
   schedulability roughly (utilization sum under ~70% for RMS)
   and empirically: instrument per-task CPU and worst-case
   latency (most RTOSes expose runtime stats; see
   game-performance's budget ethic on a smaller frame).
3. **Communicate by queue, own data by task.** Each task owns
   its state; others request via queues/message buffers
   (the go-concurrency share-nothing rule, firmware edition).
   ISRs feed queues from the FromISR APIs (see
   interrupt-safe-code). Blocking receives with timeouts, never
   infinite waits on external events without a recovery path:
   the timeout is where you kick watchdogs and detect stalls.
4. **Defend against priority inversion.** Mutexes with priority
   inheritance for genuinely shared resources (I2C bus, flash
   driver); better, eliminate sharing: a single owner task per
   resource serializing requests via queue turns the mutex
   into a design artifact. Never take two locks in different
   orders anywhere (see deadlock-analysis); never hold a lock
   across a blocking call.
5. **Design idle and overload behavior.** Idle task hooks run
   power management (see low-power-design's tickless idle);
   overload (queue full, deadline slip) has a stated policy per
   task: drop-with-counter for telemetry, degrade rate for
   control, reset for corruption (see backpressure,
   embedded-memory-constraints exhaustion rules). A watchdog
   task checks that every critical task checks in; a hung task
   must become a reset with a logged reason, not a silent
   zombie (see firmware-ota-updates' boot accounting).
6. **Instrument the scheduler in development.** Trace hooks
   (task switch in/out to GPIO or trace buffer: Tracealyzer/
   systemview-class tooling) make preemption visible: the bugs
   this catches (unexpected preemption mid-transaction, a task
   starving, jitter sources) are invisible in source review
   (see embedded-debugging).

## Boundaries

- Superloop-plus-interrupts remains the right architecture for
  simple devices; adopt an RTOS for genuinely independent
  timing domains, not for fashion (the monolith-first instinct,
  firmware edition).
- Hard real-time guarantees require WCET analysis and
  interrupt-latency bounds beyond this checklist;
  safety-certified domains (motor control, medical)
  follow their standards' methods.
- Zephyr/FreeRTOS/ThreadX differ in API and IPC costs; the
  design rules transfer, the primitives' fine print does not:
  read the specific kernel's docs for priority counts and
  queue semantics.

Versions

The database has no other skills named rtos-task-design.

Database snapshot: 13.11.2026 · package version bbad429c0cdf (SHA-256 digest of the entire package)

Downloads in the last 30 days: 0 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 100rtos
    Use this skill when the user says 'FreeRTOS', 'RTOS task', 'xTaskCreate', 'task priority', 'mutex vs semaphore', 'priority inversion', 'task notification', 'stack overflow in task', 'Zephyr thread', 'RTOS queue', 'ISR to task'. Designs and reviews code on a real-time kernel…
  • 100rtos-patterns
    FreeRTOS and Zephyr reference: priority inversion taxonomy, deferred interrupt processing, watchdog kick patterns, mutex vs. semaphore choice, stack sizing, FreeRTOSConfig.h settings, the stack overflow hook, and rate monotonic analysis. Use when designing, reviewing, or debugging RTOS firmware.
  • 100rtos-debug
    Use when debugging embedded RTOS scheduling, tasks, threads, stacks, priorities, mutexes, queues, interrupts, timers, or FreeRTOS, RT-Thread, Zephyr, ThreadX, or CMSIS-RTOS issues
  • 90embedded-rtos
    Embedded, firmware, and real-time systems architecture: bare-metal vs RTOS (FreeRTOS/Zephyr), real-time scheduling (RMS/EDF), WCET and schedulability, priority inversion, interrupt latency, memory/energy budgets, MMU-less design. USE WHEN: designing firmware/embedded/IoT/MCU…
  • 100embedded-rtos-design
    Use when designing, generating, or reviewing RTOS-based embedded firmware (FreeRTOS, CMSIS-RTOS2, RT-Thread, Zephyr, ThreadX) for STM32, GD32, ESP32, drone flight controllers, and robotics projects. Enforces real-time system architecture — task decomposition, scheduling,…
  • 100engineering-embedded-firmware-engineer
    Use when Codex should act as the Embedded Firmware Engineer specialist from Agency Agents. Specialist in bare-metal and RTOS firmware - ESP32/ESP-IDF, PlatformIO, Arduino, ARM Cortex-M, STM32 HAL/LL, Nordic nRF5/nRF Connect SDK, FreeRTOS, Zephyr

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.