View
33
Download
2
Category
Tags:
Preview:
DESCRIPTION
CprE 458/558: Real-Time Systems. Combined Scheduling of Periodic and Aperiodic Tasks. Assumptions & Issues. RMS scheduling algorithm used All periodic tasks start at time t=0 (same as before) Periodic tasks relative deadlines are equal to end of period - PowerPoint PPT Presentation
Citation preview
CprE 458/558: Real-Time Systems (G. Manimaran) 1
CprE 458/558: Real-Time Systems
Combined Scheduling of
Periodic and Aperiodic Tasks
CprE 458/558: Real-Time Systems (G. Manimaran) 2
Assumptions & Issues
• RMS scheduling algorithm used• All periodic tasks start at time t=0 (same as
before)• Periodic tasks relative deadlines are equal to
end of period• Arrival times of aperiodic tasks unknown
• Schedulability of periodic tasks• Response time for aperiodic tasks• Implementation considerations
CprE 458/558: Real-Time Systems (G. Manimaran) 3
Background Scheduling Algorithm
• No server is created.
• Aperiodic tasks are executed when there is no periodic task to execute.
• Simple, but no guarantee on aperiodic schedulability
Periodic tasks
CPU
Aperiodic tasks
RMS
FIFO/EDF…
High priority Queue
Low priority Queue
CprE 458/558: Real-Time Systems (G. Manimaran) 4
Normal RMS schedule: Notice the holes
Task set: Ti = (ci, pi)
T1 = (2,6) and T2 = (4,10)
Schedulability check:
2/6 + 4/10 = 0.33 + 0.40 = 0.73 ≤ 2(√2 -1) = 0. 82
T11 T1
2
0 2 6 8 10
T21 T2
2
0 2 6 10
T1
T2
Hole
Background scheduling: basic
idea --Scheduling
aperiodic tasks in holes like this
Schedule continues
CprE 458/558: Real-Time Systems (G. Manimaran) 5
Background Scheduling: Example
T11 T1
2
0 2 6 8 10
T21 T2
2
0 2 6
T1
T2
10
T13
12
T22
T14
14
16
18
18
Hole12 units
Hole22 units
0 2 6 10
12
14
16
18
Aperiodic tasks
1 2A1
1 u
nit
A2
Periodic tasks
CPU
Aperiodic tasks
RMS
FIFOHigh priority Queue
Low priority Queue
CprE 458/558: Real-Time Systems (G. Manimaran) 6
Combined Scheduling
• Creating a periodic server Ts=(Cs, Ps) for processing aperiodic workload. Create one or more server tasks.
• Aperiodic tasks are scheduled in the periodic server’s time slots. This policy could be based on deadline, arrival time, or computation time.
• Algorithms – all algorithms behave the same manner when there are enough aperiodic tasks to execute
- Polling Server (bandwidth non-preserving)
- Deferrable Server (bandwidth preserving)- Priority Exchange Server (bandwidth preserving)- Sporadic Server (bandwidth preserving)
CprE 458/558: Real-Time Systems (G. Manimaran) 7
Polling Server
• A periodic server is created.
• If there are no aperiodic tasks at an invocation of the server (as per RMS), the server suspends itself during its current period and gets invoked again at its next period.
• If there are enough aperiodic tasks in an invocation, it serves up to Cs capacity.
• The computation time allowance for the server is replenished at the start of its period
• Include Ts in the task set and do schedulability test • Poor response time for aperiodic tasks
CprE 458/558: Real-Time Systems (G. Manimaran) 8
Polling server: Example
Task set: Ti = (ci, pi)
T1 = (1,4) , T2 = (2,6) and Ts = (2,5)
T1
T2
0 2 5 8 10
2 1A1 A2
0 4 8 12 16 20
2
13
A3 A3
15 16 17 18
24
24
24
1 3 6 7 10 12 13 15 18 20Aperiodic
tasks
Ts should be scheduled here as per RMS.
However, as there is no aperiodic task to
schedule, Ts suspends itself and is again
available only at time = 5
This aperiodic task cannot be scheduled now as there is no server available till
time = 5
Server becomes
available and schedules
aperiodic task A1 for 2 units
Waits till time =
10
Server becomes available and can
schedule for 2 units. However,
aperiodic task A2 needs only 1
Waits till time =
15
Preempted by T1
Task set: Ti = (ci, pi)
T1 = (1,4) , T2 = (2,6) and Ts = (2,5)
CprE 458/558: Real-Time Systems (G. Manimaran) 9
Polling server: Example (no animations)
Task set: Ti = (ci, pi)
T1 = (1,4) , T2 = (2,6) and Ts = (2,5)
T1
T2
0 2 5 8 10
2 1A1 A2
0 4 8 12 16 20
2
13
A3 A3
15 16 17 18
24
24
24
1 3 6 7 10 12 13 15 18 20Aperiodic
tasks
CprE 458/558: Real-Time Systems (G. Manimaran) 10
Polling server: Schedulability Analysis
• Schedulability analysis involves– Schedulability of periodic tasks– Schedulability of Aperiodic tasks
• Schedulability of periodic tasks can be evaluated by introducing a periodic task equivalent to the server. Therefore, the schedulability test is:
∑i=1 to n (Ci / Pi) + (Cs / Ps) ≤ (n+1)[2 1/(n+1) -1]
CprE 458/558: Real-Time Systems (G. Manimaran) 11
Polling server: Schedulability Analysis
• Aperiodic task guarantees:– Consider a single aperiodic task Ai, arrived
at ra, with computation time Ca and deadline Da. Since an aperiodic task can wait at most for one period before receiving service, if Ca ≤ Cs the request is certainly completed within two server periods. Thus it is guaranteed if 2Ps ≤ Da
Cs
0 Ps Psrada
Ca
Da > Ps
CprE 458/558: Real-Time Systems (G. Manimaran) 12
Polling server: Schedulability Analysis
• Aperiodic task guarantees:– For arbitrary computation times, the
aperiodic task is certainly completed in ceil(Ca/Cs) server periods; hence it is guaranteed if• Ps + ceil(Ca/Cs) * Ps ≤ Da
CprE 458/558: Real-Time Systems (G. Manimaran) 13
Deferrable Server
• A periodic server task is created.
• When the server is invoked with no outstanding aperiodic tasks, the server does not execute but defers its assigned time slot.
• When an aperiodic task arrives, the server is invoked (as per RMS) to execute aperiodic tasks and maintains its priority.
CprE 458/558: Real-Time Systems (G. Manimaran) 14
Deferrable Server (Contd.)
• The computation time allowance for the server is replenished at the start of its period.
• Provides better response time for aperiodic tasks than Polling server
• Under overload, deadlines are missed predictably.
• Similar schedulability test like polling server
CprE 458/558: Real-Time Systems (G. Manimaran) 15
Deferrable Server: Example
Task set: Ti = (ci, pi)
T1 = (1,4) , T2 = (2,6) and Ts = (2,5)
T1
T2
0 2 4 8 9
2 1A1 A2
0 4 8 12 16 20 24
24
24
1 3 6 8 10 12 13 15 18 20Aperiodic
tasks
Don’t need to wait till time = 5
Don’t need to wait till time = 10
Server defers its capacity to
handle any future
aperiodic task
Why is A2 not
scheduled at time = 8 itself???
T1 runs from 8 to 9 and hence Ts a
lower priority task cannot run
till 9
CprE 458/558: Real-Time Systems (G. Manimaran) 16
Priority Exchange Server
• A periodic server task is created.
• When the server invoked, the server runs if there are any outstanding aperiodic tasks.
• If no aperiodic task exists, the high priority server exchanges its priority with a lower priority periodic task for a duration of Cs’, where Cs’ is the remaining computation time of the server.
CprE 458/558: Real-Time Systems (G. Manimaran) 17
Priority Exchange Server (Contd.)
• In this way, the priority of the server decreases, but its computation time is maintained.
• The computation time allowance for the server is replenished at the start of its period.
• As a consequence, the aperiodic tasks get low preference for execution. Offers worse response time compared to Deferrable Server.
• Better schedulability bound for periodic task set compared to Deferrable Server.
CprE 458/558: Real-Time Systems (G. Manimaran) 18
Priority Exchange server: example
TH
TS
TL
Cs
Tf
Aperiodic task exists to utilize the server
capacity
TH
TS
TL
e
Cs - eTf
Cs - e
No more Aperiodic tasks to utilize the server
capacity
TL executing at the server’s priority
TL executing at its own priority
Server executing at TL’s priority when there are aperiodic tasks to serve
CprE 458/558: Real-Time Systems (G. Manimaran) 19
Sporadic Server
• This algorithm allows to enhance the average response time for aperiodic tasks without degrading the utilization bound for periodic task set
• This is achieved by varying the points at which the computation time of the server is replenished, rather than merely at the start of each server period.
• In other words, any spare capacity (i.e., not being used by periodic tasks) is available for an aperiodic task on its arrival.
CprE 458/558: Real-Time Systems (G. Manimaran) 20
Sporadic server: example
Task set: Ti = (ci, pi)
T1 = (3,10) , T2 = (4,15) and Ts = (2,8)
T1
T2
0 2 4 7 10
2 1A2
0 4 10 12 16 20
12
24
24
24
5 9 15 18 20Aperiodic
tasks
2 15
A1
Server has the highest
priority
Since no aperiodic
task is there, the
server defers its capacity
Server schedules the aperiodic task
right away with its capacity
And, replenishes its
capacity at time =
current_time + period
Server has no capacity to
handle
Server has capacity to schedule A2
CprE 458/558: Real-Time Systems (G. Manimaran) 21
Priority-driven preemptive scheduling- summary
• Scheduling algorithms– RMS & EDF utilization test– RMS & DMS Exact analysis
• Combined Scheduling– Polling, Deferrable, PE, Sporadic servers
• Resource Access Control– Priority Inversion– Priority Inheritance & Pri. Ceiling Protocols– Schedulability tests accounting Blocking
Recommended