slide1 n.
Download
Skip this Video
Loading SlideShow in 5 Seconds..
Scheduling Algorithms for Multiprogramming in a Hard-Real-Time Environm PowerPoint Presentation
Download Presentation
Scheduling Algorithms for Multiprogramming in a Hard-Real-Time Environm

Loading in 2 Seconds...

play fullscreen
1 / 65

Scheduling Algorithms for Multiprogramming in a Hard-Real-Time Environm - PowerPoint PPT Presentation


  • 101 Views
  • Uploaded on

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.

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'Scheduling Algorithms for Multiprogramming in a Hard-Real-Time Environm' - conroy


Download Now 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.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
slide1

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

UM

slide2

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

slide3

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.

slide4

2

Background

2-1

Requirements & Background

2-2

Definition of Concept

2-3

Constraint Conditions of Modeling

slide5

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.

slide6

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;

slide7

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.

slide8

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;

slide9

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;

slide10

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;

slide11

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.
slide12

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;

slide13

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.

slide14

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.
slide15

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.
slide16

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.

slide17

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

slide18

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;}

slide19

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)]

slide20

3

A Fixed Priority Scheduling Algorithm

  • Obviously, the fixed one is a RMS algorithm. (Rate-Monotonic Scheduling)
slide21

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.
slide22

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;
slide23

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;

slide24

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.

slide25

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
slide26

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.
slide27

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.
slide28

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.

slide29

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.

slide30

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)

slide31

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.

slide32

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

slide33

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.

slide34

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%.

slide35

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?

slide36

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.

slide37

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

slide38

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.

slide39

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.

slide40

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

slide41

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);

slide42

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

slide43

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.

slide44

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.

slide45

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%.

slide46

4

A Deadline Driven Scheduling Algorithm

4-1

DDSA & Policy of Priority setting

4-2

Necessary and sufficient condition

slide47

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.

slide48

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

slide49

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.

slide50

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

slide51

5

A Mixed Scheduling Algorithm

5-1

Concept

5-2

Mathematical results

Theorem & Proof:

Processor Utilization

slide52

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.

slide53

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/Tk+1] Ck+1 + [t/Tk+2] Ck+2 +…+ [t/Tm] Cm<=ak(t)

for all t’s which are multiples of Tk+1, or Tk+2,…, or Tm.

slide54

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)<= a(t+T) – a(t)

Significance:

100% utilization is not achievable universally by the MSA.

slide55

6

Algorithm Comparison

6-1

Advantages

6-2

Comparison

slide56

6

Algorithm Comparison

Advantage:

URMSA < UMSA < 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.

=> MSA is preferred.

slide57

6

Algorithm Comparison

Comparison:

Example:

If T1=3, T2=4, T3=5, a1(20)=13,

C1=1, C2=1, C3=2

Here we go:

to prove MSA is prefferred.

slide58

6

Algorithm Comparison

Based on the reasoning of Theorem 1,

=> C1+ C2+C3 <= T1

1 + 1+ C3 <=3

=> C3max <= 1

=> URMSA= 1/3+1/4+1/5=78.3%

slide59

6

Algorithm Comparison

Based on Theorem 7,

=> C1/T1 + C2/T2 +C3/T3 <= 1

1/3 + 1/4+ C3/5 <=1

=> C3max<= 25/12 ≈ 2.0833

=> UDDSA = 1/3+1/4+2.0833/5

= 1/3+1/4+(25/12)/5 =100%

slide60

6

Algorithm Comparison

Based on Theorem 9,

=> if k=1, then [t/T2]C2 + [t/T3]C3 <= a1(20)

[20/4]*1 + [20/5]C3 <= 13

=> C3max = 2

for U = C1/T1 +C2/T2 +C3/T3

=> UMSA = 1/3+1/4+2/5=98.3%

slide61

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.

slide62

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.

slide63

7

Conclusion

3. Conclusion

Dynamic Deadline Driven Scheduling Algorithm:

is shown to be globally optimum and capable of achieving 100%

slide64

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.