+ All Categories
Home > Documents > RTOS_schedulng

RTOS_schedulng

Date post: 17-Feb-2018
Category:
Upload: rktiwary256034
View: 221 times
Download: 0 times
Share this document with a friend

of 17

Transcript
  • 7/23/2019 RTOS_schedulng

    1/17

    2010-09-11

    1

    Fixed-Priority Multiprocessor Scheduling

    [RTAS 2010]

    Joint work with

    Nan Guan, Martin Stigge and Yu Ge

    Northeastern University, ChinaUppsala University, Sweden

    Real-time Systems

    N periodic tasks (of different rates/periods)

    How to schedule the jobs to avoid deadline miss?

    ri1 ri2 ri3 ri4

    Ti Ti

    Ji1 Ji2 Ji3

    TiCi C

    i

    Ci

    Utilization/workload:

    On Single-processors

    Liu and Laylands Utilization Bound [1973]

    (the 19th most cited paper in computer science)

    Scheduled by RMS (Rate Monotonic Scheduling)

    number oftasks

    Rate Monotonic Scheduling

    Priority assignment: shorter period higher prio.

    Run-time schedule: the highest priority first

    How to check whether all deadlines are met?

    high priority

    mediate priority

    low priority

    Run-time schedule

    Liu and Laylands Utilization Bound

    Schedulability Analysis

    P

    100%

    Schedulable?

    77.9%Ui 1 2 3

    Ui= Ci/ Ti

    Liu and Laylands bound:

    Liu and Laylands Utilization Bound

    Schedulability Analysis

    CPU

    100%Yes, schedulable!77.9%

    Liu and Laylands bound:

    1

    2

    3

  • 7/23/2019 RTOS_schedulng

    2/17

    2010-09-11

    2

    Multiprocessor (multicore) Scheduling

    Significantly more difficult:

    Timing anomalies

    Hard to identify the worst-case scenario

    Bin-packing/NP-hard problems

    Multiple resources e.g. caches, bandwidth

    Open Problem (since 1973)

    Find a multiprocessor scheduling algorithm thatcan achieve Liu and Laylands utilization bound

    number of

    processors

    ?

    Multiprocessor Scheduling

    52

    1 6

    8

    4

    new task

    waiting queue

    cpu 1 cpu 2 cpu 3

    Global Scheduling

    cpu 1 cpu 2 cpu 3

    5

    1

    2

    8

    6

    3

    9

    7

    4

    cpu 1 cpu 2 cpu 3

    2

    5

    2

    1

    22

    3

    6

    7

    4

    2 3

    Partitioned SchedulingPartitioned Scheduling

    with Task Splitting

    Best Known Results (before 2010)

    Best Known Results (before 2010)

    Lehoczky et al. CMU

    ECRTS 2009

    Best Known Results

    20

    10

    30

    40

    60

    50

    70

    80

    Multiprocessor Scheduling

    Global Partitioned

    FixedPriority

    DynamicPriority

    Task Splitting

    FixedPriority

    DynamicPriority

    FixedPriority

    DynamicPriority

    38

    %

    50

    Liu and Laylands

    Utilization Bound

    50 50

    65 66

    [OPODIS08]

    [TPDS05] [ECRTS03] [RTSS04]

    [RTCSA06]

    Our New ResultRTAS 2010

    RTSS 2010_submitted

    69.3

  • 7/23/2019 RTOS_schedulng

    3/17

    2010-09-11

    3

    Multiprocessor Scheduling

    52

    1 6

    8

    4

    new task

    waiting queue

    cpu 1 cpu 2 cpu 3

    Global Scheduling

    Would fixed-priority schedulinge.g. RMS work?

    Multiprocessor Scheduling

    52

    1 6

    8

    4

    new task

    waiting queue

    cpu 1 cpu 2 cpu 3

    Global Scheduling

    Would fixed-priority schedulinge.g. RMS work?

    Unfortunately RMS suffersfrom the Dhalls anomali

    Utilization may be 0%

    Dhalls anomali

    1Task 1

    Task 22

    3

    1

    2

    0 1+ 1

    Task 3

    Dhalls anomali

    1CPU1

    CPU22

    1

    2

    0 1+ 1

    3 3

    Schedule the 3 tasks on 2 CPUs using RMS

    Deadline miss

    Dhalls anomali

    P1 P2 PM

    #1 #2 #M #M+1

    M* + 1/(1+ )

    /1 /1 /1

    1/(+1)

    0M

    U

    (M+1 tasks and M processors)

    Multiprocessor Scheduling

    cpu 1cpu 2 cpu 3

    5

    1

    2

    8

    6

    3

    9

    7

    4

    Partitioned Scheduling

  • 7/23/2019 RTOS_schedulng

    4/17

    2010-09-11

    4

    Multiprocessor Scheduling

    cpu 1 cpu 2 cpu 3

    5

    1

    2

    8

    6

    3

    9

    7

    4

    Partitioned Scheduling

    Resource utilization maybe limited to 50%

    Partitioned Scheduling

    The Partitioning Problem is similar to

    Bin-packing Problem (NP-hard)

    Limited Resource Usage, 50% necessary condition toguarantee schedulability

    P1 P2 PM

    #1 #2 #M #M+1 50%+

    Partitioned Scheduling

    The Partitioning Problem is similar to

    Bin-packing Problem (NP-hard)

    Limited Resource Usage necessary condition toguarantee schedulability

    P1 P2 PM

    #1 #2 #M

    #M+150%+

    Partitioned Scheduling

    The Partitioning Problem is similar to

    Bin-packing Problem (NP-hard)

    Limited Resource Usage necessary condition toguarantee schedulability

    P1 P2 PM

    #1 #2 #M

    #M+1,1 50%+

    #M+1,2

    Partitioned Scheduling

    The Partitioning Problem is similar to

    Bin-packing Problem (NP-hard)

    Limited Resource Usage necessary condition toguarantee schedulability

    P1 P2 PM

    #1 #2 #M

    #M+1,1

    50%+

    #M+1,2

    Multiprocessor Scheduling

    cpu 1 cpu 2 cpu 3

    2

    5

    2

    1

    22

    3

    6

    7

    4

    2 3

    Partitioned Schedulingwith Task Splitting

  • 7/23/2019 RTOS_schedulng

    5/17

    2010-09-11

    5

    Partitioned Scheduling

    Partitioning

    P1

    1

    P2 P3

    1 31 2

    4 5 6

    7 8 9

    Bin-Packing with Item Splitting

    Resource can be fully (better) utilized

    Bin1 Bin2 Bin3

    123

    11

    2 45

    782

    681

    Previous Algorithms[Kato et al. IPDPS08] [Kato et al. RTAS09] [Lakshmanan et al. ECRTS09]

    Sort the tasks in some order e.g. utilization or priority order

    Select a processor, and assign as many tasks as possible

    3

    4

    2

    5

    1

    6

    8

    7

    P1

    Lakshmanans Algorithm [ECRTS09]

    Sort all tasks in decreasing order of utilization

    3

    4

    2

    5

    1

    6

    8

    7

    lowest util.

    highest util.

    Lakshmanans Algorithm [ECRTS09]

    Pick up one processor, and assign as many

    tasks as possible

    P1

    3

    4

    2

    5

    1

    6

    8

    7

    lowest util.

    highest util.

    Lakshmanans Algorithm [ECRTS09]

    Pick up one processor, and assign as many

    tasks as possible

    P1

    8

    3

    4

    2

    5

    1

    6

    7

    lowest util.

    highest util.

  • 7/23/2019 RTOS_schedulng

    6/17

    2010-09-11

    6

    Lakshmanans Algorithm [ECRTS09]

    Pick up one processor, and assign as many

    tasks as possible

    P1

    8

    3

    4

    2

    5

    1

    6

    7

    lowest util.

    highest util.

    Lakshmanans Algorithm [ECRTS09]

    Pick up one processor, and assign as many

    tasks as possible

    P1

    8

    3

    4

    2

    5

    1

    62

    7

    61

    lowest util.

    highest util.

    Lakshmanans Algorithm [ECRTS09]

    Pick up one processor, and assign as many

    tasks as possible

    P1

    8

    3

    4

    2

    5

    1

    62

    7

    61

    P2

    lowest util.

    highest util.

    Lakshmanans Algorithm [ECRTS09]

    Pick up one processor, and assign as many

    tasks as possible

    P1

    8

    3

    4

    2

    5

    1

    7

    61

    P2

    62

    lowest util.

    highest util.

    Lakshmanans Algorithm [ECRTS09]

    Pick up one processor, and assign as many

    tasks as possible

    P1

    8

    3

    4

    2

    1

    7

    61

    P2

    562

    lowest util.

    highest util.

    Lakshmanans Algorithm [ECRTS09]

    Pick up one processor, and assign as many

    tasks as possible

    P1

    8

    3

    2

    1

    7

    61

    P2

    562

    4

    lowest util.

    highest util.

  • 7/23/2019 RTOS_schedulng

    7/17

    2010-09-11

    7

    Lakshmanans Algorithm [ECRTS09]

    Pick up one processor, and assign as many

    tasks as possible

    P1

    8

    2

    1

    7

    61

    P2

    562

    4

    3

    lowest util.

    highest util.

    Lakshmanans Algorithm [ECRTS09]

    Pick up one processor, and assign as many

    tasks as possible

    P1

    8

    1

    7

    61

    P2

    562

    4

    321

    22

    lowest util.

    highest util.

    Lakshmanans Algorithm [ECRTS09]

    Pick up one processor, and assign as many

    tasks as possible

    P1

    8

    7

    61

    P2

    562

    4

    321

    P3

    22

    1lowest util.

    highest util.

    Lakshmanans Algorithm [ECRTS09]

    Pick up one processor, and assign as many

    tasks as possible

    P1

    8

    7

    61

    P2

    562

    4

    321

    P3

    122

    lowest util.

    highest util.

    Lakshmanans Algorithm [ECRTS09]

    Pick up one processor, and assign as many

    tasks as possible

    P1

    8

    7

    61

    P2

    562

    4

    321

    P3

    122

    key feature:

    depth-first partitioningwith decreasing utilization order

    lowest util.

    highest util.

    Lakshmanans Algorithm [ECRTS09]

    Pick up one processor, and assign as many

    tasks as possible

    P1

    8

    7

    61

    P2

    562

    4

    321

    P3

    122

    Utilization Bound:

    65%lowest util.

    highest util.

  • 7/23/2019 RTOS_schedulng

    8/17

    2010-09-11

    8

    Our Algorithm[RTAS10]

    width-first partitioning

    with increasing priority order

    Our Algorithm

    Sort all tasks in increasing priority order

    7

    6

    5

    4

    3

    2

    1highest priority

    lowest priority

    Our Algorithm

    Select the processor on which the assigned

    utilization is the lowest

    7

    6

    5

    4

    3

    2

    1

    P1 P2 P3

    highest priority

    lowest priority

    Our Algorithm

    Select the processor on which the assigned

    utilization is the lowest

    6

    5

    4

    3

    2

    1

    P1 P2 P3

    7

    highest priority

    lowest priority

    Our Algorithm

    Select the processor on which the assigned

    utilization is the lowest

    5

    4

    3

    2

    1

    P1 P2 P3

    76

    highest priority

    lowest priority

    Our Algorithm

    Select the processor on which the assigned

    utilization is the lowest

    4

    3

    2

    1

    P1 P2 P3

    76 5

    highest priority

    lowest priority

  • 7/23/2019 RTOS_schedulng

    9/17

    2010-09-11

    9

    Our Algorithm

    Select the processor on which the assigned

    utilization is the lowest

    3

    2

    1

    P1 P2 P3

    76 54

    highest priority

    lowest priority

    Our Algorithm

    Select the processor on which the assigned

    utilization is the lowest

    2

    1

    P1 P2 P3

    76 54

    3

    highest priority

    lowest priority

    Our Algorithm

    Select the processor on which the assigned

    utilization is the lowest

    1

    P1 P2 P3

    76 54

    321

    22

    highest priority

    lowest priority

    Our Algorithm

    Select the processor on which the assigned

    utilization is the lowest

    1

    P1 P2 P3

    76 54

    321

    22

    highest priority

    lowest priority

    Our Algorithm

    Select the processor on which the assigned

    utilization is the lowest

    P1 P2 P3

    76 54

    321

    12

    1122

    highest priority

    lowest priority

    Our Algorithm

    Select the processor on which the assigned

    utilization is the lowest

    P1 P2 P3

    76 54

    321 1

    21122

  • 7/23/2019 RTOS_schedulng

    10/17

    2010-09-11

    10

    Our Algorithm

    Select the processor on which the assigned

    utilization is the lowest

    P1 P2 P3

    76 54

    321 1

    21122

    highest priority

    lowest priority

    key feature:

    width-first partitioningwith increasing prio order

    Comparison

    P1

    8

    7

    61

    P2

    562

    4

    31

    P3

    1

    2

    32

    P1 P2

    3

    P3

    11

    8

    4

    2

    7 6

    5

    12

    Why is our algorithm better?

    & increasing priority order

    Ours: width-first Previous: depth-first

    & decreasing utilization order

    Comparison

    P1

    8

    7

    61

    P2

    562

    4

    31

    P3

    1

    2

    32

    P1 P2

    3

    P3

    11

    8

    4

    2

    7 6

    5

    12

    Why is our algorithm better?

    & increasing priority order

    Ours: width-first Previous: depth-first

    & decreasing utilization order

    By our algorithm split tasks generally have higher priorities

    Split Task

    Consider an extreme scenario:

    suppose each subtask has the highest priority

    schedulable anyway, we do not need to worry abouttheir deadlines

    The difficult case is when the tail task is not on the top

    the key point is to ensure the tail task is schedulable

    38

    42

    7 6

    5

    12 1113

    Split Task

    Subtasks should execute in the correct order

    i

    i1

    i2

    i3

    P1

    P2

    P3

    r d

    Split Task

    Subtasks get shorter deadlines

    i

    i1

    i2

    i3

    P1

    P2

    P3

    r d

    i = Ti - Ri1 - Ri

    2

    Ri1

    Ri2

  • 7/23/2019 RTOS_schedulng

    11/17

    2010-09-11

    11

    Split Task

    Subtasks should execute in the correct order

    i

    i1

    i2

    i3

    P1

    P2

    P3

    r d

    i = Ti - Ri1 - Ri

    2

    Ri1

    Ri2

    These two are on the top: no problem with schedulability

    Split Task

    Subtasks should execute in the correct order

    i

    i1

    i2

    i3

    P1

    P2

    P3

    r d

    i = Ti - Ri1 - Ri

    2

    Ri1

    Ri2

    These two are on the top: no problem with schedulability

    ?

    Why the tail task is schedulable?

    21 22

    X1 X2

    Y2

    Y2 + U22

  • 7/23/2019 RTOS_schedulng

    12/17

    2010-09-11

    12

    Problem of Heavy Tasks

    P1 P2 P3

    highest priority

    lowest priority

    5

    4

    2

    1

    8

    7

    6

    9

    3

    Problem of Heavy Tasks

    P1 P2 P3

    highest priority

    lowest priority

    5

    4

    2

    1

    8

    7

    6

    9

    3

    Problem of Heavy Tasks

    P1 P2 P3

    highest priority

    lowest priority

    5

    4

    2

    1

    8 7

    6

    9

    3

    Problem of Heavy Tasks

    P1 P2 P3

    highest priority

    lowest priority

    5

    4

    2

    1

    8 762

    9

    3

    61

    Problem of Heavy Tasks

    P1 P2 P3

    highest priority

    lowest priority

    5

    4

    21

    8 762

    9

    3

    61

    Problem of Heavy Tasks

    P1 P2 P3

    highest priority

    lowest priority

    5

    4

    21

    8 762

    9

    3

    61

  • 7/23/2019 RTOS_schedulng

    13/17

    2010-09-11

    13

    Problem of Heavy Tasks

    P1 P2 P3

    highest priority

    lowest priority

    54

    2

    1

    8 762

    9

    3

    61

    Problem of Heavy Tasks

    P1 P2 P3

    highest priority

    lowest priority

    54

    2

    1

    8 762

    9

    361

    Problem of Heavy Tasks

    P1 P2 P3

    highest priority

    lowest priority

    54

    2

    1

    8 762

    936

    1

    Problem of Heavy Tasks

    P1 P2 P3

    54

    21

    8 762

    936

    1

    Problem of Heavy Tasks

    P1 P2 P3

    54

    21

    8 762

    9

    361

    the heavy tasks tail task

    may have too low priority level

    Solution for Heavy Tasks

    Pre-assigning the heavy tasks (that may have

    low priorities)

    P1 P2 P3

    highest priority

    lowest priority

    5

    4

    2

    1

    8

    7

    6

    9

    3

  • 7/23/2019 RTOS_schedulng

    14/17

    2010-09-11

    14

    Solution for Heavy Tasks

    Pre-assigning the heavy tasks (that may have

    low priorities)

    P1 P2 P3

    highest priority

    lowest priority

    5

    4

    2

    1

    8

    7

    6

    9

    3

    Solution for Heavy Tasks

    Pre-assigning the heavy tasks (that may have

    low priorities)

    P1 P2 P3

    highest priority

    lowest priority

    5

    4

    2

    1

    8

    7

    6

    9

    3

    Solution for Heavy Tasks

    Pre-assigning the heavy tasks (that may have

    low priorities)

    P1 P2 P3

    highest priority

    lowest priority

    5

    4

    2

    1

    8

    7

    6

    9

    3

    Solution for Heavy Tasks

    Pre-assigning the heavy tasks (that may have

    low priorities)

    P1 P2 P3

    highest priority

    lowest priority

    5

    4

    2

    1

    876

    9

    3

    Solution for Heavy Tasks

    Pre-assigning the heavy tasks (that may have

    low priorities)

    P1 P2 P3

    highest priority

    lowest priority

    5

    4

    2

    1

    876

    9

    3

    Solution for Heavy Tasks

    Pre-assigning the heavy tasks (that may have

    low priorities)

    P1 P2 P3

    highest priority

    lowest priority

    54

    2

    1

    876

    9

    3

  • 7/23/2019 RTOS_schedulng

    15/17

    2010-09-11

    15

    Solution for Heavy Tasks

    Pre-assigning the heavy tasks (that may have

    low priorities)

    P1 P2 P3

    highest priority

    lowest priority

    54

    2

    1

    876

    9

    3

    Solution for Heavy Tasks

    Pre-assigning the heavy tasks (that may have

    low priorities)

    P1 P2 P3

    highest priority

    lowest priority

    542

    1

    876

    9

    3

    Solution for Heavy Tasks

    Pre-assigning the heavy tasks (that may have

    low priorities)

    P1 P2 P3

    highest priority

    lowest priority

    542

    12

    876

    9

    311

    Solution for Heavy Tasks

    Pre-assigning the heavy tasks (that may have

    low priorities)

    P1 P2 P3

    542

    876

    9

    311

    12

    Solution for Heavy Tasks

    Pre-assigning the heavy tasks (that may have

    low priorities)

    P1 P2 P3

    542

    876

    9

    31112

    avoid to split heavy tasks(that may have low priorities)

    Theorem

    By introducing the pre-assignment mechanism,

    we have

    Liu and Laylands utilization bound for all task sets!

  • 7/23/2019 RTOS_schedulng

    16/17

    2010-09-11

    16

    Overhead

    In both previous algorithms and ours

    The number of task splitting is at most M-1

    task splitting -> extra migration/preemption

    Our algorithm on average has less task splitting

    P1 P2 P3P1 P2 P3

    Ours: width-first depth-first

    Implementation

    Easy!

    One timer for each split task

    Implemented as task migration

    i1

    Ci1

    P1

    P2

    task i

    higher prio

    tasks

    i2

    until finished

    as being resumed

    as being preempted

    lower prio

    tasks

    Further Improvement

    P1

    100%

    Schedulable?P2 P3

    3

    2

    1

    6

    5

    4

    9

    8

    7

    Uisng Liu and Laylands Utilization Bound

    P1 P2 P3

    Yes, schedulable

    by our algorithm100%

    Utilization Bound is Pessimistic

    The Liu and Layland utilization bound is

    sufficient but not necessary

    many task sets are actually schedulable even if

    the total utilization is larger than the bound

    P

    10.69

    (1, 4)

    (2, 12)

    (1, 4)

    (2, 8)

    Exact Analysis

    Exact Analysis: Response Time Analysis [Lehoczky_89]

    pseudo-polynomial

    (1, 4)

    (2, 12)

    (1, 4)

    (2, 8)

    Rk

    task k is schedulable iffRk

  • 7/23/2019 RTOS_schedulng

    17/17

    2010-09-11

    Utilization Bound v.s. Exact Analysis

    On single processors

    P

    100%

    Utilization bound Testfor RMS

    P

    Exact Analysisfor RMS

    [Lehoczky_89]

    88%100%

    On Multiprocessors

    Can we do something similar on multiprocessors?

    P1 P2 P3

    Utilization bound Testthe algorithm introduced above ?

    P1 P2 P3

    100% 100%

    Beyond Layland & Lius Bound [RTSS 2010, rejected!]

    Our RTAS10 algorithm: Increasing RMS priority order & worst-f it partitioning

    Utilization test to determine the maximal load for each processor

    The maximal load for each processor bounded by 69.3%

    Improved algorithm: Employ Response Time Analysis to determine the maximal

    workload on each processor

    more flexible behavior (more difficult to prove )

    Same utilization bound for the worst case, but

    Much better average perfo rmance (by simulation)

    I believe this is the best algorithm one can hopefor fixed-prioritiy multiprocessor scheduling

    Conclusions

    The (multicore) Timing Problem is challenging

    Difficult to guarantee Real-Time

    and Difficult to analyze/predict

    Solutions: Partition & Isolation

    Shared caches: coloring/partition

    Memory bus/bandwidth: TDMA, ? Processor cores: partition-based scheduling

    Thanks!