new rts lect03[1]

Upload: debajyoti-sinha

Post on 07-Apr-2018

216 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/6/2019 New Rts Lect03[1]

    1/23

    CprE 458/558: Real-Time Systems (G. Manimaran) 1

    CprE 458/558: Real-Time Systems

    Scheduling Results &

    RMS and EDF Schedulers

  • 8/6/2019 New Rts Lect03[1]

    2/23

    CprE 458/558: Real-Time Systems (G. Manimaran) 2

    Understanding Fundamentals

    Understanding the boundary betweenpolynomial and NP-complete problems

    can provide insights into developing

    useful heuristics.

    Understanding the algorithms that

    achieve some of the polynomial results

    can again provide basis for developingheuristics.

  • 8/6/2019 New Rts Lect03[1]

    3/23

    CprE 458/558: Real-Time Systems (G. Manimaran) 3

    Understanding Fundamentals (cont.)

    Understanding the fundamental

    limitations of on-line algorithms will help

    designers avoid scheduling anomalies

    and misconceptions.

  • 8/6/2019 New Rts Lect03[1]

    4/23

    CprE 458/558: Real-Time Systems (G. Manimaran) 4

    Performance Metrics

    Minimizing Schedule Length.

    Minimizing Sum of Completion Times.

    Maximizing Weighted Sum of Values (Useful

    in RT systems).

    Minimizing the Maximum Lateness (useful inRT systems).

  • 8/6/2019 New Rts Lect03[1]

    5/23

    CprE 458/558: Real-Time Systems (G. Manimaran) 5

    Uniprocessor - some results

    One processor, Non-preemptive, Minimizingthe Max. Lateness (Polynomial).

    One processor, Non-preemptive, release time

    constraint, Minimizing the Max. Lateness (NP-

    hard).

    One processor, Preemptive, release timeconstraint, Minimizing the Max. Lateness

    (Polynomial).

  • 8/6/2019 New Rts Lect03[1]

    6/23

    CprE 458/558: Real-Time Systems (G. Manimaran) 6

    Uniprocessor - more results

    Result: When there are mutual exclusion

    constraints, it is impossible to find a totally on-line optimal scheduler.

    Result: The problem of deciding whether it is

    possible to schedule a set of periodic tasksthat use semaphores only to enforce mutualexclusion in NP-hard.

    Overload Result: There does not exist an on-

    line scheduling algorithm with a competitivefactor greater than 0.25. (this is for generalcase: arbitrary number of processors).

  • 8/6/2019 New Rts Lect03[1]

    7/23

    CprE 458/558: Real-Time Systems (G. Manimaran) 7

    Multiprocessor Some Results

    Result: The multiprocessor scheduling on P

    processors with task preemption allowed and

    with minimization of the number of late tasks

    is NP-hard.

    Result: For two or more processors, no

    deadline scheduling algorithm can be optimal

    without complete a prior knowledge of

    deadlines, computation times, and task readytimes.

  • 8/6/2019 New Rts Lect03[1]

    8/23

    CprE 458/558: Real-Time Systems (G. Manimaran) 8

    Multiprocessor more results

    EDF is not optimal in the multiprocessor case.

    No on-line scheduling algorithm can guarantee

    a cumulative value greater than one half for

    the dual processor case. (A special case ofoverload result)

  • 8/6/2019 New Rts Lect03[1]

    9/23

    CprE 458/558: Real-Time Systems (G. Manimaran) 9

    Multiprocessor; Single Deadline;

    Non-premptive

    NP-completeness is mainly due to non-uniformtask execution time and resource constraints.

  • 8/6/2019 New Rts Lect03[1]

    10/23

    CprE 458/558: Real-Time Systems (G. Manimaran) 10

    Multiprocessing Anomalies

    Assume that a set of tasks is optimallyschedulable on a multiprocessor with somepriority order, a fixed number of processors,fixed computation times, and precedenceconstraints.

    Result: For the stated problem, changing thepriority list, increasing the number ofprocessors, reducing the computation times,or weakening the precedence constraints can

    increase the schedule length.

  • 8/6/2019 New Rts Lect03[1]

    11/23

    CprE 458/558: Real-Time Systems (G. Manimaran) 11

    Multiprocessing Anomalies (cont.)

    These anomalies may cause some of thealready guaranteed tasks to miss theirdeadlines.

    It can be shown that run-time anomaliescannot occur in a multiprocessor schedulewhen the tasks are independent.

  • 8/6/2019 New Rts Lect03[1]

    12/23

    CprE 458/558: Real-Time Systems (G. Manimaran) 12

    Run-time Anomaly

    Run-time anomaly may occur when the actualcomputation time of a task differs from itsworst case computation time in a non-preemptive multiprocessor schedule withresource constraints.

    A processor is said to be work conserving if it isnever idle when there is a task to execute. Anywork conserving scheme may lead to run-time

    anomaly.

  • 8/6/2019 New Rts Lect03[1]

    13/23

    CprE 458/558: Real-Time Systems (G. Manimaran) 13

    Run-time Anomaly Example

    Example: Ti=(ai,ci,di)

    T1=(0,20,22); T2=(0,12,25); T3=(10,8,26);T4=(8,10,30).

    T3 and T4 have resource conflicts;

    Actual computation time ofT1 is 10.

  • 8/6/2019 New Rts Lect03[1]

    14/23

    CprE 458/558: Real-Time Systems (G. Manimaran) 14

    Priority-drivenPreemptive Scheduling

    Assumptions & Definitions

    Tasks are periodic No aperiodic or sporadic tasks

    Job (instance) deadline = end of period

    No resource constraints

    Tasks are preemptable

    Laxity of a Task

    Ti = di (t + c i)

    where di: deadline;

    t : current time;

    ci : remaining computation time.

    t

    Ci

    Laxity

    di

  • 8/6/2019 New Rts Lect03[1]

    15/23

    CprE 458/558: Real-Time Systems (G. Manimaran) 15

    Rate Monotonic Scheduling (RMS)

    Schedulability check (off-line)

    - A set ofn tasks is schedulable on auniprocessor by the RMS algorithm if theprocessor utilization (utilization test):

    The term n(21/n-1) approaches ln 2,(}0.69 as np g).

    - This condition is sufficient, but not necessary.

  • 8/6/2019 New Rts Lect03[1]

    16/23

    CprE 458/558: Real-Time Systems (G. Manimaran) 16

    RMS (cont.)

    Schedule construction (online)- Task with the smallest period is assigned the

    highest priority.

    - At any time, the highest priority task is

    executed.

    RMS is an optimal preemptive scheduling

    algorithm with fixed priorities.Static/fixed priority algorithm assigns the same

    priority to all the jobs (instances) in each task.

  • 8/6/2019 New Rts Lect03[1]

    17/23

    CprE 458/558: Real-Time Systems (G. Manimaran) 17

    RMS Scheduler -- Example 1

    Task set: Ti = (ci, pi)

    T1 = (2,4) and T2 = (1,8)

    Schedulability check:

    2/4 + 1/8 = 0.5 + 0.125 = 0.625 2(2 -1) = 0. 82

    T11 T2

    1 T12

    0 2 3 4 6 8

    ActiveTasks :

    {T1, T2}

    ActiveTasks :

    {T2}

    ActiveTasks :

    {T1}

  • 8/6/2019 New Rts Lect03[1]

    18/23

    CprE 458/558: Real-Time Systems (G. Manimaran) 18

    RMS scheduler -- Example-2

    Task set: Ti = (ci, pi)

    T1 = (2,4) and T2 = (4,8)

    Schedulability check:

    2/4 + 4/8 = 0.5 + 0.5 = 1.0 > 2(2 -1) = 0. 82

    T11 T2

    1 T12

    0 2 3 4 6 8

    ActiveTasks :

    {T1, T2}

    ActiveTasks :

    {T2}

    ActiveTasks :

    {T2, T1}

    T21

    ActiveTasks :

    {T2}

    Some task sets that FAIL the utilization-based schedulability test are alsoschedulable under RMS We need exact analysis (necessary & sufficient)

  • 8/6/2019 New Rts Lect03[1]

    19/23

    CprE 458/558: Real-Time Systems (G. Manimaran) 19

    Earliest Deadline First (EDF)

    Schedulability check (off-line)

    -A set ofn tasks is schedulable on a

    uniprocessor by the EDF algorithm if the

    processor utilization.

    This condition is both necessary and sufficient.

    - Least Laxity First (LLF) algorithm has the

    same schedulability check.

  • 8/6/2019 New Rts Lect03[1]

    20/23

    CprE 458/558: Real-Time Systems (G. Manimaran) 20

    EDF/LLF (cont.)

    Schedule construction (online)

    EDF/LLF: Task with the smallestdeadline/laxity is assigned the highestpriority.

    At any time, the highest priority task is

    executed.

    EDF/LLF is an optimal preemptive schedulingalgorithm with dynamic priorities.

    Dynamic priority algorithm assigns differentpriorities to the individual jobs (instances) ineach task.

  • 8/6/2019 New Rts Lect03[1]

    21/23

    CprE 458/558: Real-Time Systems (G. Manimaran) 21

    EDF scheduler -- Example

    Task set: Ti = (ci, pi, di)

    T1 = (1,3,3) and T2 = (4,6,6)

    Schedulability check:

    1/3 + 4/6 = 0.33 + 0.67 = 1.0

    T11 T2

    1 T12

    0 1 5 6

    ActiveTasks :

    {T1, T2}

    ActiveTasks :

    {T2}

    ActiveTasks :

    {T2, T1}

    ActiveTasks :

    {T1}

    Unlike RMS, Only those task sets which pass the schedulability test areschedulable under EDF

    3

    T21

  • 8/6/2019 New Rts Lect03[1]

    22/23

    CprE 458/558: Real-Time Systems (G. Manimaran) 22

    RMS vs. EDF/LLF

    RMS is an optimal preemptive scheduling

    algorithm with fixed priorities.

    EDF/LLF is an optimal preemptive schedulingalgorithm with dynamic priorities.

    RMS schedulability properties can beanalyzed; rich theory exists and it is widelyused in practice.

    EDF/LLF offers higher schedulability thanRMS, but it is more difficult to implement.

  • 8/6/2019 New Rts Lect03[1]

    23/23

    CprE 458/558: Real-Time Systems (G. Manimaran) 23

    RMS & EDF -- Example

    0 5 10 15 20 25 30 35

    0 7 14 21 28 35

    T1

    T2

    RMS schedule

    0 5 10 15 20 25 30 35

    0 7 14 21 28 35

    T1

    T2

    EDF schedule

    Deadline miss

    Process Period, T WCET, C

    T1 5 2T2 7 4