EDF Scheduler and Priority Queues

Gedare Bloom gedare at rtems.org
Fri Mar 21 13:46:55 UTC 2014


On Fri, Mar 21, 2014 at 9:43 AM, Sebastian Huber
<sebastian.huber at embedded-brains.de> wrote:
> On 2014-03-21 14:32, Sebastian Huber wrote:
>>
>> Hello,
>>
>> I changed the objects allocate/free to use the allocator mutex.  This
>> change is
>> very important since otherwise the thread dispatch latency depends on the
>> heap
>> fragmentation.  I noticed now a problem with the thread priority queues
>> and the
>> EDF scheduler.  The EDF scheduler uses priority values greater than 255.
>> Now
>> we have a problem in _Thread_queue_Enqueue_priority():
>>
>> Thread_blocking_operation_States _Thread_queue_Enqueue_priority (
>>    Thread_queue_Control *the_thread_queue,
>>    Thread_Control       *the_thread,
>>    ISR_Level            *level_p
>> )
>> {
>> [...]
>>    _Chain_Initialize_empty( &the_thread->Wait.Block2n );
>>
>>    priority     = the_thread->current_priority;
>>    header_index = _Thread_queue_Header_number( priority );
>>    header       = &the_thread_queue->Queues.Priority[ header_index ];
>>
>> The header_index is now out of range.
>>
>> Should the EDF scheduler work with thread priority queues?
>>
>
> I have another question regarding the EDF scheduler.  Does this work in case
> _Watchdog_Ticks_since_boot overflows?
>
No. For this, I think we need to use "deadline folding" which is just
modulo arithmetic.

> void _Scheduler_EDF_Release_job(
>   Thread_Control    *the_thread,
>   uint32_t           deadline
> )
> {
>   Priority_Control new_priority;
>
>   if (deadline) {
>     /* Initializing or shifting deadline. */
>     new_priority = (_Watchdog_Ticks_since_boot + deadline)
>                    & ~SCHEDULER_EDF_PRIO_MSB;
>   }
>   else {
>     /* Switch back to background priority. */
>     new_priority = the_thread->Start.initial_priority;
>   }
>
>   the_thread->real_priority = new_priority;
>   _Thread_Change_priority(the_thread, new_priority, true);
>
> }
>
> --
> Sebastian Huber, embedded brains GmbH
>
> Address : Dornierstr. 4, D-82178 Puchheim, Germany
> Phone   : +49 89 189 47 41-16
> Fax     : +49 89 189 47 41-09
> E-Mail  : sebastian.huber at embedded-brains.de
> PGP     : Public key available on request.
>
> Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.
> _______________________________________________
> rtems-devel mailing list
> rtems-devel at rtems.org
> http://www.rtems.org/mailman/listinfo/rtems-devel




More information about the devel mailing list