Oshan Ranasinghe

Work / Electronics / Embedded / RTOS Task Scheduler

Real-Time Systems · Firmware

RTOS Task Scheduler

A preemptive task scheduler written from scratch in C for ARM Cortex-M, implementing context switching, priority-based preemption, semaphores, and deadline tracking.

Section

Electronics / Embedded

Stack

C · ARM Cortex-M · STM32 · RTOS

Category

Real-Time Systems · Firmware

Status

Scheduler and semaphores complete, deadline monitor in progress

01 — Challenge

The core engineering challenge

RTOS concepts only become fully concrete when you implement the context switch yourself — reading about stack frames and PendSV is not the same as writing the assembly.

03 — Decisions

Engineering decisions and what they cost

01Context switch implemented in assembly to directly understand the Cortex-M exception entry/exit model.
02Minimal kernel surface: scheduler + semaphore is sufficient to demonstrate all core concepts.
03Deadline monitor is a separate optional module — it does not couple into the scheduler core.

04 — Stack

CARM Cortex-MSTM32RTOSReal-TimeAssembly