My application runs on an NXP LPC2468 microcontroller and contains around 30 tasks, running on KEIL RTX configured in fully pre-empted mode (no round robin).
Each task has a unique priority and basically has either one of the following two structures:
Task1 { Init while (1) { os_result = os_evt_wait_or(EVT1 | EVT2 |... | EVTn, TIMEOUT); process the periodic wakeup or the event } } Task2 { Init while (1) { os_dly_wait(TIMEOUT); do some processing on wakeup } }
In particular, a few of them - under specific conditions - have the 2nd form and the processing on wakeup is just a set of assignments to variables shared among tasks. Therefore, these assignments are made "atomic" by disabling task switching just before the assignment (tsk_lock) and re-enabling it (tsk_unlock) soon after the assignment is made:
Task { Init while (1) { os_dly_wait(TIMEOUT); tsk_lock(); perform assignment to shared variable tsk_unlock(); } }
And here's the issue: I could see that, after a few days of continuous run, some task with the latter structure does not run anymore (while others keep running). Please note that in my code there is not any dynamic task creation/deletion (so, once created, the tasks are supposed to live forever). Note also that some task with lower priority keeps running (so, this is not a problem of some high priority task which hogs the processor). According to the implementation of tsk_lock and tsk_unlock in RTX_Config.c, I suppose that there is no problem with them. So, I guess there is some issue with os_dly_wait.
I also checked out a few threads dealing with a potential problem with os_dly_wait, but I couldn't find an official response from keil so far:
http://www.keil.com/forum/docs/thread11354.asp
http://www.keil.com/forum/docs/thread9055.asp
http://www.keil.com/forum/docs/thread8814.asp
Has anyone had a similar issue ? Does anyone know of any malfunctioning with this function (maybe some limitation due to the high number of running tasks) in certain well defined conditions ?
Thanks for your help.