watchdog insertion order

Joel Sherrill joel.sherrill at oarcorp.com
Fri Jul 13 14:24:59 UTC 2007


shizheng wrote:
> Hi,all:
>
> void _Watchdog_Insert(
>   Chain_Control         *header,
>   Watchdog_Control      *the_watchdog
> )
> {
> ...
>   for ( after = (Watchdog_Control *) ((volatile Chain_Control *)header)->first
> ;
>         ;
>         after = _Watchdog_Next( after ) ) {
>
>      if ( delta_interval == 0 || !_Watchdog_Next( after ) )
>          ~~~~~~~~~~~~~~~~~~~/*if a new watchdog's delta_interval is 0, 
>              it will be inserted before all the existing watchdogs with 0 delta_interval */
>        break;
>
>      if ( delta_interval < after->delta_interval ) {
>        after->delta_interval -= delta_interval;
>        break;
>      }
>
>      delta_interval -= after->delta_interval;
>
> ...
> }
>
> As a result, the element in the watchdog chain has an opposite order to
> the insertion order.
> Did I miss something?
>   
No that's what happens.  Timers that expire during the same clock
tick will be executed in LIFO order.  When the clock tick is over,
all tasks unblocked will then compete for the CPU based upon their
priority.  This is done to avoid extending the search for timers
at the same tick.

Two of the proposed changes to RTEMS are

+ change this so it is FIFO for equal ticks
+ change the watchdog chains and timer scheduling so it is
   all in terms of seconds and nanoseconds since boot (absolute
   time)  or wall time.  This would get away from ticks entirely
   for these chains.  This issue would not be a factor on BSPs with
   the nanosecond time support.

--joel
> regards, shizheng
> _______________________________________________
> rtems-users mailing list
> rtems-users at rtems.com
> http://rtems.rtems.org/mailman/listinfo/rtems-users
>   




More information about the users mailing list