180 likes | 310 Vues
This detailed course, originally developed by Maj. Ron Smith and taught by Dr. Alain Beaulieu, explores Real-Time Operating Systems (RTOS) modeling focusing on Inter-Process Communication (IPC) and scheduling constraints. Topics include Rate Monotonic Analysis (RMA), deadline management, response time analysis, and real-time scheduling algorithms like Earliest Deadline First. Students learn about mutual exclusion considerations and the implementation of priority-driven schemes within RTOS environments. By the end, participants will understand the complexities of schedulability analysis and event handling strategies for efficient real-time systems.
E N D
EE551 Real-Time Operating Systems Modeling IPC and Constraints Course originally developed by Maj Ron Smith
So far… • We have covered RMA • Priority based on period • Utilisation bound • What are the limitations of RMA? • We have covered DMPO • Asynchronous tasks can be modeled using minimum inter-arrival times and a deadline << pseudo-period • We then give a priority to each task based either on periodic or absolute deadline • Response time analysis that includes interference and blocking • Priority Inversion Problem • Priority Inheritance and Ceiling Protocols Dr. Alain Beaulieu 2
So far… • When we look at schedulability analysis such as response time analysis (time demand analysis) • The purpose is to see if we can obtain a valid and feasible schedule… Dr. Alain Beaulieu 3
So far… (recall) • valid schedules 1. at any time one processor is assigned at most one job 2. at any time each job is assigned at most one processor* 3. no job is scheduled before its release time 4. the total amount of processor time allocated is equal to each jobs maximum execution time (or actual)** • all precedence and resource constraints are met a • feasible schedule is one in which all jobs meet their timing constraints (usually deadlines) * implies no parallel processing at job level ** depends on algorithm Dr. Alain Beaulieu 4
So far… • Lets say that we have found through our task model that every job (periodic, and pseudo-periodic) is schedulable • What is the next step? Dr. Alain Beaulieu 5
So far… • We take an RTOS and implement our priority-driven scheme • Select an RTOS such as µC/OS • Priority based, preemptive kernel • In the case of µC/OS priorities are static, but… • We implement our mutual exclusion constraints that we have modeled • By using mutexes we ensure that we have resolved transitive blocking and deadlocks problem (or have we?) • Our precedence constraints were used to derive our effective release times and relative deadlines Dr. Alain Beaulieu 6
So far… recall: The life and times: On a graph Ti Effective Release Time Ti Effective Deadline Ti Actual Response Time Ti Release Spec Ti Deadline Spec { { Due to ? Due to ? Dr. Alain Beaulieu 7
So far… • If our modeling of • Maximum execution time (how?) • Timing constraints [ Ti = (i, pi, ei, Di) ] • Critical section identification • Precedence constraints • Identification of IPC and Synchronization req • Calculation of effective timing constraints • Approximation of asynchronous pseudo-periodic tasks Holds, and we have chosen an RTOS with the mechanisms that implements our policy then we have indeed a valid and feasible system Dr. Alain Beaulieu 8
So far… • Our schedulability analysis for asynchronous events using DMPO is based on two assumptions: • We know the minimum inter-arrival time • We can specify a deadline • Asynchronous events can be sporadic or aperiodic • We know more about sporadic events than aperiodic events Dr. Alain Beaulieu 9
So far… • We have seen some implementation options to deal with aperiodic events • Background (idle) – not optimal • Interrupt Driven – not correct • Slack Stealing – works but is complicated and compute intensive • Polling Servers – works but requires queue to have backlog • Bandwidth Preserving Servers • Deferred • Sporadic • All are implementable with most RTOS it is a question of analysis and design Dr. Alain Beaulieu 10
Pre-Run-Time Scheduling • There is another school of thought that states that we can ensure that a system has a feasible schedule if we pre-set the schedule before run-time Dr. Alain Beaulieu 11
Pre-Run-Time Scheduling • Again using the our hard-real-time model for tasks, we could construct a deterministic schedule before run-time • This requires algorithms that can take timing constraints • Several algorithms exist to produce schedules Dr. Alain Beaulieu 12
Pre-Run-Time Scheduling • Some algorithms are compute intensive but resolvable in O(n2) • Earliest Deadline First • Least Laxity first • As in the case of priority scheduling: • First calculate the effective release time and deadline of each task based on precedence • Find the least common denominator for all periodic tasks and define the major cycle (make asynch tasks pseudo-periodic) • For each task in the system create a set of jobs to be executed in the major cycle (number of releases) • Jobs run to completion (more to come on this) • Schedule according to the policy (create a Gantt chart) and verify that all the deadlines are met Dr. Alain Beaulieu 13
Pre-Run-Time Scheduling • After the Gantt chart is obtained, use it to order the tasks on the system: • Clock Driven Scheduling through an RTOS • Use the sleep (delay) function to implement the schedule • May have to keep the delays for the major cycle in a multidimensional array • If jobs run to completion do we need mutual exclusion? • In the case of parallel processors with shared resources. We can include the mutual exclusion constraints in the algorithms so that two tasks are mutually exclusive in time • We must ensure that Interrupt Service Routines have no Mutual exclusions – What if they do??? Dr. Alain Beaulieu 14
Pre-Run-Time Scheduling • What is the problem with PRT scheduling (calendar scheduling)? • Is there any advantage of using PRT scheduling? Dr. Alain Beaulieu 15
Pre-Run-Time Scheduling • Some research was done in the past on optimal schedules • do not confuse with an optimal algorithm that always finds a solution • An optimal schedule is one that is as short as can be • The problem is to find the shortest possible schedule given a set of task without missing deadlines Dr. Alain Beaulieu 16
Pre-Run-Time Optimal Schedule • Calculating the shortest possible schedule is an NP-Hard Problem • The computational complexity is one that is also called wicked problem • Such problems have been described in the traveling salesman problem and the backpack packing problem • NP-Hard problem solutions are not verifiable in polynomial time • So you have a solution but you are not sure if it is the optimal solution Dr. Alain Beaulieu 17
Pre-Run-Time Optimal Schedule • Calculating the shortest possible schedule that meets timing constraints is also an NP-Hard Problem • However verifying that the timing constraints are met is an NP-Complete problem, it can be verified in polynomial time • However, you will not be able to know if it was the shortest possible schedule Dr. Alain Beaulieu 18