Menu

#136 Periodic thread isBestEffort

3.5.0
done
3.4.0 (37)
feature
implemented
verified
corrected
2020-11-06
2020-11-06
Pharos Team
No

In some cases, the periodic thread does not meet the period. That is, a job of a thread may take longer than its period. The current Pharos behavior is to trigger a health handler (even if the thread does not have a deadline).

In this ticket it is proposed for periodic threads to have a "isBestEffort" boolean flag which, if set to TRUE (the default is FALSE), the health handler will not be invoked and the thread will just be rescheduled to awake at the next release instant (release + N*period)

Discussion

  • Pharos Team

    Pharos Team - 2020-11-06
    • status: accepted --> done
    • Implemented: not implemented --> implemented
    • Verification: not verified --> verified
    • Resolution: not corrected --> corrected
     
  • Pharos Team

    Pharos Team - 2020-11-06

    Implemented in threadperiodic.c:

    /* if is not a best error */
                if(periodic->isBestEffort == FALSE)
                {
                    /* announce error (a full period elapsed and the thread did not even start to execute) */
                    pharosSThreadErrorAnnounce(thread , PHAROS_THREAD_ERROR_PERIOD_MISS , NULL , NULL);
                }
                else
                {
                    /* awake at the next release instant */
                    thread->lastReplenishmentInstant = thread->lastReplenishmentInstant +
                            ((currentTime - thread->lastReplenishmentInstant) / thread->replenishBudgetInterval + 1) * thread->lastReplenishmentInstant;
    
                    pharosITimeTickAddThread(&periodic->rtThread.thread , thread->lastReplenishmentInstant ,
                                             PHAROS_TIME_TICK_AWAKEN_PERIODIC_THREAD , thread->scheduler);
    
                    /* re-enable interrupts */
                    pharosCpuEnableInterrupts(&interrupt);
    
                    break;
                }
    

    Tested in Test3200.

     

Anonymous
Anonymous

Add attachments
Cancel





MongoDB Logo MongoDB