# rusty_rtos_kernel-core
[](https://github.com/remade-with-rust)
[](https://www.mata.network)
[](https://crates.io/crates/rusty_rtos_kernel-core)
[](https://docs.rs/rusty_rtos_kernel-core)
[](#license)
The pure `no_std` core of
[`rusty_rtos_kernel`](https://crates.io/crates/rusty_rtos_kernel): the whole
FreeRTOS scheduler as types, traits and algorithms, with **no CPU, no allocator
and no operating system**. `#![forbid(unsafe_code)]`.
- **What is in here**: tasks and the tick, the context-switch *decision*,
ready/delayed/suspended lists, queues, semaphores, mutexes with priority
inheritance, task notifications, software timers and their daemon, event
groups, and stream and message buffers.
- **What is not**: the switch itself. A stack swap is `unsafe`, which this
family allows only in `rusty_rtos_port-<arch>`. This crate fires the same
`TASK_SWITCHED_OUT` / `_IN` pair the C kernel fires and a port acts on it.
**Known gaps.** No SMP, no MPU, no static allocation, no co-routines.
## Conformance
**19 conformance scenarios produce traces byte-identical to the C kernel's**
at 100,000 ticks each, on host, ARMv7-M, RV32 and Xtensa LX7 — the last on
silicon. Separately, 26 unmodified C demo files from the FreeRTOS distribution
run against this kernel through the C ABI.
```sh
kairos conform --all --ticks 100000 # from the Kairos umbrella
```
The full table, the open `AbortDelay` contract question and every defect the
corpus found are in the
[repository README](https://github.com/Remade-With-Rust/rusty_rtos_kernel#conformance).
## Using it
```rust
use rusty_rtos_kernel_core::{system, Kernel};
// The geometry is the declaration: no allocator, and the `.bss` cost is
// exactly what was asked for.
system! {
mod app use MyConfig;
tasks { producer: 1, consumer: 2 }
queues { work: u32; 8 }
}
```
Feature ladder: `std` ⊃ `alloc` ⊃ core-only. Build with
`--no-default-features` for bare metal.
## Performance
| FreeRTOS | 19 |
| Kairos | **19** — exact parity |
The list this kernel walks costs **34.22 instructions per operation, 1.533×**
`list.c`, by callgrind with both arms printing the same checksum. Full method
in the [repository README](https://github.com/Remade-With-Rust/rusty_rtos_kernel#performance).
## Portability
Builds and tests on host; compiles for `thumbv7m-none-eabi`,
`riscv32imac-unknown-none-elf` and `xtensa-esp32s3-none-elf` with
`--no-default-features`. The corpus runs on all four.
## Part of Remade With Rust
This crate is part of **[Kairos](https://github.com/Remade-With-Rust/kairos)** —
FreeRTOS remade in memory-safe Rust, as independent packages that expose the API
a FreeRTOS developer already knows and prove every scheduling decision against
the C kernel's own trace. The family:
[`rusty_rtos_core`](https://crates.io/crates/rusty_rtos_core),
[`rusty_rtos_kernel`](https://crates.io/crates/rusty_rtos_kernel),
[`rusty_rtos_port`](https://crates.io/crates/rusty_rtos_port),
[`rusty_rtos_heap`](https://crates.io/crates/rusty_rtos_heap). Also check out the
rest of **[github.com/remade-with-rust](https://github.com/remade-with-rust)**.
## About Mata Network
[Mata Network](https://www.mata.network) builds sovereign, self-hostable
infrastructure. **Remade With Rust** is our open-source home for the
permissively-licensed building blocks that work depends on.
## License
MIT OR Apache-2.0, at your option. FreeRTOS is MIT-licensed by Amazon.com, Inc.
or its affiliates; this crate remakes its API and behaviour from the published
sources and links no FreeRTOS code.