Scheduling Algorithms for Multiprogramming in a Hard-Real-Time Environments Gracia Yuen PowerPoint PPT Presentation

presentation player overlay
1 / 65
About This Presentation
Transcript and Presenter's Notes

Title: Scheduling Algorithms for Multiprogramming in a Hard-Real-Time Environments Gracia Yuen


1
Scheduling Algorithms for
Multiprogramming in a
Hard-Real-Time Environments

Gracia 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-1 Requirements Background
  • 1. Design is triggered requirements.
  • The rapidly increased computer use for
    ControlMonitoring 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-1 Requirements 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-1 Requirements 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-1 Requirements 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-1 Requirements 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.
  • gt service is guaranteed in the time.
  • 3) Preemptive

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

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

13
2
Background 2-3 Constraint 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.
  • gteliminates queuing problem for the
    individual task.

14
2
Background 2-3 Constraint 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-3 Constraint 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-3 Constraint 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,
  • gt 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) Ult1
Otherwise, the tasks can not be scheduled in the
single processor system.

22
3
A Fixed Priority Scheduling Algorithm
2. Modeling 3) Defination si is a period
task and defined as si(Ti,Ci,Di) Ti is the
Request_Period of 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) Di is 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 1gt it can schedule a set of tasks
  • 2gt the requests for all tasks at their
    critical instants are fulfilled before their
    respective deadlines.
  • gt it is a feasible scheduling algorithm.

25
3
A Fixed Priority Scheduling Algorithm
T12, T25 C11, C21
  • (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 t5, gt 5 is
    deadline.

27
3
A Fixed Priority Scheduling Algorithm
  • A1, all the tasks have periodic requests,
  • A4, run-times is constant.
  • gt 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.Every fixed priority assignments rule can be
    scheduled by the RMPA(rate-monotonic priority
    assignment).
  • Reason Precondition is (T12) lt (T2 5)
  • 1) Priority(S1) gt Priority(S2)
  • need to meet (T2/T1)C1 C2 lt T2
  • Request_Rate(S1) gt Request_Rate(S2)
  • 2) Priority(S1) lt Priority(S2)
  • need to meet C1 C2 lt T1, Or
  • (T2/T1)C1 (T2/T1)C2 lt
    (T2/T1)T1 lt T2
  • gt the algorithm is feasible for both of the two
    cases.

29
3
A Fixed Priority Scheduling Algorithm
  • Effect
  • gt 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)
  • gt task with higher Request_Rate will 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(T12) lt (T2 5)
  • gt Request_Period(T1) lt Request_Period(T2)
  • gt S1 has higher Request_Rate
  • gt 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
  • 1gt 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)gt Priority(Sb),
  • But, Request_Period Ta gt Tb

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

34
3
A Fixed Priority Scheduling Algorithm
  • 4gt Significance
  • Advantage
  • RMS is proved as the optimum of static
    scheduling algorithm, more feasible, little
    overhead
  • Disadvantage
  • Processor Utilization is not high
  • When n?8,
  • Processor utilizationln2 70.

35
3
A Fixed Priority Scheduling Algorithm
  • 5gt 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.
  • gt deadlock happens!!!
  • gt RMS cannot provide a proper schedule for
    the set of task.
  • Any solution?

36
3
A Fixed Priority Scheduling Algorithm
  • 6gt 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
  • Ci increases, or Ti decreases,
  • gt U is improved.
  • Note Precondition is all tasks satisfy their
    deadlines at their Critical _Instant.

U S (Ci/Ti) Trequest periods 1/Tfrequency Cru
n-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
    tasks Request_Period, Ta.
  • for U 1- f(1-f)/(If), ITb/Ta, f
    Tb/Ta
  • gt when f 0, PU factor U1

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/Talt2,
  • 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)
  • gt 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/Ti0, for i1,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
  • gt Delay_Timem amount of buffering required
  • can be computed.
  • gt 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 tasks current request
    is the nearest,
  • gta task will be assigned the highest priority
  • if the deadline of the tasks current request
    is the furthest,
  • gt 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) lt 1
  • Judgment is rest on
  • if the total demand gt the available processor
    time
  • gt it is not a feasible scheduling algorithm

51
5
A Mixed Scheduling Algorithm
5-1
Concept
5-2
Mathematical results
Theorem Proof
Processor Utilization
52
5
A Mixed Scheduling Algorithm
  • 1. Concept
  • MSA are combinations of RMSA and DDSA
  • 2. Mathematical results
  • 1)Theorem 8
  • If a set of tasks are scheduled by the DDSA
    on a processor whose availability function is
    sublinear, then there is no processor idle
    period to an overflow.

53
5
A Mixed Scheduling Algorithm
  • 2) Theorem 9
  • A necessary and sufficient condition for the
    feasibility of the DDSA with respect to a
    processor with availability function ak(t) is
  • t/Tk1 Ck1 t/Tk2 Ck2 t/Tm
    Cmltak(t)
  • for all ts which are multiples of Tk1, or
    Tk2,, or Tm.

54
5
A Mixed Scheduling Algorithm
  • Notes
  • ak(t) is a non-decreasing function of t.
  • ak(t) is sublinear, if for all t and all T,
  • a(T)lt a(tT) a(t)
  • Significance
  • 100 utilization is not achievable
    universally by the MSA.

55
6
Algorithm Comparison
6-1
Advantages
6-2
Comparison
56
6
Algorithm Comparison
  • Advantage
  • URMSA lt UMSA lt UDDSA
  • The least upper bound is considerably less
    restrictive for the MSA than RMSA.
  • URMSA is only slightly greater than the worst
    case of UMSA.
  • gt MSA is preferred.

57
6
Algorithm Comparison
  • Comparison
  • Example
  • If T13, T24, T35, a1(20)13,
  • C11, C21, C32
  • Here we go
  • to prove MSA is prefferred.

58
6
Algorithm Comparison
  • Based on the reasoning of Theorem 1,
  • gt C1 C2C3 lt T1
  • 1 1 C3 lt3
  • gt C3max lt 1
  • gt URMSA 1/31/41/578.3

59
6
Algorithm Comparison
  • Based on Theorem 7,
  • gt C1/T1 C2/T2 C3/T3 lt 1
  • 1/3 1/4 C3/5 lt1
  • gt C3max lt 25/12 2.0833
  • gt UDDSA 1/31/42.0833/5
  • 1/31/4(25/12)/5 100

60
6
Algorithm Comparison
  • Based on Theorem 9,
  • gt if k1, then t/T2C2 t/T3C3 lt a1(20)
  • 20/41 20/5C3 lt 13
  • gt C3max 2
  • for U C1/T1 C2/T2 C3/T3
  • gt UMSA 1/31/42/598.3

61
7
Conclusion
  • Problems associated with multiprogramming are
    focused in a hear-real-time environment typified
    by process control and monitoring, using some
    assumptions which characterize that application.

62
7
Conclusion
  • 3. Conclusion
  • for all fixed priority scheduling algorithm
  • which assigns priority to tasks in a
    monotonic relation to their Request_Rate was
    shown to be optimum among the class of all fixed
    priority scheduling algorithms.
  • The least upper bound of PU factor is on the
    order of 70 for large task sets.

63
7
Conclusion
  • 3. Conclusion
  • Dynamic Deadline Driven Scheduling Algorithm
  • is shown to be globally optimum and capable
    of achieving 100

64
7
Conclusion
  • 3. Conclusion
  • Mixed Scheduling Algorithm
  • appears to provide most of the benefits of
    the Deadline Driven Scheduling Algorithm, and yes
    may be readily implemented in existing computers.

65
  • Q A
Write a Comment
User Comments (0)
About PowerShow.com