1 / 65

U M

Scheduling Algorithms for Multiprogramming in a Hard-Real-Time Environments Gracia Yuen. U M. Agenda. 1. Target of the presentation. 2. Background. 3. A Fixed Priority Scheduling Algorithm. 5.

long
Télécharger la présentation

U M

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Scheduling Algorithms for Multiprogramming in a Hard-Real-Time EnvironmentsGracia Yuen UM

  2. Agenda 1 Target of the presentation 2 Background 3 A Fixed Priority Scheduling Algorithm 5 A Deadline Driven Scheduling Algorithm 6 A Mixed Scheduling Algorithm 7 Algorithm Comparison 8 Conclusion

  3. 1 Target of the presentation • Discuss the proper algorithm of multiprogram scheduling for services in Hard-Real-Time environment on a single processor. • Based on existed two ideas: 1. Fixed priority scheduling 2. Dynamically assigning priority scheduling. try to find an optimum combination idea for the Hard-Real-Time services.

  4. 2 Background 2-1 Requirements & Background 2-2 Definition of Concept 2-3 Constraint Conditions of Modeling

  5. 2 Background 2-1Requirements & Background 1. Design is triggered requirements. The rapidly increased computer use for Control&Monitoring of industrial processes. 2. The validity of embedded realtime system includes: 1) the correctness of the program logic; 2) meet the time constraint condition.

  6. 2 Background 2-1Requirements & Background 3. Based on the requirements of Real-Time, real-time system can be divided as: 1) Hard-real-time it is mandatory to meet the deadline of response time; 2) Soft-real-time a statistical distribution of response times is acceptable;

  7. 2 Background 2-1Requirements & Background 4. Based on scheduling, real-time system can be divided as: 1) Static Scheduling Algorithms are based on RMS; 2) Dynamic Scheduling Algorithms are based on EDF or LLF.

  8. 2 Background 2-1Requirements & Background 5. Based on Real-Time Scheduling, real-time system can be divided as: 1) single processor scheduling; 2) centralized multiprocessor scheduling; 3) distributed processor scheduling;

  9. 2 Background 2-1Requirements & Background 6. Based on whether or not preemption is available, real-time system can be divided as: 1) preemptive scheduling; 2) non-preemptive scheduling; 7. This paper is discussed Only on: 1) single process system; 2) preemptive scheduling;

  10. 2 Background 2-2 Definition of Concept 2. Function 1) More than 1 functions on a computer; 2) Associated with a set of tasks; 3. Task 1) Time-driven; 2) Processes a fixed time to elapse/task. => service is guaranteed in the time. 3) Preemptive;

  11. 2 Background 2-3Constraint Conditions of Modeling 1. Task 1) Periodic task; 1> independent; 2> has deadline; consist of run-ability constraints Only; no queuing problem for individual task; 3> constant interval between tasks; • Note: Periodic task is one scenarios of tasks in time-critical control & monitoring functions.

  12. 2 Background 2-3Constraint Conditions of Modeling 4> run-time of each task is constant; run-time is an approximation value; the maximum processing time for a task task ti tastrequirest period: Tm;= 1/requiret-rate 2) Non-Periodic task; 1> Initialization or Failure RR; 2> no critical deadline;

  13. 2 Background 2-3Constraint Conditions of Modeling 2. Assumptions: • The requests for all tasks for which hard deadlines exist are periodic, with constant interval between requests. • Deadlines consist of run-ability constraints only – i.e. each task must be completed before the next request for it comes. =>eliminates queuing problem for the individual task.

  14. 2 Background 2-3Constraint Conditions of Modeling 2. Assumptions: • The tasks are independent in that requests for a certain task do not depend on the initiation or the completion of requests for other tasks. • Run-time for each task is constant for that task and does not vary with time. Run-time here refers to the time which is taken by a processor to execute the task without interruption.

  15. 2 Background 2-3Constraint Conditions of Modeling 2. Assumptions: • Any non-periodic tasks in the system are special; they are initialization or failure-recovery routines; they displace periodic tasks while they themselves are being run, and do not themselves have hard, critical deadlines. • Delays caused by the single processor, the preemptive scheduling and task switching, are ignored.

  16. 2 Background 2-3Constraint Conditions of Modeling 3. Scheduling algorithms will be discussed: 1) Fixed priority scheduling 2) Dynamic priority scheduling: priorities of tasks might change from request to request. 3) Mixed scheduling algorithm the priority of some tasks are fixed and others are vary from request to request.

  17. 3 A Fixed Priority Scheduling Algorithm 3-1 Scheduling Algorithm Concepts 3-2 Modeling 3-3 Theorem & Proof: 3-4 Processor Utilization 3-5 Relaxing the Utilization Bound

  18. 3 A Fixed Priority Scheduling Algorithm 1. Scheduling Algorithm Concepts: 1) Deadline of a request for a task (point of time) the time of the next request for the same task; if t is the deadline of an unfulfilled request, => an overflow occurs at t; 2) Critical Instant for a task (point of time) is used to determine the algorithm; If t = critical instant, {a request for the task will have the largest response time;}

  19. 3 A Fixed Priority Scheduling Algorithm 3) response time of a request for a task (duration) the time span= [t(request), t(the end of the response to the request)] 4) Critical time zone for a task (duration) the time interval = [t(a critical instant), t(the end of the response to the corresponding request of the task)]

  20. 3 A Fixed Priority Scheduling Algorithm • Obviously, the fixed one is a RMS algorithm. (Rate-Monotonic Scheduling)

  21. 3 A Fixed Priority Scheduling Algorithm • 2. Modeling: • 1) Allocation of Priority: • Priority is inversely proportional to Period of request; • 2) Schedulability Analysis • CPU Utilization: U = sum(Ci/Ti); • U<=1; • Otherwise, the tasks can not be scheduled in the single processor system.

  22. 3 A Fixed Priority Scheduling Algorithm • 2. Modeling: • 3) Defination: • siis a period task and defined as si(Ti,Ci,Di); • Tiis the Request_Periodof si; • = the reciprocal(the request rate) • task with lower Request_Period will have higher Priority; • task with higher Rquest_Rate will have higher Priority; • Ci is the respective rum-times;(processor time spent) • Diis the end of the request period;

  23. 3 A Fixed Priority Scheduling Algorithm 3. Theorem & Proof: 1)Theorem 1: A critical instant for any task occurs whenever the task is requested simultaneously with requests for all higher priority tasks. Proof: The delay in the completion of si is the largest when t2 coincide with t1;

  24. 3 A Fixed Priority Scheduling Algorithm Effect: I. One of the values of this result is that a simple direct calculation can determine whether or not a given Priority assignment will yield a feasible scheduling algorithm. If 1> it can schedule a set of tasks; 2> the requests for all tasks at their critical instants are fulfilled before their respective deadlines. => it is a feasible scheduling algorithm.

  25. 3 A Fixed Priority Scheduling Algorithm T1=2, T2=5 C1=1, C2=1 • (a) (T1 higher priority) Feasible • (b) (T1 higher priority) C2 can be increased to 2 • (c) (T2 higher priority) C1 and C2 can be at most 1

  26. 3 A Fixed Priority Scheduling Algorithm • Q: In figure2, for task 2, plz answer below items: • deadline, • critical instant, • the end of respond end, • response time, • critical time zone? • My understanding: • as the critical time zone in Figure 2, for task2, the end of the response is 5, actually task2 is finished to response at 2. right? • a new request can come at t=5, => 5 is deadline.

  27. 3 A Fixed Priority Scheduling Algorithm • A1, all the tasks have periodic requests, • A4, run-times is constant. • => otherwise,critical time zone can be defined as the time zone between its request and deadline, if the task has the highest priority.

  28. 3 A Fixed Priority Scheduling Algorithm Effect: II.Everyfixed priority assignments rule can be scheduled by the RMPA(rate-monotonic priority assignment). Reason: Precondition is (T1==2) < (T2= 5); 1) Priority(S1) > Priority(S2); need to meet: (T2/T1)*C1 + C2<= T2 Request_Rate(S1) > Request_Rate(S2); 2) Priority(S1) < Priority(S2); need to meet: C1 + C2 <= T1, Or: (T2/T1)*C1 + (T2/T1)*C2 <= (T2/T1)*T1 <= T2 => the algorithm is feasible for both of the two cases.

  29. 3 A Fixed Priority Scheduling Algorithm Effect: => More generally, the rule of Priority assignment is to assign priority to tasks according to their Request_Rate, independent of their of their run-times(C1,C2); => task with higher Request_Ratewill have a higher Priority. Or, task with lower Request_Period(T1,T2)will have a higher Priority.

  30. 3 A Fixed Priority Scheduling Algorithm Effect: for(T1==2) < (T2= 5); => Request_Period(T1) < Request_Period(T2) => S1 has higher Request_Rate; => S1 has a higher Priority; The way to assign Priority to tasks is called: RMPA(Rate Monotonic Priority Assignment) The algorithm of RMPA is called: RMS(Rate-Monotonic Scheduling)

  31. 3 A Fixed Priority Scheduling Algorithm 3. Theorem & Proof: 2) Theorem 2: If a feasible priority assignment exists for some task set, the rate-monotonic priority is feasible for that task set. If a static scheduling algorithm exists for some task set, RMS is feasible for the task set.

  32. 3 A Fixed Priority Scheduling Algorithm Proof: Exchange Algorithm 1> Assumption: If a static scheduling algorithm, RMS1, exists for some task set; Sa,Sb is 2 tasks of adjacent priorities in the task set, and Priority(Sa)> Priority(Sb), But, Request_Period: Ta >Tb

  33. 3 A Fixed Priority Scheduling Algorithm 2> Proving process: Obviously, it differs with definition of RMS. In order to be in accord with RMS => Action: exchange the priorities of Sa,Sb; => the resultant priority assignment is still feasible. 3> Conclusion: RMPA can be obtained from any Priority ordering by a sequence of pairwise priority re-ordering.

  34. 3 A Fixed Priority Scheduling Algorithm 4> Significance: Advantage: RMS is proved as the optimum of static scheduling algorithm, more feasible, little overhead; Disadvantage: Processor Utilization is not high When n→∞, Processor utilization=ln2 ≈70%.

  35. 3 A Fixed Priority Scheduling Algorithm 5> Question? scenario: Priority Inversion in real-time system, resources are shared by real-time tasks, it may happens that a lower priority task will block the processing of a task with higher priority. => deadlock happens!!! => RMS cannot provide a proper schedule for the set of task. Any solution?

  36. 3 A Fixed Priority Scheduling Algorithm 6> Solution Control the time of priority inversion to be limited Based on requirements, it needs some protocol to ensure that.

  37. 3 A Fixed Priority Scheduling Algorithm 4. Processor Utilization 1) The least upper bound to PU in a fixed priority systems. PU factor: Ciincreases, or Tidecreases, => U is improved. Note: Precondition is all tasks satisfy their deadlines at their Critical _Instant. U = S(Ci/Ti) T=request periods 1/T=frequency C=run-time

  38. 3 A Fixed Priority Scheduling Algorithm 4. Processor Utilization 2) Significance the least upper bound of UP factor is the minimum of the PU factors over all sets of tasks that fully utilize the processor. For all task sets whose PU factor is below this bound, there exists a fixed priority assignment which is feasible. For PU factor is above this bound can only be achieved if the of the tasks are suitably related.

  39. 3 A Fixed Priority Scheduling Algorithm 4. Processor Utilization 2) Significance The least upper bound to be determined is the infimum of the utilization factors corresponding to the RMPA over all possible Request_Period and run-times for the tasks. The least upper bound is firstly determined for two tasks, then extended for an arbitrary number of tasks.

  40. 3 A Fixed Priority Scheduling Algorithm 4. Processor Utilization 3) Theorem 3 For a set of 2 tasks with fixed priority assignment, the least upper bound to the PU factor is U= 2(2(1/2)-1) Such as: if the Request_Period, Tb, for the lower Priority task is a multiple of the other task’s Request_Period, Ta. for U = 1- f(1-f)/(I+f), I=[Tb/Ta], f= {Tb/Ta} => when f = 0, PU factor: U=1

  41. 3 A Fixed Priority Scheduling Algorithm 4. Processor Utilization 4) Theorem 4 For a set of m tasks with fixed priority order, and the restriction that the ratio between any two Request_Period, Tb/Ta<2, the least upper bound to the PU factor is: U = m(2 1/m -1);

  42. 3 A Fixed Priority Scheduling Algorithm 4. Processor Utilization 5) Theorem 5 For a set of m tasks with fixed priority order, the least upper bound to PU is U = m(2 1/m -1); => to determine the least upper bound of the PU factor, we need only consider task sets in which the ratio between any two Request_Period,Tb/Ta, is less than 2

  43. 3 A Fixed Priority Scheduling Algorithm 5. Relaxing the Utilization Bound: Limitation: for real-time guaranteed service, the least upper bound can approach ln2 for large task sets. How to improve the situation? if f= {Tm/Ti}=0, for i=1,2,…,(m-1). But, it cannot always be done.

  44. 3 A Fixed Priority Scheduling Algorithm 5. Relaxing the Utilization Bound: alternative solution: 1. buffer the lower priority task, Sm, and perhaps several of the lower priority tasks. 2. relax their head deadlines. suppose: 1. the entire task set has a finite period 2. the buffered tasks are executed in some reasonable fashion.

  45. 3 A Fixed Priority Scheduling Algorithm 5. Relaxing the Utilization Bound: => Delay_Timem & amount of buffering required can be computed. => Dynamic fashion is a better solution, with PU factor 100%.

  46. 4 A Deadline Driven Scheduling Algorithm 4-1 DDSA & Policy of Priority setting 4-2 Necessary and sufficient condition

  47. 4 A Deadline Driven Scheduling Algorithm • DDSA Deadline Driven Scheduling Algorithm; it is Dynamic Scheduling Algorithm called in the paper. Policy of Priority setting: Priority is assigned to a task according to the deadline of its current request.

  48. 4 A Deadline Driven Scheduling Algorithm • Dynamic Scheduling Algorithm that means, if the deadline of the task’s current request is the nearest, =>a task will be assigned the highest priority if the deadline of the task’s current request is the furthest, => a task will be assigned the lowest priority

  49. 4 A Deadline Driven Scheduling Algorithm 2. Necessary and sufficient condition for the feasibility of the algorithm. Theorem 6 When the DDSA is used to schedule a set of tasks on a single processor, there is no processor idle time prior to an overflow.

  50. 4 A Deadline Driven Scheduling Algorithm 2. Necessary and sufficient condition for the feasibility of the algorithm. Theorem 7 For a given set of tasks, the DDSA is feasible if and only if, (C1/T1) + (C2/T2) +…+ (Cm/Tm) <= 1 Judgment is rest on: if the total demand > the available processor time => it is not a feasible scheduling algorithm

More Related