This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Why am I stuck in a task >

__task void ParameterManager::ParameterManagerTask()
{
  // Reset all Constants
  ParameterManager::GetParameterById(ParameterId_Vendor)->setValue((char*)&Vendor, 2);

  while(true)
  {
  }
}

Our target board is wired with ARM7 LPC2468 Microcontroller. Our embedded application is written in 'C++'. This code base was working fine. Recently number of changes were made and now I'm stuck in while(true). This task keeps running. No other task gets to run.
Why might this task be running all the time ?

Parents Reply Children
  • Only the idle task should really have an infinite loop like this - any task with higher priority will starve any task with lower priority.

    And since your task can't get out of your infinite loop, you can just as well kill the task. What use is there to have a task that can only consume CPU?

  • I did DIFF. Previously, this task was blocked waiting on mailbox. Presently, there is no blocking on this task and higher priority tasks are suspended waiting on something, so this is the only task running.

    Correct! this task was starving tasks with lower priority.
    Correct! I should just kill the task. There is no use to have a task that only consumes CPU.

    I solved the problem by blocking this task forever because it doesn't do anything.

    >> Are interrupts enabled, are other interrupts occurring?
    Was this question asked because interrupts may be setting events that would move tasks from suspended to ready state?

    Thank you very much for solving this problem!

  • If interrupts are blocked, then the kernel will not see time, so it will not know when to task-switch.

  • >> If interrupts are blocked, then the kernel will not see time, so it will not know when to task-switch.

    What do you mean by "kernel will no see time" ?

  • The kernel apportions how time (quanta, slots, slices) get allocated between running tasks, if there are no interrupts there is no way of marking time, or switching tasks.

    Sitting in a tight loop with interrupts disabled isn't going to play well with other tasks.

    Instead of focusing on the loop, focus on the bigger picture of how the OS functions, and how the other tasks interact with it.