[LITMUS^RT] How to handle the blocked task

Björn Brandenburg bbb at mpi-sws.org
Tue Oct 4 11:33:36 CEST 2016


> On 03 Oct 2016, at 16:00, shijunjie92 <shijunjie92 at gmail.com> wrote:
> 
> So how can I let a task spinning on the processor when it is waiting for a resource rather than being preempted by a lower priority task?
> 1. Enqueue that blocked task in the ready queue and pick up the highest priority task as the next scheduled task
> 2. Let an 'empty' thread occupy the processor in the blocked task's priority to protect the process occupied by lower priority task
> Which solution should I take? Could you give me some suggestion?
>  

I’m not sure I understand. If a task is spinning, it can't be suspended, so it will be in the ready queue. If it is truly blocked, then it is not spinning and must not be in the ready queue.

If you want to keep around pointers to suspended tasks in the scheduler’s data structures, then make sure you clear those pointers if the task happens to terminate while it is suspended.

- Björn





More information about the litmus-dev mailing list