Academia.eduAcademia.edu

Minimizing the overhead of dynamic scheduling strategies in avionics systems

2002, Proceedings, IEEE Aerospace Conference

Minimizing the Overhead of Dynamic Scheduling Strategies in Avionics Systems12 Bekouz Zolfaghari Aerospace Research Institute Tehran. Iran +98-21-8094727 Ext. 2116 zolfaghari@ari.ac.ir Abstract-There are two main types of process scheduling starategies which can be used in aircraft'spacecrafi avionics systemsh static strategies, priorities are staticaly assigned to processes prior to run time.These strategies have two main disadvantages. First,they are not applicable to systems in which there is not enough information available ahout run time requirements of processes in advance.Second, they limitate CPU uti1ization.h fact, these strategies waste some CPU cycles because they have to provide for the critical instant of each process. In dynamic strategies,priorities are dynamicaly assigned to processes based on laxities or other run time parameters.These strategies theoreticaly do not restrict CPU utilization .hut they produce some run time overhead which is mainly related to the time required to sort processes in the ready queue each time a process is preempted. This paper proposes and evaluates a novel approach to minimizing the time consumed by the sorting algorithm.This approach is based on the mathematical properties of laxities(or other dynamic priority variahles).It can he shown that the approach mentioned above can reduce the time complexity of the sorting algorithmjn terms of the number of processes(n), iiom O(nlogn) to O(n).This can considerably improve the performance of the aircraft'spacecraft avionics system. 1 INTRODUCTION Spacecraft avionics systems are samples of real time systems in which the time required to respond to events occurred in the environment should be as short as possible. In such systems, the OS plays a determinant role. In fact, It is the OS that should guarantee such short response times and guarantee that every process will complete before it's deadline. A real time OS which controls an ACR (Avionics Computer Resource) system (like any other real time OS) should have special features such as efficient process scheduling strategies, short context Switch times, efficient interrupt handlers, etc. Among these features the scheduling strategy plays the most important role. This strategy must be able to guarantee that every process meets it's deadline (Except for Some special conditions in soft real time systems). Process scheduling strategies used in real time systems can he devided into two main categories, the fust of which consists of static strategies and the second consist of dynamic strategies. (Although there are some hybrid algorithms [I]). Static strategies are often applied to systems in which there is enough information ahout run time requirenments of processes available prior to run time [6]. In such strategies, priorities are statically assigned to processes before runtime. These priorities are not altered during the execution of processes. For example, RMS (Rate Monotonic Scheduling) is a static scheduling strategy which assigns priorities to processes based on their occurrence frequencies [3,6].In this strategy, more iieqoent processes are given higher priorities. RMS hounds CPU utilization to log 2 E 0.69[6]. In fact all static strategies waste some CPU cycles and consequently hound CPU utilization because they have to provide for the critical instance of each process [3]. This can considerably decrease the performance of the avionics system. Another disadvantage of static scheduling strategies is that they can not efficiently handle non-periodic processes and invocation-to-invocation variations of runtime requirements of periodic process [3]. But avionics systems are systems with several dynamic processes. These processes can have a lot of non-predictable runtime requirements. The above disadvantages of static strategies is a good reason for avionics system designers to choose dynamic strategies. Dynamic strategies assign priorities to processes based on run time metrics. For example MLF (MinimumLaxity First) is a dynamic scheduling strategy which gives higher priorities to processes with smaller laxities [ 61. The laxity of a process is defmed as the time remaining to it's deadline subtracted by the time remaining fiom it's execution. 0-7803-7231-W01/$l0.00/02002 IEEE 2 IEEFAC paper #008,Updated Sept 24,2M)1 5-2159 Figure 1 demonstrates how MLF schedules processes. In this figure, P3 has been Scheduled before P2 because it needs more time to he completed and P2 has been scheduled before pl because it has less time to it’s deadline. Note that this figure shows the way of scheduling processes and putting them in the ready queue once a process is preempted, therefore a newly entered process with an early deadline can cause the ready queue to he rearranged. I P2 processes in the ready queue each time a process is Preempted. Thus, in order to minimize the overhead of these strategies, we should frst minimize the time consumed by the sorting algorithm. In this section, a novel approach is introduced which can minimize the noted time. This approach can be applied to any dynamic strategy, but in this paper MLF is exploited as a sample to help explain the details. 2.1 INDEX SORTING As mentioned. MLF assigns a priority variable named “laxity” to each active process. This variable has two main mathematical priorities, which can be exploited to simplify the sorting algorithm: I ?’, ; I b Laxities always have finite values. The laxity of a process can at least be equal to the time remained to it’s deadline and as we h o w , this time must be short in an avionics system (or eveIy other real-time system.) D3 P3 P2 Laxities always have integral (positive or negative) values in terms of the smallest time unit manageable by the system. PI The two features mentioned above can help us arrange the records of processes in the ready queue such that the dispatcher can efficiently find the process to he dispatched next. Figure 1: MLF Scheduling P =Process D = Deadline In this figure, every Pi is a process and Di is the deadline of process Pi. Assuming that the ready queue has been implemented in the memory in form of an array, we can store the record of every process with a laxity equal to L, in a location whose index is L in the ready queue array. Thus, the system can easily locate the process with minimum laxity. But there are two problems that should he carefully dealt with. 1. There may he several processes with identical laxities. To solve this problem, we can store all process which have laxities equal to L ,in a linked list whose head pointer is stored in location L in the array. Dynamic strategies theoretically do not hound CPU utilization, but they induce a noticeable amount ofrun time overhead. This overhead is mainly related to the time required to sort processes in the ready queue each time a process is preempted [2,4,7,8]. 2. There may be processes with negative laxities. These are processes which no more have the chance to meettheir deadlines. In fact, MLF schedules active processes in such an order [8 1: This paper introduces an approach to minimizing the overhead induced by dynamic scheduling strategies in avionics systems. This approach is based on the mathematical properties of dynamic priority variables. It can he shown that the noted approach can reduce the time complexity of the sorting algorithm in terms of the number of active Processes (n),from qnlogn) toO(n). The simulation results as well as the analytical model show that this approach can considerably decrease the time consumed by the sorting algorithm. The rest of this paper is organized as follows. Section 2 introduces the discussed approach , section 3 evaluates the performance of the approach and section 4 is dedicated to conclusion. 2 MINIMIZING THE OVERHEAD 1.Processes with small positive laxities 2. Processes with large positive laxities 3.Processes with large negative laxities (from absolute point of view). 4.Processes with small negative laxities To solve the latter Problem, Processes with negative laxities Can be stored in a distinct ready queue. But they should he ordered in a way that larger laxities Can be accessed fust. (This is necessary to miniminze the search time). One way to do this is to store every process with a laxity equal to L in a location indexed as i=N-/LI where N is the maximum possible size of the ready queue array. Figure 2 shows a typical ready queue (containing n active processes) organized in this way. This figure illustrates how to arrange the negative laxities queue and how to use l i e d lists to deal with identical laxities. The run time overhead of dynamic scheduling strategies is mainly induced by the sorting algorithm which sorts 5-2160 ~ dispatched next, can be calculated as the average of it's two extreme values (the values calculated for the best and the worst case ). Figure 2-a: Positive Laxities Queue 1 2 I 3 I I o I 3 I ... I i I ... n-1 n In-lln I Equation (3-3-1) shows that C is of order O(n) in terms of the number of active processes (n). But as we h o w , the time complexity of traditional sorting algorithms will not he lower than O(nlogn) which belongs to algorithms such as Quick sort or Heap sort [9]. Information each record Since L,,, is assumed to be the maximum possible absolute of negative laxities it will not be very small relative to n, and therefore C is predicted to be almost always a very small number. Figure 2-b: Negative Laxities Queue 1 2 3 I n-1 n Thus this approach can reduce the complexity of the sorting algorithm fiom O(nlogn ) to ofn) 3.2 SIMUL,ATION RESULTS U - In this section the impact of the proposed approach on the time overhead of dynamic scheduling strategies is evaluated by comparing the number of comparisons required to fmd the next process to be dispatched, for the case of applying the proposed approach and the case of using a traditional sorting algorithm to sort the processes in the ready queue. Figure 2 : A typical ready Queue 3 PERFORMANCE EVALUATION In this section the impact of this approach on the performance of the avionics system is evaluated. To do this we predict the average time required to fmd the process which should be dispatched and compare it to the case in which Quick sort algorithm [9] is used to sort process in the ready queue. This is done in two ways. In section 3.1 an analytical method is used to predict the average search time and 3.2 simulation results are exploited to evaluate the time in each of the two cases. 3.1 ANALYTHICAL MODEL Suppose that there are n active processes in the system, the largest positive laxity is equal to L,, and the smallest negative laxity is equal to Lmin. Thus the queue dedicated to positive laxities should be of length L,, and the one for negative laxities should have a length equal to N-L,.+l. In the best case, there is an active process with a laxity L=+1 in the ready quene and the dispatcher chooses that process with only one comparison. But in the worst case, there is no process with a positive laxity and all the n processes have negative laxities and the process which should be dispatched next, has a laxity equal to L, . In this case, the number ofcomparisons required to chose the next process will he equal to N+(NlL,,l+l). Assuming N = n, this number will be equal to n+(n-lL,,l+l). Again assuming that all cases occur with identical probabilities, the average number of comparisons required to chose the process to be 3.2.1 SIMULATION METHODOLOGY The time Complexity of the sorting algorithm can not be adequate to compare our proposed approach with traditional sorting algorithms, because n (the number of active processes in the ready queue of the operating system) can not be a very large number. In fact, the average number of comparisons required in each case can be a more precise and reliable metric for such a comparison. Therefore in this section we compare the average numbers of comparisons. These numbers have been calculated through simulation. Maple V Release 3[10] has been exploited to simulate the impact of this approach on the overhead of dynamic scheduling strategies in avionics systems. To do this, for each nE[5,20], 500 random ready queues of length n were generated in which processes had laxities in [l,n] (regardless of the size of time slots). We will not observe any noticeable change in the simulation results if we increase the number of the random queues more than 500 queues. Also the number of processes have been chosen to lie between 5 and 25. But a more exact and fair range could be chosen for this number in every specific avionics system if there is more information available about the functionality of the system. Then for each queue, the number of comparisons required to locate the demanded process were evaluated (once using Quick sort algorithm and once using the proposed approach) and the average of these numbers were calculated. 5-2161 laxity be negative. This probability must always he small in a spacecraft avionics system and especially for safety critical processes. In these simulations, we have assumed that in 10% of cases (pl) a laxity can be negative (a process with low criticality can miss it's deadline) and in 4% of cases (p2) all active processes can have negative laxities(There is no active process in the ready queue of the OS except for the processes that have already missed their deadlines). 2.Tbe probability that no process have the Chance to meet it's deadline (i.e. All Laxities are negative. Our proposed approach will obviously perform better if this probability is small. For example, table 2 demonstrates the same numbers for the case where the first probability is equal to 5% and the second is equal to 4%. 3.2.2 RESULTS Table - shows the average number of comparisons required in each case for each n E [j,20]. (Fnrpl=5% & p2=4%) Table 1:Average Numbers of Comparisons (For pl= 10% & p2=4%) In this table, n is the number of active processes, q is the average number of comparisons required to sort the proesses using Quick Sort Algorithm and p is the average number of comparsions required to locate the next process to be dispatched using the proposed approach. As yon can see, the index sorting approach can considerably decrease the number of required comparisons, especially for large values of n. In fact,the superiority of our approach becomes more and more evident as n gets larger. These results show that the proposed approach can considerably decrease the time overhead of dynamic scheduling algorithms and consequently can cause a noticeable improvement in the performance of spacecraft avionics systems The results shown in table 1 have been calculated using random numbers, therefore we may get slightly different results each time we run the simulation program. But these differences will be quite dispensable. Furthermore, we will get different results if we consider different values for the following probabilities. 1.The probability that a process does not have the chance to meet its deadline and consequently its The exact value considered for the above, Probabilities depends on the system constraints, Capabilities and requirements. Again we may encounter different results if we compare the proposed approach with another Sorting algorithm. but we should remember that none of the traditional sorting algorithms have a time complexity less than O(n1ogn) in terms of the number of the items to be sorted. Quick Sort has been chosen for two reasons. First, It is of order O(nlogn).This is the minimal time complexity among all sorting algorithms that depend only on comparisons and location interchange operations[9]. Second, it is an in-place sort andit doesnotrequirethe ready queue to be to be reorganized as a tree or heap. 4 CONCLUSION In this paper, a novel approach was proposed, which can considerably decrease the time overhead of dynamic process scheduling strategies and consequently improve the performance of spacecraft or aircraft avionics systems. The mentioned Approach can decrease the complexity of the time required to sort processes in theready queue, from O(nlogn) to O(n) . Although the comparisons required using this approach is of order O(n), both the analytical formulation and the simulation results predict 5-2162 this number to he almost always a verysmallnumher. This approach will he applicable to any system using a dynamic scheduling strategy. REFERENCES [I] D. Gill and Douglas C . Schmidt. Eynamic Scheduling Strategies for Avionics Mission Computing, In Proceedings o f the 171h lEEE/AIAA Digital Avionics Systems Conference(DASC98), Nov 1998. [2] John Stankovic et al.. Deadline Schedulingfor Realtime Sjstems: EDF and Related Algorithms, Kluwer Academic Publishers, 1998. [3] Alia K. Atlas, Azer Bestavros, Statistical Rare Monotonic Scheduling, In Proceedings of the 19" RealTime Systems Symposium(RTSS98), Madrid, Spain, December 2-4. 1998. [4] Philippe Nain and Donald F. Towsley, Comparison of Hybrid Minimum Lmity/Firsl-ln-First-Out Scheduling Policies for Real-Time Multiprocessors, IEEE Transactions on Computers 41(10) : 1271-1278(1992). [5] Z. Deng, J. S. Liu, and I. Sun, Scheduling ofRealTime Applications in an Open Environment, In Proceedings of 18" IEEE Real-Time Systems Symposium, Pages 308-319,1997, [6] J. Lehoczky, L. Sha , and Y. Ding, The Rate Monotonic Scheduling : Exact Characterization and Average Case Behavior, In Proceedings of IEEE RealTime Systems Symposium(RTSS89), Dec 1989, pages 160-171. 171 J. Hone. X. Tan, and D. Towslev. A Performance A&lysis Minimum Lmily and Earfiest Deadline First Scheduling, UM-CS-1998-071 ,July 31,1989. 07 [8] J. Hoog, X. Tan, and D. Towsley, The Binary Simulation of the Minimum Laxity and Earliest Deadline, UM-CS-1998-070, July 31,1989. [9] William Ford, and William Topp, Data Strucfureswith C++ ,Prentice Hall, 1996. [lo] Introduction to Maple V Release 3 Scientific Computing, University of Buffalo. State University of New York. 5-2163 This page intentionally left blank. . i 5-2164 View publication stats