Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
20 years ago

Querying if a task is still alive in uCOS

Hi,

I want to implement a simple software watch dog task whose job is to see if all other tasked in the system are alive. If a task hangs (is dead) the watch dog would then remove power to an IO board in my system.

Is there any mechanism in uCOS that can be used to report the tasks health? i.e. detect if the task has hung (for whatever reason). I did look at the OSTaskQuery() function that populates an OS_TCB structure that has all sorts of interesting data within it, however didn't see anything specific that detemines if the task is still alive.

Much appreciated,

Aiden

1 Reply

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Hi,

    I think the only solution is to make sure that every task is made active now and then. If a task is putted to sleep for 10 seconds it is perfectly normal that you think the task is dead if you look every second.

    Using the IDLE task to detect can have also drawbacks in the sense that if you have some less critical low priority tasks that consume a lot of time, but don't disturb the real time behaviour because of the low priority, the IDLE task can be inactive for al long time also.

    Maybe, you can make a special task that sits just above the critical ones (supposed the critical tasks had assigned the highest priorities), and just below the not critical tasks. This task can be made active periodically and reset the watchdog.

    If in mean time you found a better solution, feel free to post, I'm interested also in this matter.

    Stefaan