Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
12745 Discussions

Querying if a task is still alive in uCOS

Altera_Forum
Honored Contributor II
1,211 Views

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
0 Kudos
1 Reply
Altera_Forum
Honored Contributor II
537 Views

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
0 Kudos
Reply