120 likes | 243 Views
University of Palestine Faculty of Applied Engineering and Urban Planning Software Engineering Department. Concurrent and Real Time programming. Monitoring Deadline Misses in Periodic Real-time Threads. Prepared By: Ebtesam Saleh-220060051 Prepared For: Eng. Tasneem Darwesh.
E N D
University of PalestineFaculty of Applied Engineering and Urban PlanningSoftware Engineering Department Concurrent and Real Time programming Monitoring Deadline Misses in Periodic Real-time Threads Prepared By: Ebtesam Saleh-220060051 Prepared For: Eng. TasneemDarwesh ebtesam saleh - chapter 12 - section 4
Monitoring Deadline Misses : interface In many soft real-time systems applications will want to monitor any deadline misses, but take no action unless a certain threshold is reached. ebtesam saleh - chapter 12 - section 4
Examplehealth monitor objec ebtesam saleh - chapter 12 - section 4
Monitoring Deadline Misses : interface import javax.realtime.*; public classHealthMonitor { public voidpersistentDeadlineMiss(Schedulable s); } ebtesam saleh - chapter 12 - section 4
import javax.realtime.*; class DeadlineMissHandlerextends AsyncEventHandler { public DeadlineMissHandler(HealthMonitormon, intthreshold) { super(newPriorityParameters( PriorityScheduler.MAX_PRIORITY), null, null, null, null, null); myHealthMonitor = mon; myThreshold = threshold; } public void setThread(RealtimeThreadrt) { myrt = rt; } ebtesam saleh - chapter 12 - section 4
public void handleAsyncEvent() { if(++missDeadlineCount < myThreshold) myrt.schedulePeriodic(); else myHealthMonitor.persistentDeadlineMiss(myrt); } private RealtimeThreadmyrt; private intmissDeadlineCount = 0; private HealthMonitormyHealthMonitor; private intmyThreshold; } ebtesam saleh - chapter 12 - section 4
Monitoring Deadline Misses • When the handler is executed, it increments the miss count and reschedules the thread. • When the count reaches the threshold, it informs the health monitor and does not reschedule the thread. ebtesam saleh - chapter 12 - section 4
Monitoring Deadline Misses it is not possible to pass the real-time thread as a parameter to the constructor of the handler, as the handler itself is needed before the real-time thread can be constructed. ebtesam saleh - chapter 12 - section 4
setting up the real-time periodic thread ebtesam saleh - chapter 12 - section 4
setting up the real-time periodic thread ebtesam saleh - chapter 12 - section 4
Monitoring Deadline Misses Deadline miss handlers are schedulable objects. Consequently, they will compete for processor time with their associated schedulable objects according to their priorities. Hence, for the handler to have an impact on the (in this case) errant real-time thread, it must have a priority higher than the real-time thread. If the priority is lower, it will not run until the errant thread blocks. ebtesam saleh - chapter 12 - section 4
Questions?? ebtesam saleh - chapter 12 - section 4