TinyGo 4 — Cooperative soft-RT tasks
TinyGo elective 4 — Cooperative multi-task table
Elective · ~3h
Goal: Run ≥3 periodic tasks cooperatively; demonstrate starvation when one task hogs the CPU; write RT conclusions.
Theory
| Model | Meaning |
|---|---|
| Cooperative | Task runs until yield; bad task starves others |
| Preemptive RTOS | Timer IRQ switches tasks |
| This lab | if now >= task.Next { run; next += period } |
TinyGo here is not FreeRTOS. Learn limits honestly.
Lab
- Task table: blink 500 ms, heartbeat UART 1 s, sensor 100 ms.
- Idle
Sleep(1ms)in outer loop.
- Inject bad task with long
Sleep; observe heartbeat jitter.
NOTES.md: when cooperative is enough vs interrupts/RTOS.
Full code: monorepo Go project 44.
Checkpoint
- ≥3 periods running
- Bad-task experiment documented
- NOTES.md with conclusions
Next elective
TinyGo 5 — I2C monitor (96-tinygo-05-…).