Professional Documents
Culture Documents
Week14part1 RTScheduling2020
Week14part1 RTScheduling2020
2
Introduction
Scheduling & Revision
3
Scheduling
v General definition of scheduling – is the allocation of
resources over time to perform a collection of tasks
(Baker, 1974).
v Examples
Resources Tasks
machine in a factory, operations in the factory,
4
Scheduling
Concept (Cooling)
v Basic scheduling Policies (page 202-206)
1. Cyclic scheduling
2. Time slicing
3. Task priorities
4. Using queues
v Scheduling Implementation
1. The task control block
2. The tick
3. System responsiveness
4. By-pass the scheduler
5. Code sharing and re-entrancy
5
Scheduling
Concept (Cyclic)
Part-time Driver Time
v Cyclic scheduling (every 4 Drivers’ (Min)
hours) Problem Da 60
v FiFo
Db 30
De Dc 20
Dd
Dd 30
De 40
Dc
Db
idle
Da
20 40 60 80 100 120 140 160 180 200 220 240 260 280 300 320
90 110
Cycle 1 - 4 hours
6
Cycle 2 - 4 hours
Scheduling
Concept (Time slicing) Driver Time (Min)
v Time slicing (20 min) Da 60
v Cyclic scheduling (FiFo - every 4 hours) Db 30
Dc 20
idle Dd 30
De De 40
idle
Dd
Dc
Db
idle
Da
20 40 60 80 100 120 140 160 180 200 220 240 260 280 300 320
130 150
Dc
Db
idle
Da
20 40 60 80 100 120 140 160 180 200 220 240 260 280 300 320
130 150
De
Dd
Db
`
Dc
20 40 60 80 100 120 140 160 180 200 220 240 260 280 300 320
c
b d e c b a d c b e Task
b
d
d
e
e
a
a a a e b
e
e
a
a
Queues
e
a
a a
9
PART 1
Real-time Scheduling
10
Scheduling
ERT scheduling systems
v ERT need to run several tasks on a limited set of
processing unit, scheduling these tasks on processors is
to ensure the real-time constraints are met.
11
RT Scheduling
Theory
v Scheduling theory assumes that RTS consists of:
1. A set of computational tasks to be performed.
2. A run-time scheduler which controls task execution at
any given moment.
3. A set of shared resources shared by the task.
v Types of tasks:
1. Periodic tasks – consist of an infinite sequence of
identical invocations which arrive at fixed intervals.
2. Aperiodic tasks – consists of a sequence of invocations
which arrive randomly.
3. Speriodic tasks – are special case of aperiodic ones in
which there is a known worst-case arrival rate for the
task.
v Individual task invocation category:
1. Non-preemptive task invocation execute to completion
without interruption once started.
2. Preemptive task invocations can be temporarily
preempted during their execution by the arrival of a
higher-priority invocation.
12
RT Scheduling
Typical periodic task
arrival time start time finishing time deadline next arrival time
T - period
D - deadline
R – response time
executing
13
Analysis & Scheduling Policies
Classification of RT scheduling Policies
Real-Time Scheduling
14
RT Scheduling
Pre-run-time Scheduling
Task C (ms) Occurrence in
20 ms (times)
a 1 4
b 7 1
c 3 2
task
time
5 10 15 20
15
RT Scheduling
Fixed-priority Scheduling
v Each task has a fixed, static priority.
h 4 9 10 high
m 7 5 12 medium
l 6 1 19 low
task
time
5 10 15 20
17
RT Scheduling
Fixed-priority Scheduling (Preemptive)
Task C (ms) arrival time D (ms) priority
h 4 9 10 high
m 7 5 12 medium
l 6 1 19 low
task
time
5 10 15 20
18
RT Scheduling
Dynamic-priority Scheduling
v Each task has a dynamic priority.
19
RT Scheduling
Preemptive Dynamic-priority Scheduling
Task C (ms) arrival time D (ms)
h 4 9 10
m 7 5 12
l 6 1 19
task
h
Identify a small
m mistake in the
colored situation.
l
time
5 10 15 20
20
RT Scheduling
Comparison of the scheduling algorithm
Pre-run-time Non-preemptive Preemptive fixed- Preemptive
fixed-priority priority dynamic-
priority
Adv + entirely deterministic + simple programming + faster service to higher- + guarantee
+ not require RTOS paradigm priority task tasks will meet
+ tasks are evenly spaced in + allow individual task + RTOS available, simpler their D
time to be programmed and easier to maintain
separately + programmer free to
+ Can be formally choose task priorities, T &
analyzed for D
schedulability + Schedulability test
+ stable
Dis- - rigid & difficult to construct - Unresponsive - complex RTOS required - higher run-
support periodic task only Overrunning low- High degree of jitter time overhead
adv - - -
- inefficiency, some cycle were priority task can - Unstable
left idle delay higher-priority under
- Rewrite all code just to fit a one transient
overload
task in the schedule
- makes program difficult to
design
Unstable when a task overrun
-
21
Thank You.
22