Oberon RTK

SignalSync

Thread synchronisation using signals

Description

This program demonstrates the synchronisation between several kernel threads with signals. The program builds upon BlinkPlus.

The concept of Signals as implemented is based on Programming in Modula-2, N. Wirth, 3rd edition, 1985.

  • a thread awaits a signal; if more than one thread awaits the same signal, they get queued up, and will receive the signal in first-come-first-served fashion;

  • a thread awaiting a signal gets suspended until the signal arrives, that is, the kernel scheduler will skip over it in its loop;

  • as signal sent without a receiver waiting for it is lost.

Kernel Threads

The program uses four kernel threads:

  • one heartbeat thread that blinks an LED on the board (heartbeat);

  • one periodically timed sender thread that triggers receiver threads by sending a signal (sender);

  • two receiver threads awaiting the same signal from the sender (receiver).

The sender prints the sending, and the receivers the reception of the signal, respecitvely, to the serial terminal. Since both receivers await the same signal, they take turns.

Note, as with BlinkPlus, the two receiver threads execute the same code, but since each has its own stack, they are independent run-time entities. This requires that all thread code is implemented in a re-entrant fashion, ie. does not use module global variables to hold state.

Signals preserve the cooperative scheduling nature of kernel-v1: after receiving the signal, the kernel scheduler will put them on the ready-queue.

Start-up and Run-time

Please refer to BlinkPlus.

Further Reading

Repository

  • <repo>/examples/v3.1/rpi/pico/SignalSync
  • <repo>/examples/v3.1/rpi/pico2/SignalSync
  • <repo>/examples/v3.1/stm/h573i-dk/SignalSync
  • <repo>/examples/v3.1/stm/u585i-iot/SignalSync

Last updated: 17 May 2026