Home News Features Examples Code FAQ License
AVR Webring
Prev Hub Join Rate Next
How to restart a crashed task.


The Femto OS contains a facility that checks on the status of all tasks, which is called the watchdog. This is not to be confused with the watchdog of the device, to which it has no relation, it is a pure OS feature. If a task is not running anymore the watchdog calls your special code inside a 'bark' routine after which the task is restarted. This is particularly useful for code that may get stuck on a lot of places, and you don't want to implement timeouts everywhere. Here we have eight led blinkers running in different priorities. The rightmost led gets stuck after a while (endless loop). As soon as the watchdog kicks in the priority of the task is lowered by one, and the task is restarted. This continues until the priority is zero and the task is suspended. By using the switch the task can be restarted in the old priority. Furthermore the two slowest leds, who have identical blinking frequencies, get out of sync because they run in different priorities. They may be re-synced by pushing a button.


ATtiny861 and STK500. The eight leds on the STK500 connected to port A. On port B pin 0 and pin 1 must be connected to a switch.

Contact: info@femtoos.org   CC-BY License: Ruud Vlaming.