EDF Scheduler and Priority Queues

Sebastian Huber sebastian.huber at embedded-brains.de
Fri Mar 21 13:43:50 UTC 2014


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?

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.



More information about the devel mailing list