This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

SYS/BIOS 6.33.04.39 - Enabling Delete Terminated Task option, with no Idle Task

Other Parts Discussed in Thread: SYSBIOS

Hi,

on sysbios 6.33.04, we can enable the Delete Terminated Task option without enabling the idle task.

If we do this, if the a task returns/exits and there is no other task ready to be executed, the scheduler calls the idle function deleteTerminatedTasksFunc() from the same context of the task.
Now deleteTerminatedTasksFunc() calls task_delete(), and deallocates the stack of the task, the stack of the active context. Committing a kind of suicide.

In our case, we identified the issue because the function Task_checkStacks() called during the next task context switch was reporting an error in the old_task stack.

In my opinion we shall not let the user enable Delete Terminated Task if the Idle Task is not enabled. Am I correct?

We have a test case for the CortexM3 processor of Concerto to replicate the issue.

best regards

Massimo

  • Massimo,

    Thanks for pointing this out. You raise a very good point.

    I think we need to add a validation check to make sure both settings aren't enabled simultaneously.

    I'll file a bug report for this and make sure its gets included in a future SYS/BIOS release.

    Alan

  • Massimo,

    FYI, a while back, I filed a bug to remove this config parameter because it is unsafe. If there is code in the executable which creates and deletes tasks, then enabling Task.deleteTerminatedTasks might crash the executable. This happens because when the task terminates, there might be idle time before the application code runs which deletes the task object. During this idle time, the idle function will find and delete this task. When the application code gets to run, it will be deleting an already deleted task object. Unless you can verify that there is no code in your executable which deletes tasks, this config param is unsafe to use. I ran into this bug in the OMX software layer.

    I suggested adding a one shot API which will register an idle function to delete a specific task. When the function runs, it will unregister itself because it only needs to run once. This way, the task itself can register this function just before it terminates. Let's see what comes of this.

    ~Ramsey

  • I have a similar problem described here: http://e2e.ti.com/support/embedded/bios/f/355/p/224760/792112.aspx

    Do you have any hints there, please?

  • This thread is closed.   Let's keep working your issue on this other thread -- http://e2e.ti.com/support/embedded/bios/f/355/p/224760/792820.aspx#792820.

    Having multiple threads active makes is harder to manage.

    Thanks,
    -Karl-