Watchdog Kick Scheduler

Medium C Recovery Asked at Continental
Solve this problem

A watchdog must only be kicked when every registered task has proven it is still alive. Implement a check-in registry that gates the kick, so a hung task actually causes a reset.

Constraints

  • Up to 8 tasks, each with a unique id 0..7.
  • `void task_checkin(int id)` records liveness.
  • `int watchdog_should_kick(void)` returns 1 only if all registered tasks checked in since the last kick, and clears the record.
  • Registration via `void task_register(int id)`.
  • An unregistered id must be ignored, not crash.
  • No dynamic memory.
Starter codeC
1#include <stdint.h>2 3void task_register(int id);4void task_checkin(int id);5int  watchdog_should_kick(void);