Hand-rolled context switching on mmap'd stacks with guard pages, allocator-driven RDTSC preemption, unbounded MPSC channels, supervision via per-slot Signal mailboxes, root supervisor as sentinel PID. Lib + tests + benches clean check/clippy. All 29 tests pass. Bench: smarm 3.4% over serial baseline, within 160us of tokio current-thread on prime-counting fan-out.
23 lines
484 B
Rust
23 lines
484 B
Rust
use smarm::pid::Pid;
|
|
|
|
#[test]
|
|
fn pid_equality() {
|
|
assert_eq!(Pid::new(0, 0), Pid::new(0, 0));
|
|
assert_ne!(Pid::new(0, 0), Pid::new(0, 1));
|
|
assert_ne!(Pid::new(0, 0), Pid::new(1, 0));
|
|
}
|
|
|
|
#[test]
|
|
fn pid_accessors() {
|
|
let p = Pid::new(42, 7);
|
|
assert_eq!(p.index(), 42);
|
|
assert_eq!(p.generation(), 7);
|
|
}
|
|
|
|
#[test]
|
|
fn pid_debug_is_useful() {
|
|
let p = Pid::new(3, 5);
|
|
let s = format!("{:?}", p);
|
|
assert!(s.contains('3') && s.contains('5'), "got: {}", s);
|
|
}
|