9 task scheduling- co operative models

Upload: dugguz

Post on 29-May-2018

280 views

Category:

Documents


2 download

TRANSCRIPT

  • 8/9/2019 9 Task Scheduling- Co Operative Models

    1/25

    2008Chapter-8 L16: "Embedded Systems - Architecture,

    Programming and Design" , Raj Kamal, Publs.: McGraw-Hill,Inc.

    1

    REAL TIME OPERATING SYSTEMS

    Lesson-16:Task Scheduling Cooperative ModelsTask Scheduling Cooperative Models

  • 8/9/2019 9 Task Scheduling- Co Operative Models

    2/25

    2008Chapter-8 L16: "Embedded Systems - Architecture,

    Programming and Design" , Raj Kamal, Publs.: McGraw-Hill,Inc.

    2

    1. Common scheduling models1. Common scheduling models

  • 8/9/2019 9 Task Scheduling- Co Operative Models

    3/25

    2008Chapter-8 L16: "Embedded Systems - Architecture,

    Programming and Design" , Raj Kamal, Publs.: McGraw-Hill,Inc.

    3

    Common scheduling modelsCommon scheduling models

    Cooperative Scheduling of ready tasks in acircular queue. It closely relates to functionqueue scheduling.

    Cooperative Scheduling with PrecedenceConstraints

    Cyclic Scheduling of periodic tasks and RoundRobin Time Slicing Scheduling of equal prioritytasks

    Preemptive Scheduling Scheduling using 'Earliest Deadline First' (EDF)

    precedence.

  • 8/9/2019 9 Task Scheduling- Co Operative Models

    4/25

    2008Chapter-8 L16: "Embedded Systems - Architecture,

    Programming and Design" , Raj Kamal, Publs.: McGraw-Hill,Inc.

    4

    Common scheduling modelsCommon scheduling models

    Rate Monotonic Scheduling using higher rate of

    events occurrence First precedence

    Fixed Times Scheduling

    Scheduling of Periodic, sporadic and aperiodicTasks

    Advanced scheduling algorithms using the

    probabilistic Timed Petri nets (Stochastic) or

    Multi Thread Graph for the multiprocessors andcomplex distributed systems.

  • 8/9/2019 9 Task Scheduling- Co Operative Models

    5/25

    2008Chapter-8 L16: "Embedded Systems - Architecture,

    Programming and Design" , Raj Kamal, Publs.: McGraw-Hill,Inc.

    5

    2. Cooperative Scheduling in the cyclic2. Cooperative Scheduling in the cyclic

    orderorder

  • 8/9/2019 9 Task Scheduling- Co Operative Models

    6/25

    2008Chapter-8 L16: "Embedded Systems - Architecture,

    Programming and Design" , Raj Kamal, Publs.: McGraw-Hill,Inc.

    6

    Cooperative Scheduling in the cyclic orderCooperative Scheduling in the cyclic order

    Each task cooperate to let the running taskfinish

    Cooperative means that each task

    cooperates to let the a running one finish.

    None of the tasks does block in-between

    anywhere during the ready to finish states.

    The service is in the cyclic order

  • 8/9/2019 9 Task Scheduling- Co Operative Models

    7/25

    2008Chapter-8 L16: "Embedded Systems - Architecture,

    Programming and Design" , Raj Kamal, Publs.: McGraw-Hill,Inc.

    7

    WorstWorst--case latencycase latency

    Same for every task

    Tworst = {(sti + eti )1 + (sti + eti )2 +...+ (sti + eti)N-1 + (sti + eti )N} + tISR.

    tISR is the sum of all execution times for the ISRs

    For an i-th task, switching time from one task to

    another be is sti and task execution time be is eti

    i = 1, 2, , N 1 , N, when number of tasks = N

  • 8/9/2019 9 Task Scheduling- Co Operative Models

    8/25

    2008Chapter-8 L16: "Embedded Systems - Architecture,

    Programming and Design" , Raj Kamal, Publs.: McGraw-Hill,

    Inc.

    8

    Program counter assignments (switch) at different

    times, when the on the scheduler calls the o tasks

    from the list one by one in the circular queue fromthe list.

  • 8/9/2019 9 Task Scheduling- Co Operative Models

    9/25

    2008Chapter-8 L16: "Embedded Systems - Architecture,

    Programming and Design" , Raj Kamal, Publs.: McGraw-Hill,

    Inc.

    9

    Cyclic scheduling model in tasks scheduling

  • 8/9/2019 9 Task Scheduling- Co Operative Models

    10/25

    2008Chapter-8 L16: "Embedded Systems - Architecture,

    Programming and Design" , Raj Kamal, Publs.: McGraw-Hill,

    Inc.

    10

    First three tasks among N- tasks in washing machine

    tasks scheduling

  • 8/9/2019 9 Task Scheduling- Co Operative Models

    11/25

    2008Chapter-8 L16: "Embedded Systems - Architecture,

    Programming and Design" , Raj Kamal, Publs.: McGraw-Hill,

    Inc.

    11

    Messages from the scheduler and task programs

    contexts at various instances in washing machine

    tasks scheduling

  • 8/9/2019 9 Task Scheduling- Co Operative Models

    12/25

    2008Chapter-8 L16: "Embedded Systems - Architecture,

    Programming and Design" , Raj Kamal, Publs.: McGraw-Hill,

    Inc.

    12

    2. Cooperative Scheduling of Ready Tasks2. Cooperative Scheduling of Ready Tasks

    in Listin List

  • 8/9/2019 9 Task Scheduling- Co Operative Models

    13/25

    2008Chapter-8 L16: "Embedded Systems - Architecture,

    Programming and Design" , Raj Kamal, Publs.: McGraw-Hill,

    Inc.

    13

    Cooperative Scheduling in the order inCooperative Scheduling in the order in

    which a task is initiated on interruptwhich a task is initiated on interrupt

    None of the tasks does block in-between

    anywhere during the ready to finish states.

    The service is in the order in which a task is

    initiated on interrupt.

  • 8/9/2019 9 Task Scheduling- Co Operative Models

    14/25

    2008Chapter-8 L16: "Embedded Systems - Architecture,

    Programming and Design" , Raj Kamal, Publs.: McGraw-Hill,

    Inc.

    14

    WorstWorst--case latencycase latency

    Same for every task in the ready list

    Tworst = {(dti + sti + eti )1 + (dti + sti + eti )2+...+ (dti + sti + eti )n-1 + (dti + sti + eti )n} + tISR.

    tISR is the sum of all execution times for the ISRs

    For an i-th task, let the event detection time with

    when an event is brought into a list be is dti ,

    switching time from one task to another be is stiand task execution time be is eti

    i = 1, 2, , n 1 , n

  • 8/9/2019 9 Task Scheduling- Co Operative Models

    15/25

    2008Chapter-8 L16: "Embedded Systems - Architecture,

    Programming and Design" , Raj Kamal, Publs.: McGraw-Hill,

    Inc.

    15

    Scheduler in which the scheduler inserts into a list

    the ready tasks for a sequential execution in a

    cooperative mode

  • 8/9/2019 9 Task Scheduling- Co Operative Models

    16/25

    2008Chapter-8 L16: "Embedded Systems - Architecture,

    Programming and Design" , Raj Kamal, Publs.: McGraw-Hill,

    Inc.

    16

    3. Cooperative Scheduling of Ready Tasks3. Cooperative Scheduling of Ready Tasks

    Using an Ordered List as per precedenceUsing an Ordered List as per precedence

    ConstraintsConstraints

  • 8/9/2019 9 Task Scheduling- Co Operative Models

    17/25

    2008Chapter-8 L16: "Embedded Systems - Architecture,

    Programming and Design" , Raj Kamal, Publs.: McGraw-Hill,

    Inc.

    17

    Cooperative Scheduling in the order ofCooperative Scheduling in the order of

    Ready Tasks using an Ordered List as perReady Tasks using an Ordered List as per

    priority precedencepriority precedence

    Scheduler using a priority parameter,taskPriority does the ordering of list of thetasksordering according to the precedenceof the interrupt sources and tasks.

    The scheduler first executes only the firsttask at the ordered list, and the total, equalsthe to period taken by the first task on at the

    list. It is deleted from the list after the firsttask is executed and the next task becomesthe first.

  • 8/9/2019 9 Task Scheduling- Co Operative Models

    18/25

    2008Chapter-8 L16: "Embedded Systems - Architecture,

    Programming and Design" , Raj Kamal, Publs.: McGraw-Hill,

    Inc.

    18

    Cooperative Scheduling in the order ofCooperative Scheduling in the order of

    Ready Tasks using an Ordered List asReady Tasks using an Ordered List as

    per priority precedenceper priority precedence

    The insertions and deletions for forming theordered list are made only at the beginning

    of the cycle for each list.

  • 8/9/2019 9 Task Scheduling- Co Operative Models

    19/25

    2008Chapter-8 L16: "Embedded Systems - Architecture,

    Programming and Design" , Raj Kamal, Publs.: McGraw-Hill,

    Inc.

    19

    WorstWorst--case latencycase latency

    Not Same for every task. Varies from (dti +sti + eti ) p(m)} + tISRto {(dti + sti + eti )p1 + (dti + sti + eti ) p2 +...+ (dti+ st

    i+ et

    i)

    p(m-1)+ (dt

    i+ st

    i+ et

    i)

    p(m)} + t

    ISR.

    tISR is the sum of all execution times for the ISRs

    For an i-th task, let the event detection time withwhen an event is brought into a list be is dti ,switching time from one task to another be is stiand task execution time be is eti

    i = 1, 2, , m 1 , m; m is number of ISRs andtasks in the list

  • 8/9/2019 9 Task Scheduling- Co Operative Models

    20/25

    2008Chapter-8 L16: "Embedded Systems - Architecture,

    Programming and Design" , Raj Kamal, Publs.: McGraw-Hill,

    Inc.

    20

    Cooperative Priority based scheduling of the ISRs

    executing in the first layer and Priority based ready

    tasks at an ordered list executing in the second layer

  • 8/9/2019 9 Task Scheduling- Co Operative Models

    21/25

    2008Chapter-8 L16: "Embedded Systems - Architecture,

    Programming and Design" , Raj Kamal, Publs.: McGraw-Hill,

    Inc.

    21

    Program counter assignments at different times onProgram counter assignments at different times on

    the scheduler calls to the ISRs and the correspondingthe scheduler calls to the ISRs and the corresponding

    taskstasks

  • 8/9/2019 9 Task Scheduling- Co Operative Models

    22/25

    2008Chapter-8 L16: "Embedded Systems - Architecture,

    Programming and Design" , Raj Kamal, Publs.: McGraw-Hill,

    Inc.

    22

    Example of ACVMExample of ACVM

    First the coins inserted by the user are read,

    then the chocolate delivers, and then display

    task displays thank you, visit again

    message.

    Each task cooperates with other to finish.

    The precedence of tasks in the ready list

    reading coins is highest, then of chocolatedelivery and display for the ordered list of

    the ready tasks.

  • 8/9/2019 9 Task Scheduling- Co Operative Models

    23/25

    2008Chapter-8 L16: "Embedded Systems - Architecture,

    Programming and Design" , Raj Kamal, Publs.: McGraw-Hill,

    Inc.

    23

    SummarySummary

  • 8/9/2019 9 Task Scheduling- Co Operative Models

    24/25

    2008Chapter-8 L16: "Embedded Systems - Architecture,

    Programming and Design" , Raj Kamal, Publs.: McGraw-Hill,

    Inc.

    24

    We learntWe learnt

    Each task cooperate to let the running taskfinish in cooperative scheduling model

    Cyclic order

    Cyclic in list of initiated tasks into a readylist

    Cyclic in ordered list of initiated tasks into a

    ready list and list arranged in order of ISR

    and task priorities

  • 8/9/2019 9 Task Scheduling- Co Operative Models

    25/25

    2008Chapter-8 L16: "Embedded Systems - Architecture,

    Programming and Design" , Raj Kamal, Publs.: McGraw-Hill,

    Inc.

    25

    End of Lesson 16 of Chapter 8End of Lesson 16 of Chapter 8