![Page 1: Part 1.ppt [Compatibiliteitsmodus]johanl/educ/OSRTWS/Scheduling.pdf · 'hvljq ri 5hdo 7lph 6riwzduh 3duw 5hdo wlph 6fkhgxolqj 2 6 ydq 5rrvpdohq 9huvlrq -xo\ 2qqr ydq 5rrvpdohq 2 6](https://reader036.vdocuments.us/reader036/viewer/2022071404/60f82c70d127f5296d453b3f/html5/thumbnails/1.jpg)
Design of Real-Time Software Part 1: Real-time Scheduling
© O.S. van Roosmalen, 2016
Part 1: Real-time Scheduling
Version July 2016
Onno van [email protected]
![Page 2: Part 1.ppt [Compatibiliteitsmodus]johanl/educ/OSRTWS/Scheduling.pdf · 'hvljq ri 5hdo 7lph 6riwzduh 3duw 5hdo wlph 6fkhgxolqj 2 6 ydq 5rrvpdohq 9huvlrq -xo\ 2qqr ydq 5rrvpdohq 2 6](https://reader036.vdocuments.us/reader036/viewer/2022071404/60f82c70d127f5296d453b3f/html5/thumbnails/2.jpg)
Content
• Introduction• Static priority scheduling
– RM scheduling without resource contention• Periodic tasks• Sporadic tasks• Aperiodic tasks
1
• Aperiodic tasks
– RM scheduling with resource contention – DM scheduling
![Page 3: Part 1.ppt [Compatibiliteitsmodus]johanl/educ/OSRTWS/Scheduling.pdf · 'hvljq ri 5hdo 7lph 6riwzduh 3duw 5hdo wlph 6fkhgxolqj 2 6 ydq 5rrvpdohq 9huvlrq -xo\ 2qqr ydq 5rrvpdohq 2 6](https://reader036.vdocuments.us/reader036/viewer/2022071404/60f82c70d127f5296d453b3f/html5/thumbnails/3.jpg)
Content
• Introduction
2
![Page 4: Part 1.ppt [Compatibiliteitsmodus]johanl/educ/OSRTWS/Scheduling.pdf · 'hvljq ri 5hdo 7lph 6riwzduh 3duw 5hdo wlph 6fkhgxolqj 2 6 ydq 5rrvpdohq 9huvlrq -xo\ 2qqr ydq 5rrvpdohq 2 6](https://reader036.vdocuments.us/reader036/viewer/2022071404/60f82c70d127f5296d453b3f/html5/thumbnails/4.jpg)
Recording external events
• The controlling software samples the external state with a certain frequency (time-driven) – typically: continuous external variables
• temperature, humidity• water level• pressure
3
• pressure
• The controlling software is informed about the external events (event-driven)– typically: changes in discrete environmental variables
• a packet passes a sensor• a hazardous condition occurs• a frame must be placed on the screen
• The choice between these two approaches is made during design of the controlling system (SW and HW)
![Page 5: Part 1.ppt [Compatibiliteitsmodus]johanl/educ/OSRTWS/Scheduling.pdf · 'hvljq ri 5hdo 7lph 6riwzduh 3duw 5hdo wlph 6fkhgxolqj 2 6 ydq 5rrvpdohq 9huvlrq -xo\ 2qqr ydq 5rrvpdohq 2 6](https://reader036.vdocuments.us/reader036/viewer/2022071404/60f82c70d127f5296d453b3f/html5/thumbnails/5.jpg)
Tasks
• Task definition (again): a sequence of actions that must be carried out to generate a response to an external event or a time event
• Task types (note: all cyclic):– Periodic (time driven; released with period exactly T )
4
– Periodic (time driven; released with period exactly T )– Sparse (event driven; released with distance larger than a certain T )– Aperiodic (event driven; released arbitrarily)
• A task has – a name/index (the j th task) j
– a (worst case) execution time (WCET) Cj
– a period (periodic and sporadic tasks) Tj
– a deadline within the period Dj
Tj
Dj
Tj
Cj
j
Dj
![Page 6: Part 1.ppt [Compatibiliteitsmodus]johanl/educ/OSRTWS/Scheduling.pdf · 'hvljq ri 5hdo 7lph 6riwzduh 3duw 5hdo wlph 6fkhgxolqj 2 6 ydq 5rrvpdohq 9huvlrq -xo\ 2qqr ydq 5rrvpdohq 2 6](https://reader036.vdocuments.us/reader036/viewer/2022071404/60f82c70d127f5296d453b3f/html5/thumbnails/6.jpg)
Types of tasks
• Software is most often a mix of time-driven and event driven tasks – depends on the choices on measuring environmental state– depends on the choice of HW implementation of sensors
• Both time-driven and event-driven tasks:– Tasks are cyclic
5
– Tasks are cyclic• events recur
– Cycles are started by• a clock (time driven)• an external event occurrence (event driven)
– Each execution of the action-sequence is an instance of a task
instance
Task
instance
![Page 7: Part 1.ppt [Compatibiliteitsmodus]johanl/educ/OSRTWS/Scheduling.pdf · 'hvljq ri 5hdo 7lph 6riwzduh 3duw 5hdo wlph 6fkhgxolqj 2 6 ydq 5rrvpdohq 9huvlrq -xo\ 2qqr ydq 5rrvpdohq 2 6](https://reader036.vdocuments.us/reader036/viewer/2022071404/60f82c70d127f5296d453b3f/html5/thumbnails/7.jpg)
Value after deadline
• Soft– A response is still valuable after the deadline, but value decreases
steadily after that.• Example: interaction with human users. People get impatient.
• Firm– A response has no value after the deadline.
• Example: a video frame that cannot be shown in time can be skipped.
6
• Example: a video frame that cannot be shown in time can be skipped.
• Hard– Damage is done if a response does not come in time.
value
Time
Soft Firm Hard
deadline
![Page 8: Part 1.ppt [Compatibiliteitsmodus]johanl/educ/OSRTWS/Scheduling.pdf · 'hvljq ri 5hdo 7lph 6riwzduh 3duw 5hdo wlph 6fkhgxolqj 2 6 ydq 5rrvpdohq 9huvlrq -xo\ 2qqr ydq 5rrvpdohq 2 6](https://reader036.vdocuments.us/reader036/viewer/2022071404/60f82c70d127f5296d453b3f/html5/thumbnails/8.jpg)
Examples
• Dependable real-time systems– High cost of failure
• Possibly loss of life on failure
– Guaranteed dependability (especially timeliness)– Example: Industrial control
7
• High performance real-time systems– Low probability of failure
• Constant quality of service
– High regularity in performance – Example: Consumer electronics
![Page 9: Part 1.ppt [Compatibiliteitsmodus]johanl/educ/OSRTWS/Scheduling.pdf · 'hvljq ri 5hdo 7lph 6riwzduh 3duw 5hdo wlph 6fkhgxolqj 2 6 ydq 5rrvpdohq 9huvlrq -xo\ 2qqr ydq 5rrvpdohq 2 6](https://reader036.vdocuments.us/reader036/viewer/2022071404/60f82c70d127f5296d453b3f/html5/thumbnails/9.jpg)
Example: water vessel
• Requirements:– Vessel may not overflow– Pump may not run dry
• Properties – Water level has a maximum rate of change (up and down)– Sensor positions are chosen
8
• Derived SW requirements– Response deadline can be calculated
• The state “pump is off and the water is high”may not persist longer than a time span td1
– only then risk of overflow
• The state “pump is on and the water is low”may not persist longer than a time span td2
– only then risk of underflow
pump
water high point
water low point h2
h1
![Page 10: Part 1.ppt [Compatibiliteitsmodus]johanl/educ/OSRTWS/Scheduling.pdf · 'hvljq ri 5hdo 7lph 6riwzduh 3duw 5hdo wlph 6fkhgxolqj 2 6 ydq 5rrvpdohq 9huvlrq -xo\ 2qqr ydq 5rrvpdohq 2 6](https://reader036.vdocuments.us/reader036/viewer/2022071404/60f82c70d127f5296d453b3f/html5/thumbnails/10.jpg)
Example: water vessel
• Requirements:– Vessel may not overflow– Pump may not run dry
• Properties – Water level has a maximum rate of change (up and down)– Sensor positions are chosen
9
• Derived SW requirements– Response deadline can be calculated
• The state “pump is off and the water is high”may not persist longer than a time span td1
– only then risk of overflow
• The state “pump is on and the water is low”may not persist longer than a time span td2
– only then risk of underflow
pump
water high point
water low point h2
h1
![Page 11: Part 1.ppt [Compatibiliteitsmodus]johanl/educ/OSRTWS/Scheduling.pdf · 'hvljq ri 5hdo 7lph 6riwzduh 3duw 5hdo wlph 6fkhgxolqj 2 6 ydq 5rrvpdohq 9huvlrq -xo\ 2qqr ydq 5rrvpdohq 2 6](https://reader036.vdocuments.us/reader036/viewer/2022071404/60f82c70d127f5296d453b3f/html5/thumbnails/11.jpg)
Requirements on tasks
• Detection criterion: situations must be detected in which– the water is above (gets above) the high point– the water is below (gets below) the low point
• Response criterion: after detection the system must respond before
10
– the water is above the high point for a time td1 or longer– the water is below the low point for a time td2 or longer
• These requirements can be met by a polling task (!)– Requirements like: “the system must respond when the water
reaches the high point” can not be met by a polling task• Why?
![Page 12: Part 1.ppt [Compatibiliteitsmodus]johanl/educ/OSRTWS/Scheduling.pdf · 'hvljq ri 5hdo 7lph 6riwzduh 3duw 5hdo wlph 6fkhgxolqj 2 6 ydq 5rrvpdohq 9huvlrq -xo\ 2qqr ydq 5rrvpdohq 2 6](https://reader036.vdocuments.us/reader036/viewer/2022071404/60f82c70d127f5296d453b3f/html5/thumbnails/12.jpg)
Polling task
– Critical state c should not exist longer than a time span td without response that cancels this critical state
• critical state c: water above/below sensor and pump off/on
– Periodic task is released with period T and satisfies deadline D within this period.
• If water at low sensor: Task stops pump• If water at high sensor: Task starts pump
11
• If water at high sensor: Task starts pump
– Schedulability conditions (see diagram): T + D < td• If the task may finish anywhere within the period (D = T ) : 2.T < td
TD
td
c ct
Release of periodic task TD
![Page 13: Part 1.ppt [Compatibiliteitsmodus]johanl/educ/OSRTWS/Scheduling.pdf · 'hvljq ri 5hdo 7lph 6riwzduh 3duw 5hdo wlph 6fkhgxolqj 2 6 ydq 5rrvpdohq 9huvlrq -xo\ 2qqr ydq 5rrvpdohq 2 6](https://reader036.vdocuments.us/reader036/viewer/2022071404/60f82c70d127f5296d453b3f/html5/thumbnails/13.jpg)
Predictable computation time
• Make sure that the task can finish within D ( T )– Worst case execution times C (WCET) should be calculable (C D )– The load on the processor resource is not more than C per period T
• The predictability of this is endangered by – anomalies of the hardware and system software
• use of DMA that locks the bus• cache behaviour
12
• cache behaviour• interrupts• memory management
– constraints• finding required resources locked by other tasks • precedence constraints
– absence of transparency in high level languages• dynamic variables, garbage collection (memory management)• repetition, recursion
![Page 14: Part 1.ppt [Compatibiliteitsmodus]johanl/educ/OSRTWS/Scheduling.pdf · 'hvljq ri 5hdo 7lph 6riwzduh 3duw 5hdo wlph 6fkhgxolqj 2 6 ydq 5rrvpdohq 9huvlrq -xo\ 2qqr ydq 5rrvpdohq 2 6](https://reader036.vdocuments.us/reader036/viewer/2022071404/60f82c70d127f5296d453b3f/html5/thumbnails/14.jpg)
Example: Video device
• Device characteristics– audio/video: perception is main concern– high volume turnover: cost constraints
• Real-time– high quality audio and video pose stringent real-time requirements– regularity is more important than latency
13
• Quality of service– “collective effect of service performances that determine the degree
of satisfaction of the user of that service
Average case ( concerns are Quality+Cost) resource allocation is more important than Worst case ( concerns are Latency + Predictability)
![Page 15: Part 1.ppt [Compatibiliteitsmodus]johanl/educ/OSRTWS/Scheduling.pdf · 'hvljq ri 5hdo 7lph 6riwzduh 3duw 5hdo wlph 6fkhgxolqj 2 6 ydq 5rrvpdohq 9huvlrq -xo\ 2qqr ydq 5rrvpdohq 2 6](https://reader036.vdocuments.us/reader036/viewer/2022071404/60f82c70d127f5296d453b3f/html5/thumbnails/15.jpg)
Average case: why?
• Average case and worst case are far apart – worst case leads to over-dimensioning of resources
• High volumes: low bill of material is desired• Also low power conflicts with over-dimensioning
14
![Page 16: Part 1.ppt [Compatibiliteitsmodus]johanl/educ/OSRTWS/Scheduling.pdf · 'hvljq ri 5hdo 7lph 6riwzduh 3duw 5hdo wlph 6fkhgxolqj 2 6 ydq 5rrvpdohq 9huvlrq -xo\ 2qqr ydq 5rrvpdohq 2 6](https://reader036.vdocuments.us/reader036/viewer/2022071404/60f82c70d127f5296d453b3f/html5/thumbnails/16.jpg)
Average case: how?
• Lesser picture quality often better than temporal incorrectness– deadline misses may lead to wrong picture– deadline misses tend to come in bursts
• Reducing quality of manipulating the video stream may reduce load in high load/overload situations
15
may reduce load in high load/overload situations – Quality fluctuations are perceived as non-quality– Regularly recurring errors are very visible and annoying
• Only video specialists can make trade-off
![Page 17: Part 1.ppt [Compatibiliteitsmodus]johanl/educ/OSRTWS/Scheduling.pdf · 'hvljq ri 5hdo 7lph 6riwzduh 3duw 5hdo wlph 6fkhgxolqj 2 6 ydq 5rrvpdohq 9huvlrq -xo\ 2qqr ydq 5rrvpdohq 2 6](https://reader036.vdocuments.us/reader036/viewer/2022071404/60f82c70d127f5296d453b3f/html5/thumbnails/17.jpg)
Quality of Service
16
![Page 18: Part 1.ppt [Compatibiliteitsmodus]johanl/educ/OSRTWS/Scheduling.pdf · 'hvljq ri 5hdo 7lph 6riwzduh 3duw 5hdo wlph 6fkhgxolqj 2 6 ydq 5rrvpdohq 9huvlrq -xo\ 2qqr ydq 5rrvpdohq 2 6](https://reader036.vdocuments.us/reader036/viewer/2022071404/60f82c70d127f5296d453b3f/html5/thumbnails/18.jpg)
Example of processing pipeline
• Various periodic tasks in a pipeline• Some tasks can perform processing at various
quality levels (green arrows)• Buffers help to balance the load over time• Periods can be different (compare audio with video
17
• Periods can be different (compare audio with video decoding)
![Page 19: Part 1.ppt [Compatibiliteitsmodus]johanl/educ/OSRTWS/Scheduling.pdf · 'hvljq ri 5hdo 7lph 6riwzduh 3duw 5hdo wlph 6fkhgxolqj 2 6 ydq 5rrvpdohq 9huvlrq -xo\ 2qqr ydq 5rrvpdohq 2 6](https://reader036.vdocuments.us/reader036/viewer/2022071404/60f82c70d127f5296d453b3f/html5/thumbnails/19.jpg)
18
![Page 20: Part 1.ppt [Compatibiliteitsmodus]johanl/educ/OSRTWS/Scheduling.pdf · 'hvljq ri 5hdo 7lph 6riwzduh 3duw 5hdo wlph 6fkhgxolqj 2 6 ydq 5rrvpdohq 9huvlrq -xo\ 2qqr ydq 5rrvpdohq 2 6](https://reader036.vdocuments.us/reader036/viewer/2022071404/60f82c70d127f5296d453b3f/html5/thumbnails/20.jpg)
Processing pipeline
PAlgorithm= while true doreceive(i, frame); process(frame);send(o, frame);
od
19
stream inputinterrupt
frameinterrupt
Data in Algorithm Data out
![Page 21: Part 1.ppt [Compatibiliteitsmodus]johanl/educ/OSRTWS/Scheduling.pdf · 'hvljq ri 5hdo 7lph 6riwzduh 3duw 5hdo wlph 6fkhgxolqj 2 6 ydq 5rrvpdohq 9huvlrq -xo\ 2qqr ydq 5rrvpdohq 2 6](https://reader036.vdocuments.us/reader036/viewer/2022071404/60f82c70d127f5296d453b3f/html5/thumbnails/21.jpg)
Acceptable WCET’sPAlgorithm= while true do
receive(i, frame); process(frame);send(o, frame);
od
• Average execution time to process frame • Period T is given by frame rate • Assume Gaussian probability distribution of execution times: 2
2)(1
Ct
C
20
• Assume Gaussian probability distribution of execution times:• Probability of exceeding : Favors large
time
Probability density
22
2
1)(
etP
)(Q
CC )(Q
C C
![Page 22: Part 1.ppt [Compatibiliteitsmodus]johanl/educ/OSRTWS/Scheduling.pdf · 'hvljq ri 5hdo 7lph 6riwzduh 3duw 5hdo wlph 6fkhgxolqj 2 6 ydq 5rrvpdohq 9huvlrq -xo\ 2qqr ydq 5rrvpdohq 2 6](https://reader036.vdocuments.us/reader036/viewer/2022071404/60f82c70d127f5296d453b3f/html5/thumbnails/22.jpg)
BufferingFailures:• Input buffer overflow• Output buffer underflow
m m
PAlgorithm= while true do do m times
receive(i, frame);process(frame);send(o, frame);
odod
21
stream inputinterrupt
frameinterrupt
Data in Algorithm Data out
• Buffer size ~ 2m• Period : mT• Latency : ~ 2mT
input m frames; (process m frames // input m frames);
![Page 23: Part 1.ppt [Compatibiliteitsmodus]johanl/educ/OSRTWS/Scheduling.pdf · 'hvljq ri 5hdo 7lph 6riwzduh 3duw 5hdo wlph 6fkhgxolqj 2 6 ydq 5rrvpdohq 9huvlrq -xo\ 2qqr ydq 5rrvpdohq 2 6](https://reader036.vdocuments.us/reader036/viewer/2022071404/60f82c70d127f5296d453b3f/html5/thumbnails/23.jpg)
Buffer size
• Period of task instance is now m times the original period: mT• Worst case fluctuations in actual start time of periodic process: ~ mT• This requires both filled and empty buffer space of about m • Total buffer size should be about 2m
22
mT 2mT0 3mT
m
2m
![Page 24: Part 1.ppt [Compatibiliteitsmodus]johanl/educ/OSRTWS/Scheduling.pdf · 'hvljq ri 5hdo 7lph 6riwzduh 3duw 5hdo wlph 6fkhgxolqj 2 6 ydq 5rrvpdohq 9huvlrq -xo\ 2qqr ydq 5rrvpdohq 2 6](https://reader036.vdocuments.us/reader036/viewer/2022071404/60f82c70d127f5296d453b3f/html5/thumbnails/24.jpg)
Processing m frames per task instance
PAlgorithm= while true do do m times
receive(i, frame);process(frame);send(o, frame);
odod
m
23
time
Probability density
mm QQ )()(
m
• Probability of exceeding execution time :• With buffer 1 m : failure probability e.g. 0.1 0.1m
)( Cmm
m QQ )()(
Cm mCm
![Page 25: Part 1.ppt [Compatibiliteitsmodus]johanl/educ/OSRTWS/Scheduling.pdf · 'hvljq ri 5hdo 7lph 6riwzduh 3duw 5hdo wlph 6fkhgxolqj 2 6 ydq 5rrvpdohq 9huvlrq -xo\ 2qqr ydq 5rrvpdohq 2 6](https://reader036.vdocuments.us/reader036/viewer/2022071404/60f82c70d127f5296d453b3f/html5/thumbnails/25.jpg)
Correct Assumptions?
• Not statistical– Increased execution times come in bursts – Therefore: execution times are not Gaussian distributed
• Other measures – Different functions (e.g. audio decoding and sharpness enhancing) may be
independent
24
independent • Instead of m cycles of a single process combine m cycles of different processes
• We have seen qualitative arguments to illustrate the issues
![Page 26: Part 1.ppt [Compatibiliteitsmodus]johanl/educ/OSRTWS/Scheduling.pdf · 'hvljq ri 5hdo 7lph 6riwzduh 3duw 5hdo wlph 6fkhgxolqj 2 6 ydq 5rrvpdohq 9huvlrq -xo\ 2qqr ydq 5rrvpdohq 2 6](https://reader036.vdocuments.us/reader036/viewer/2022071404/60f82c70d127f5296d453b3f/html5/thumbnails/26.jpg)
Guaranteeing Deadlines
• General approach:– Make hypothesis on behavior of environment.
• E.g. water vessel:– The influx of water into the vessel will be less then x liter/second
• E.g. video processing:– The frame processing time will be less than x milliseconds per frame
– The correctness of the hypothesis may have a calculable probability
25
• E.g. water vessel:– The influx on average may exceeds this value once in every 100 years.
• E.g. video processing:– The probability distribution for frame processing times is f(t)
– Within the hypothesis meeting deadlines is guaranteed– Failures that fall outside the hypothesis have a certain probability
• E.g. water vessel:– The possibility of overflow is limited to once in every 100 years.
• E.g. video processing:– The probability for missing a frame is 1 in 109
![Page 27: Part 1.ppt [Compatibiliteitsmodus]johanl/educ/OSRTWS/Scheduling.pdf · 'hvljq ri 5hdo 7lph 6riwzduh 3duw 5hdo wlph 6fkhgxolqj 2 6 ydq 5rrvpdohq 9huvlrq -xo\ 2qqr ydq 5rrvpdohq 2 6](https://reader036.vdocuments.us/reader036/viewer/2022071404/60f82c70d127f5296d453b3f/html5/thumbnails/27.jpg)
Scheduling theory
• Focus is on how we guarantee meeting deadlines
• Many conclusions are qualitative as well– What scheduling approach is optimal– Optimality depends on the boundary conditions
26
– One can be optimal according to many criteria
![Page 28: Part 1.ppt [Compatibiliteitsmodus]johanl/educ/OSRTWS/Scheduling.pdf · 'hvljq ri 5hdo 7lph 6riwzduh 3duw 5hdo wlph 6fkhgxolqj 2 6 ydq 5rrvpdohq 9huvlrq -xo\ 2qqr ydq 5rrvpdohq 2 6](https://reader036.vdocuments.us/reader036/viewer/2022071404/60f82c70d127f5296d453b3f/html5/thumbnails/28.jpg)
Content
• Introduction• Static priority scheduling
– Rate Monotonic (RM) scheduling without resource contention
• Periodic tasks
27
• Periodic tasks
![Page 29: Part 1.ppt [Compatibiliteitsmodus]johanl/educ/OSRTWS/Scheduling.pdf · 'hvljq ri 5hdo 7lph 6riwzduh 3duw 5hdo wlph 6fkhgxolqj 2 6 ydq 5rrvpdohq 9huvlrq -xo\ 2qqr ydq 5rrvpdohq 2 6](https://reader036.vdocuments.us/reader036/viewer/2022071404/60f82c70d127f5296d453b3f/html5/thumbnails/29.jpg)
Rate-Monotonic Scheduling
• Rate monotonic=task priority proportional to rate (frequency) • Basic assumptions:
– One processor– Tasks are independent and periodically released (polling tasks)– Tasks have fixed individual priorities (j has priority pj )– Preemption allowed
• High priority tasks may preempt low priority tasks.
28
• High priority tasks may preempt low priority tasks.
– Tasks have fixed (maximal) execution duration (WCET=Cj)
• For the moment– The processor is the only shared resource– Deadlines within periods are equal to periods (Dj = Tj)
• Terminology:– “There is a correct schedule” or “There is a feasible schedule” means
“There is a schedule that satisfies all timing constraints”
![Page 30: Part 1.ppt [Compatibiliteitsmodus]johanl/educ/OSRTWS/Scheduling.pdf · 'hvljq ri 5hdo 7lph 6riwzduh 3duw 5hdo wlph 6fkhgxolqj 2 6 ydq 5rrvpdohq 9huvlrq -xo\ 2qqr ydq 5rrvpdohq 2 6](https://reader036.vdocuments.us/reader036/viewer/2022071404/60f82c70d127f5296d453b3f/html5/thumbnails/30.jpg)
Critical Instant
•• Critical instantCritical instant of a task (fixed priority scheduling only!!) :– Definition: the situation that gives the largest response time
• Lemma:–– The worst case response time of a task occurs when it is released at The worst case response time of a task occurs when it is released at
the same time with all higher priority tasksthe same time with all higher priority tasks
• Example: shift blue task until critical instant is reached
29
t’ -T2 t’ +T2 t’ + 2.T2t’
t -T2 t +T2 t + 2.T2t T1
T1
T1
0
0
0
-T2 T2 2.T2
r
r
r
![Page 31: Part 1.ppt [Compatibiliteitsmodus]johanl/educ/OSRTWS/Scheduling.pdf · 'hvljq ri 5hdo 7lph 6riwzduh 3duw 5hdo wlph 6fkhgxolqj 2 6 ydq 5rrvpdohq 9huvlrq -xo\ 2qqr ydq 5rrvpdohq 2 6](https://reader036.vdocuments.us/reader036/viewer/2022071404/60f82c70d127f5296d453b3f/html5/thumbnails/31.jpg)
• Consider two tasks 1= < C1 ,T1 , p1 > and 2= < C2 ,T2 , p2 >
• Assume: – T1 < T2
– C1+ C2 T1
• Possible schedules:
Example
C1 + C2C1
30
• Conclusion:– If C1+ C2 T1 any priority assignment will lead to a correct schedule
T1 2.T1
T2
C1 + C2
C1
C2
1
2
2
1
![Page 32: Part 1.ppt [Compatibiliteitsmodus]johanl/educ/OSRTWS/Scheduling.pdf · 'hvljq ri 5hdo 7lph 6riwzduh 3duw 5hdo wlph 6fkhgxolqj 2 6 ydq 5rrvpdohq 9huvlrq -xo\ 2qqr ydq 5rrvpdohq 2 6](https://reader036.vdocuments.us/reader036/viewer/2022071404/60f82c70d127f5296d453b3f/html5/thumbnails/32.jpg)
Exercise: arbitrary priority assignments
• Task set:• 1 : C1 = 2 T1 = 6• 2 : C2 = 2 T2 = 10• 3 : C3 = 4 T3 = 12
• Draw the six schedules for each of the possible
31
• Draw the six schedules for each of the possible priority assignments
• Determine the worst case response time for each task in each case and check if it is smaller than the period (=deadline) for that task.
![Page 33: Part 1.ppt [Compatibiliteitsmodus]johanl/educ/OSRTWS/Scheduling.pdf · 'hvljq ri 5hdo 7lph 6riwzduh 3duw 5hdo wlph 6fkhgxolqj 2 6 ydq 5rrvpdohq 9huvlrq -xo\ 2qqr ydq 5rrvpdohq 2 6](https://reader036.vdocuments.us/reader036/viewer/2022071404/60f82c70d127f5296d453b3f/html5/thumbnails/33.jpg)
Optimality of RM Priorities
• Rate monotonic priority assignment – highest rate has highest priority
•• If a priority assignment leads to a feasible schedule If a priority assignment leads to a feasible schedule then the RM assignment leads to a feasible then the RM assignment leads to a feasible schedule as well.schedule as well.
• Example (two tasks): C + C
32
• Example (two tasks):
T1
T2
p1 > p2
T1
T2p2 > p1
C1 + C2C2
C1C1 + C2
![Page 34: Part 1.ppt [Compatibiliteitsmodus]johanl/educ/OSRTWS/Scheduling.pdf · 'hvljq ri 5hdo 7lph 6riwzduh 3duw 5hdo wlph 6fkhgxolqj 2 6 ydq 5rrvpdohq 9huvlrq -xo\ 2qqr ydq 5rrvpdohq 2 6](https://reader036.vdocuments.us/reader036/viewer/2022071404/60f82c70d127f5296d453b3f/html5/thumbnails/34.jpg)
Schedulability Condition: 2 Tasks• Assume one period the larger of the two: T1 < T2
• We can have two possible priority assignments – non-RM: p2 > p1
– RM: p1 > p2
•• nonnon--RMRM:– At critical instant both tasks should finish in time:
33
– At critical instant both tasks should finish in time:
Schedulable iff C1 + C2 T1
T1
T2p2 > p1
C1 + C2C2
![Page 35: Part 1.ppt [Compatibiliteitsmodus]johanl/educ/OSRTWS/Scheduling.pdf · 'hvljq ri 5hdo 7lph 6riwzduh 3duw 5hdo wlph 6fkhgxolqj 2 6 ydq 5rrvpdohq 9huvlrq -xo\ 2qqr ydq 5rrvpdohq 2 6](https://reader036.vdocuments.us/reader036/viewer/2022071404/60f82c70d127f5296d453b3f/html5/thumbnails/35.jpg)
•• RM:RM:– More difficult case because 2 can be preempted by 1
– Two situations depending on where period T2 ends– RM: Case 1)
Schedulability Condition: 2 Tasks
0 T1 2.T1 3.T1
T2C1
34
– RM: Case 2) 0 T2
p1> p2
T2 /T1 T1 + C1
T2
T2
0 T1 2.T1
0
3.T1
p1> p2T2 /T1 T1 + C1
> T2
T2 /T1 T1
C1
![Page 36: Part 1.ppt [Compatibiliteitsmodus]johanl/educ/OSRTWS/Scheduling.pdf · 'hvljq ri 5hdo 7lph 6riwzduh 3duw 5hdo wlph 6fkhgxolqj 2 6 ydq 5rrvpdohq 9huvlrq -xo\ 2qqr ydq 5rrvpdohq 2 6](https://reader036.vdocuments.us/reader036/viewer/2022071404/60f82c70d127f5296d453b3f/html5/thumbnails/36.jpg)
RM: Case 1
• Assumption: C1 T2 - T2 /T1 T1
• Time occupied by 1 in period T2
is T2 /T1 C1
0 T1 2.T1 3.T1
T2 /T1 T1 + C1
T2
T2C1
35
is T2 /T1 C1
• Maximally available for 2 in period T2
is T2 - T2 /T1 C1
• Thus
Schedulable iff C2 T2 - T2 /T1 C1
![Page 37: Part 1.ppt [Compatibiliteitsmodus]johanl/educ/OSRTWS/Scheduling.pdf · 'hvljq ri 5hdo 7lph 6riwzduh 3duw 5hdo wlph 6fkhgxolqj 2 6 ydq 5rrvpdohq 9huvlrq -xo\ 2qqr ydq 5rrvpdohq 2 6](https://reader036.vdocuments.us/reader036/viewer/2022071404/60f82c70d127f5296d453b3f/html5/thumbnails/37.jpg)
RM: Case 2
• Assumption: C1 > T2 - T2 /T1 T1
• Time occupied by 1 in period T2 /T1 T1
is T2 /T1 C1
0 T2
0 T1 2.T1 3.T1
T2 /T1 T1 + C1
> T2
T2 /T1 T1
C1
36
is T2 /T1 C1
• Maximally available for 2 in period T2 /T1 T1
is T2 /T1 T1 - T2 /T1 C1
• Thus
Schedulable iff C2 T2 /T1 T1 - T2 /T1 C1
![Page 38: Part 1.ppt [Compatibiliteitsmodus]johanl/educ/OSRTWS/Scheduling.pdf · 'hvljq ri 5hdo 7lph 6riwzduh 3duw 5hdo wlph 6fkhgxolqj 2 6 ydq 5rrvpdohq 9huvlrq -xo\ 2qqr ydq 5rrvpdohq 2 6](https://reader036.vdocuments.us/reader036/viewer/2022071404/60f82c70d127f5296d453b3f/html5/thumbnails/38.jpg)
Graphically
T2
slope is -T2 /T1
slope is -T2 /T1
Not schedulable, C2 is too large for given C1RM schedulable,
value of C2
is small enough
37
C1
C2
T1
0
T2 - T2 /T1 T1
non-RM slope is -1
non-RM schedulable,value of C2
is small enough
![Page 39: Part 1.ppt [Compatibiliteitsmodus]johanl/educ/OSRTWS/Scheduling.pdf · 'hvljq ri 5hdo 7lph 6riwzduh 3duw 5hdo wlph 6fkhgxolqj 2 6 ydq 5rrvpdohq 9huvlrq -xo\ 2qqr ydq 5rrvpdohq 2 6](https://reader036.vdocuments.us/reader036/viewer/2022071404/60f82c70d127f5296d453b3f/html5/thumbnails/39.jpg)
• Consider variations around magic pointmagic point C1 = T2 - T2 /T1 T1
– Increasing C1 by can be compensated by decreasing C2 by T2 /T1
Slope Change
T2 /T1 T1 + C1
= T
0 T1 2.T1 3.T1
38
– Decreasing C1 by can be compensated by increasing C2 by T2 /T1
= T2
0 T2
0 T1 2.T1
0
3.T1
T2
![Page 40: Part 1.ppt [Compatibiliteitsmodus]johanl/educ/OSRTWS/Scheduling.pdf · 'hvljq ri 5hdo 7lph 6riwzduh 3duw 5hdo wlph 6fkhgxolqj 2 6 ydq 5rrvpdohq 9huvlrq -xo\ 2qqr ydq 5rrvpdohq 2 6](https://reader036.vdocuments.us/reader036/viewer/2022071404/60f82c70d127f5296d453b3f/html5/thumbnails/40.jpg)
Utilization Bound for Schedulability
• Consider two tasks 1=< C1 ,T1 , p1 > and 2=< C2 ,T2 , p2 >• Rate monotonic priorities: pi depends on Ti
• Ci /Ti is worst case time-fraction that i requires processor• Ci /Ti >1 can not be guaranteed (no feasible schedule)
– If Ci ,Ti are all known: a precise schedulability criterion can be derived (see later)
39
derived (see later)
– If only the utilization is known:
We can look for a Umin for which • U Umin the tasks always meet their deadlines• U >Umin the tasks can not be guaranteed to meet their deadlines
m
i i
i
T
CU
1
![Page 41: Part 1.ppt [Compatibiliteitsmodus]johanl/educ/OSRTWS/Scheduling.pdf · 'hvljq ri 5hdo 7lph 6riwzduh 3duw 5hdo wlph 6fkhgxolqj 2 6 ydq 5rrvpdohq 9huvlrq -xo\ 2qqr ydq 5rrvpdohq 2 6](https://reader036.vdocuments.us/reader036/viewer/2022071404/60f82c70d127f5296d453b3f/html5/thumbnails/41.jpg)
Determining Umin (two tasks)
• Terminology:– Tasks are fully utilizing the processor if no increase of C1 or C2 possible
• Critical instant• At critical instant: tasks fully occupy the processor until T2
• Schedulable but increasing either C1 or C2 breaks schedulability
– Note: this does not imply Ufull = 1
40
– Note: this does not imply Ufull = 1
• Approach– Consider free variables in utilization: C1 ,C2 ,T1 , T2
– Consider largest feasible value for C2 given C1 , T1 , T2
• C2 can be eliminated giving full utilization Ufull(C1 , T1 , T2 )
– Find C1 for which full utilization is minimal, this is Umin
– Then, for any C1 and C2 that yield a utilization below Umin schedule is feasible.
– Minimize Umin with respect to T1 and T2 as well.
![Page 42: Part 1.ppt [Compatibiliteitsmodus]johanl/educ/OSRTWS/Scheduling.pdf · 'hvljq ri 5hdo 7lph 6riwzduh 3duw 5hdo wlph 6fkhgxolqj 2 6 ydq 5rrvpdohq 9huvlrq -xo\ 2qqr ydq 5rrvpdohq 2 6](https://reader036.vdocuments.us/reader036/viewer/2022071404/60f82c70d127f5296d453b3f/html5/thumbnails/42.jpg)
Determining Umin
• Consider same two cases as before– Case 1: maximal C2 slopes at - T2 /T1 C1
0 T1 2.T1 3.T1
p > pT2 /T1 T1 + C1
T
T2C1
41
– Case 2: maximal C2 slopes at - T2 /T1 C1
0 T2
p1> p2 T2
T2
0 T1 2.T1
0
3.T1
p1> p2T2 /T1 T1 + C1
> T2
T2 /T1 T1
C1
![Page 43: Part 1.ppt [Compatibiliteitsmodus]johanl/educ/OSRTWS/Scheduling.pdf · 'hvljq ri 5hdo 7lph 6riwzduh 3duw 5hdo wlph 6fkhgxolqj 2 6 ydq 5rrvpdohq 9huvlrq -xo\ 2qqr ydq 5rrvpdohq 2 6](https://reader036.vdocuments.us/reader036/viewer/2022071404/60f82c70d127f5296d453b3f/html5/thumbnails/43.jpg)
Case 1
• Assumption: C1 T2 - T2 /T1 T1
• With full utilization: C2 = T2 - T2 /T1 C1
• Thus
0 T1 2.T1 3.T1
T2 /T1 T1 + C1
T2
T2C1
42
1
2
2
1
1
1
2
11
22
1
1
1
1)1( 11T
T
T
T
T
C
T
CTTT
T
C
T
CU full
constant
negativeslope
![Page 44: Part 1.ppt [Compatibiliteitsmodus]johanl/educ/OSRTWS/Scheduling.pdf · 'hvljq ri 5hdo 7lph 6riwzduh 3duw 5hdo wlph 6fkhgxolqj 2 6 ydq 5rrvpdohq 9huvlrq -xo\ 2qqr ydq 5rrvpdohq 2 6](https://reader036.vdocuments.us/reader036/viewer/2022071404/60f82c70d127f5296d453b3f/html5/thumbnails/44.jpg)
Case 2
• Assumption: C1 > T2 - T2 /T1 T1
• With full utilization: C2 = T2 /T1 T1 - T2 /T1 C1
• Thus
0 T2
0 T1 2.T1 3.T1
T2 /T1 T1 + C1
> T2
T2 /T1 T1
C1
43
1
2
2
1
1
1
1
2
2
1
2
1
211
1
1
1
1)2( 1)(
T
T
T
T
T
C
T
T
T
T
T
TTCT
T
C
T
CU full
constant smaller 1
positiveslope
![Page 45: Part 1.ppt [Compatibiliteitsmodus]johanl/educ/OSRTWS/Scheduling.pdf · 'hvljq ri 5hdo 7lph 6riwzduh 3duw 5hdo wlph 6fkhgxolqj 2 6 ydq 5rrvpdohq 9huvlrq -xo\ 2qqr ydq 5rrvpdohq 2 6](https://reader036.vdocuments.us/reader036/viewer/2022071404/60f82c70d127f5296d453b3f/html5/thumbnails/45.jpg)
Graphically
• Introduce: f = C1/T1 ( 0 f 1)
Given C1, not schedulable. C2 is too large
C1
C2
T10
T2
slope is -T2 /T1
slope is -T2 /T1
44
Umin
1f = C1/T1
0
1
U=C1/T1+C2/T2
Given U, schedulableregardless of value of C1
f0 = T2 /T1 - T2 /T1
fU full)2( fU full
)1( Given U, schedulable
depending on value of C1
![Page 46: Part 1.ppt [Compatibiliteitsmodus]johanl/educ/OSRTWS/Scheduling.pdf · 'hvljq ri 5hdo 7lph 6riwzduh 3duw 5hdo wlph 6fkhgxolqj 2 6 ydq 5rrvpdohq 9huvlrq -xo\ 2qqr ydq 5rrvpdohq 2 6](https://reader036.vdocuments.us/reader036/viewer/2022071404/60f82c70d127f5296d453b3f/html5/thumbnails/46.jpg)
Minimal Value of Full Utilization varying T2 /T1
100%
95%
1.0 2.0 3.0T2 /T1
45
95%
90%
85%
80%
Ufull min
T2 /T1 =7/5
![Page 47: Part 1.ppt [Compatibiliteitsmodus]johanl/educ/OSRTWS/Scheduling.pdf · 'hvljq ri 5hdo 7lph 6riwzduh 3duw 5hdo wlph 6fkhgxolqj 2 6 ydq 5rrvpdohq 9huvlrq -xo\ 2qqr ydq 5rrvpdohq 2 6](https://reader036.vdocuments.us/reader036/viewer/2022071404/60f82c70d127f5296d453b3f/html5/thumbnails/47.jpg)
Result
• Combine:
• With: f0 = T2 /T1 - T2 /T1
• Introduce:
1
2
2
100
)2(0
)1(min 11
T
T
T
TffUfUU fullfull
2
T
TI I1
46
• Introduce:
• Then:
• And thus:
1T
I
10 0 f
)/()1(1),(min fIffIfU
012 / fITT
I1
![Page 48: Part 1.ppt [Compatibiliteitsmodus]johanl/educ/OSRTWS/Scheduling.pdf · 'hvljq ri 5hdo 7lph 6riwzduh 3duw 5hdo wlph 6fkhgxolqj 2 6 ydq 5rrvpdohq 9huvlrq -xo\ 2qqr ydq 5rrvpdohq 2 6](https://reader036.vdocuments.us/reader036/viewer/2022071404/60f82c70d127f5296d453b3f/html5/thumbnails/48.jpg)
Further simplification
• We can even eliminate f and I– Minimal value of Umin when I = 1
– Minimize for values of 0 f 1
12)1/()1(0)(min ffff
dfdU
47
12)1/()1(01
ffffdfdf
I
829.0)12(2min U
T2 /T1 = T2 /T1 + f = 2
![Page 49: Part 1.ppt [Compatibiliteitsmodus]johanl/educ/OSRTWS/Scheduling.pdf · 'hvljq ri 5hdo 7lph 6riwzduh 3duw 5hdo wlph 6fkhgxolqj 2 6 ydq 5rrvpdohq 9huvlrq -xo\ 2qqr ydq 5rrvpdohq 2 6](https://reader036.vdocuments.us/reader036/viewer/2022071404/60f82c70d127f5296d453b3f/html5/thumbnails/49.jpg)
Example: Full Utilization
• 1 : C1 = 2 , T1 = 5 • 2 : C2 = 3 , T2 = 7 (Ufull minimal at T2 = 2 . T1 = 1.41 T1 )
0 T1 2.T1 3.T1
C1
4.T1 5.T1 6.T1 7.T1
Full Utilization: C1 nor C2 can be increased
48
0 T2 2.T2 3.T2 4.T2 5.T2
C2
• Worst case response times: 1 : r1 = 2 2 : r2 = 5
• Utilization Ufull = (2/5 +3/7) = (29/35) = 0.828
![Page 50: Part 1.ppt [Compatibiliteitsmodus]johanl/educ/OSRTWS/Scheduling.pdf · 'hvljq ri 5hdo 7lph 6riwzduh 3duw 5hdo wlph 6fkhgxolqj 2 6 ydq 5rrvpdohq 9huvlrq -xo\ 2qqr ydq 5rrvpdohq 2 6](https://reader036.vdocuments.us/reader036/viewer/2022071404/60f82c70d127f5296d453b3f/html5/thumbnails/50.jpg)
0 T1 2.T1 3.T1 4.T1 5.T1 6.T1 7.T10 T1 2.T1 3.T1 4.T1 5.T1 6.T1 7.T1
Example: Increase C1 but keep Full Utilization
• 1 : C1 = 2+1 = 3 , T1 = 5 • 2 : C2 = 3–1 = 2 , T2 = 7
49
0 T2 2.T2 3.T2 4.T2 5.T2
0 T2 2.T2 3.T2 4.T2 5.T2
• Worst case response times: 1 : r1 = 3 2 : r2 = 5
• Utilization Ufull = (3/5 +2/7) = (31/35) = 0.89
![Page 51: Part 1.ppt [Compatibiliteitsmodus]johanl/educ/OSRTWS/Scheduling.pdf · 'hvljq ri 5hdo 7lph 6riwzduh 3duw 5hdo wlph 6fkhgxolqj 2 6 ydq 5rrvpdohq 9huvlrq -xo\ 2qqr ydq 5rrvpdohq 2 6](https://reader036.vdocuments.us/reader036/viewer/2022071404/60f82c70d127f5296d453b3f/html5/thumbnails/51.jpg)
0 T1 2.T1 3.T1 4.T1 5.T1 6.T1 7.T10 T1 2.T1 3.T1 4.T1 5.T1 6.T1 7.T1
Example: Decrease C1 but keep Full Utilization
• 1 : C1 = 2–1 = 1 , T1 = 5 • 2 : C2 = 3+2 = 5 , T2 = 7
50
0 T2 2.T2 3.T2 4.T2 5.T2
0 T2 2.T2 3.T2 4.T2 5.T2
• Worst case response times: 1 : r1 = 1 2 : r2 = 7
• Utilization Ufull = (1/5 +5/7) = (32/35) = 0.91
![Page 52: Part 1.ppt [Compatibiliteitsmodus]johanl/educ/OSRTWS/Scheduling.pdf · 'hvljq ri 5hdo 7lph 6riwzduh 3duw 5hdo wlph 6fkhgxolqj 2 6 ydq 5rrvpdohq 9huvlrq -xo\ 2qqr ydq 5rrvpdohq 2 6](https://reader036.vdocuments.us/reader036/viewer/2022071404/60f82c70d127f5296d453b3f/html5/thumbnails/52.jpg)
Example: Full Utilization
• 1 : C1 = 2 , T1 = 4 • 2 : C2 = 4 , T2 = 10 (Ufull minimal at T2 = 61/2 T1 = 2.45 T1 )
Full Utilization: C1 nor C2 can be increased
0 T1 2.T1 3.T1 4.T1 5.T1
C1 C1
51
• Worst case response times: 1 : r1 = 2 2 : r2 = 8
• Utilization Ufull = (2/4 +4/10) = (9/10) = 0.90
0 T22.T2
C2
![Page 53: Part 1.ppt [Compatibiliteitsmodus]johanl/educ/OSRTWS/Scheduling.pdf · 'hvljq ri 5hdo 7lph 6riwzduh 3duw 5hdo wlph 6fkhgxolqj 2 6 ydq 5rrvpdohq 9huvlrq -xo\ 2qqr ydq 5rrvpdohq 2 6](https://reader036.vdocuments.us/reader036/viewer/2022071404/60f82c70d127f5296d453b3f/html5/thumbnails/53.jpg)
Minimal Value of Full Utilization varying T2 /T1
100%
95%
1.0 2.0 3.0T2 /T1
52
95%
90%
85%
80%
Ufull min
T2 /T1 =10/4
![Page 54: Part 1.ppt [Compatibiliteitsmodus]johanl/educ/OSRTWS/Scheduling.pdf · 'hvljq ri 5hdo 7lph 6riwzduh 3duw 5hdo wlph 6fkhgxolqj 2 6 ydq 5rrvpdohq 9huvlrq -xo\ 2qqr ydq 5rrvpdohq 2 6](https://reader036.vdocuments.us/reader036/viewer/2022071404/60f82c70d127f5296d453b3f/html5/thumbnails/54.jpg)
Arbitrarily many tasks
• Approach– Consider free variables in utilization: U (C1 ,T1,... ,Cm ,Tm)– Eliminate Cm to obtain full utilization: Ufull (C1 ,T1,... ,Cm-1 ,Tm-1 ,Tm)– Find the Ci’s for which the value of Ufull is minimal.– Minimize also with respect to the Ti’s
53
• Result:
)12( /1min mmU 780.03min U
696.0min U
![Page 55: Part 1.ppt [Compatibiliteitsmodus]johanl/educ/OSRTWS/Scheduling.pdf · 'hvljq ri 5hdo 7lph 6riwzduh 3duw 5hdo wlph 6fkhgxolqj 2 6 ydq 5rrvpdohq 9huvlrq -xo\ 2qqr ydq 5rrvpdohq 2 6](https://reader036.vdocuments.us/reader036/viewer/2022071404/60f82c70d127f5296d453b3f/html5/thumbnails/55.jpg)
Example: Full Utilization for 3 Tasks
• 1 : C1 = 1 , T1 = 4 • 2 : C2 = 1 , T2 = 5 (Ufull minimal at T2 = 2 1/3 T1 = 1.26 T1 )• 3 : C3 = 2 , T3 = 6 (Ufull minimal at T3 = 2 2/3 T1 = 1.59 T1 )
54
• Worst case response times: 1 : r1 = 1 ; 2 : r2 = 2 ; 3 : r3 = 4
• Utilization Ufull = (1/4 + 1/5 + 2/6) = (47/60) = 0.7833
Full Utilization: C1 nor C2 nor C3 can be increased
0 5 10 15 20 25 30 35 40 45 50 55 60
![Page 56: Part 1.ppt [Compatibiliteitsmodus]johanl/educ/OSRTWS/Scheduling.pdf · 'hvljq ri 5hdo 7lph 6riwzduh 3duw 5hdo wlph 6fkhgxolqj 2 6 ydq 5rrvpdohq 9huvlrq -xo\ 2qqr ydq 5rrvpdohq 2 6](https://reader036.vdocuments.us/reader036/viewer/2022071404/60f82c70d127f5296d453b3f/html5/thumbnails/56.jpg)
Exercises
• Calculate RM schedulability of the following task sets• Use the utilization bound
– Exercise 1. Task set:• 1 : C1 = 1 T1 = 3• 2 : C2 = 1 T2 = 4
– Exercise 2. Task set:• 1 : C1 = 2 T1 = 5
55
• 1 : C1 = 2 T1 = 5• 2 : C2 = 4 T2 = 15• 3 : C3 = 5 T3 = 20
– Exercise 3. Task set:• 1 : C1 = 1 T1 = 4• 2 : C2 = 2 T2 = 6• 3 : C3 = 3 T3 = 10
![Page 57: Part 1.ppt [Compatibiliteitsmodus]johanl/educ/OSRTWS/Scheduling.pdf · 'hvljq ri 5hdo 7lph 6riwzduh 3duw 5hdo wlph 6fkhgxolqj 2 6 ydq 5rrvpdohq 9huvlrq -xo\ 2qqr ydq 5rrvpdohq 2 6](https://reader036.vdocuments.us/reader036/viewer/2022071404/60f82c70d127f5296d453b3f/html5/thumbnails/57.jpg)
Calculation of Response Times
• Utilization bound is sufficient but not necessary– Also task sets that do not satisfy the utilization bound may be
schedulable even if U >Umin
• A more precise bound can be given for each specific task set
• This is done on the basis of response times.
56
• Note: we can simply draw a schedule and calculate worst case task response times.
• This calculation by construction can be formalized
![Page 58: Part 1.ppt [Compatibiliteitsmodus]johanl/educ/OSRTWS/Scheduling.pdf · 'hvljq ri 5hdo 7lph 6riwzduh 3duw 5hdo wlph 6fkhgxolqj 2 6 ydq 5rrvpdohq 9huvlrq -xo\ 2qqr ydq 5rrvpdohq 2 6](https://reader036.vdocuments.us/reader036/viewer/2022071404/60f82c70d127f5296d453b3f/html5/thumbnails/58.jpg)
Response-Time Approach
•• The worst case response time The worst case response time rrii of a of a ii happens at the happens at the critical instant and satisfiescritical instant and satisfies
i r 1
Execution time of task itself
57
ij
ii
jji C
T
rCr
1
1
Maximum number of times higher priority task j may
be executed in period ri
Worst case waiting time for execution of higher priority tasks
of task itself
![Page 59: Part 1.ppt [Compatibiliteitsmodus]johanl/educ/OSRTWS/Scheduling.pdf · 'hvljq ri 5hdo 7lph 6riwzduh 3duw 5hdo wlph 6fkhgxolqj 2 6 ydq 5rrvpdohq 9huvlrq -xo\ 2qqr ydq 5rrvpdohq 2 6](https://reader036.vdocuments.us/reader036/viewer/2022071404/60f82c70d127f5296d453b3f/html5/thumbnails/59.jpg)
Schedulability of Task i
• Consider:
– Task i can be scheduled if a solution for t in Wi(t)/t =1 exists– The response time ri equals the smallest of such solution.
• Take:
j
i
j
ji
T
t
t
C
t
tW
1
)(
58
• Take:
– Then there is a solution for ri :•
• Wi(t)/t is continuous and strictly decreasing
• Except when t is a multiple of any of the Ti.
• Then Wi(t)/t jumps up discontinuously
1)(
min0
t
tWi
Tt i
ttWt
/)(lim0
Wi(t)/t
t
1
Tiri
![Page 60: Part 1.ppt [Compatibiliteitsmodus]johanl/educ/OSRTWS/Scheduling.pdf · 'hvljq ri 5hdo 7lph 6riwzduh 3duw 5hdo wlph 6fkhgxolqj 2 6 ydq 5rrvpdohq 9huvlrq -xo\ 2qqr ydq 5rrvpdohq 2 6](https://reader036.vdocuments.us/reader036/viewer/2022071404/60f82c70d127f5296d453b3f/html5/thumbnails/60.jpg)
Single Schedulability Criterion
• A solution ri must exist for each task i
• Therefore all tasks are schedulable iff
1)(
minmax01
t
tWi
Ttmi i
59
– Reason: max1 only if each mini 1
• We only need to consider Wi(t) at integer multiples of the periods Ti (see graph)
01 tTtmi i
![Page 61: Part 1.ppt [Compatibiliteitsmodus]johanl/educ/OSRTWS/Scheduling.pdf · 'hvljq ri 5hdo 7lph 6riwzduh 3duw 5hdo wlph 6fkhgxolqj 2 6 ydq 5rrvpdohq 9huvlrq -xo\ 2qqr ydq 5rrvpdohq 2 6](https://reader036.vdocuments.us/reader036/viewer/2022071404/60f82c70d127f5296d453b3f/html5/thumbnails/61.jpg)
Example
• Task set:• 1 : C1 = 2 T1 = 8• 2 : C2 = 2 T2 = 10• 3 : C3 = 4 T3 = 12• 4 : C4 = 1 T4 = 20
– Utilization bound: U = (2/8 +2/10+4/12+1/20) = 0.8333
2T1T1 T2 T3
T4
Here we know schedulability
1
2
3
4
8 10 12 16 20
60
– Utilization bound: U = (2/8 +2/10+4/12+1/20) = 0.8333
• U(4) 0.757; U(3) = 0.780 so last two tasks have no guarantee
– Consider: t = 8, 10, 12, 16, 20
• W4(8) = C1 + C2 + C3 + C4 = 9 not ok (1 short: length of 4 )• W4(10) = 2C1 + C2 + C3 + C4 = 11 not ok (still 1 short: length of 4
• W4(12) = 2C1 + 2C2 + C3 + C4 = 13 not ok (still 1 short: length of 4 )• W4(16) = 2C1 + 2C2 + 2C3 + C4 = 17 not ok (still 1 short: length of 4 )• W4(20) = 3C1 + 2C2 + 2C3 + C4 = 19 ok r4 =19
![Page 62: Part 1.ppt [Compatibiliteitsmodus]johanl/educ/OSRTWS/Scheduling.pdf · 'hvljq ri 5hdo 7lph 6riwzduh 3duw 5hdo wlph 6fkhgxolqj 2 6 ydq 5rrvpdohq 9huvlrq -xo\ 2qqr ydq 5rrvpdohq 2 6](https://reader036.vdocuments.us/reader036/viewer/2022071404/60f82c70d127f5296d453b3f/html5/thumbnails/62.jpg)
Exercises
• Calculate RM schedulability of the following task sets• Use the response time formula
– Exercise 1. Task set:• 1 : C1 = 1 T1 = 3• 2 : C2 = 1 T2 = 4
– Exercise 2. Task set:• 1 : C1 = 2 T1 = 5
61
• 1 : C1 = 2 T1 = 5• 2 : C2 = 4 T2 = 15• 3 : C3 = 5 T3 = 20
– Exercise 3. Task set:• 1 : C1 = 1 T1 = 4• 2 : C2 = 2 T2 = 6• 3 : C3 = 3 T3 = 10
![Page 63: Part 1.ppt [Compatibiliteitsmodus]johanl/educ/OSRTWS/Scheduling.pdf · 'hvljq ri 5hdo 7lph 6riwzduh 3duw 5hdo wlph 6fkhgxolqj 2 6 ydq 5rrvpdohq 9huvlrq -xo\ 2qqr ydq 5rrvpdohq 2 6](https://reader036.vdocuments.us/reader036/viewer/2022071404/60f82c70d127f5296d453b3f/html5/thumbnails/63.jpg)
Content
• Introduction• Static priority scheduling
– RM scheduling without resource contention• Periodic tasks• Sporadic tasks
62
![Page 64: Part 1.ppt [Compatibiliteitsmodus]johanl/educ/OSRTWS/Scheduling.pdf · 'hvljq ri 5hdo 7lph 6riwzduh 3duw 5hdo wlph 6fkhgxolqj 2 6 ydq 5rrvpdohq 9huvlrq -xo\ 2qqr ydq 5rrvpdohq 2 6](https://reader036.vdocuments.us/reader036/viewer/2022071404/60f82c70d127f5296d453b3f/html5/thumbnails/64.jpg)
Sporadic tasks
• Sporadic tasks – Released irregularly– Have a maximum rate at which they are released– Thus assuming a minimum inter-arrival time T
•• Sporadic tasks can be treated as periodic tasks Sporadic tasks can be treated as periodic tasks with period with period TT
63
with period with period TT
![Page 65: Part 1.ppt [Compatibiliteitsmodus]johanl/educ/OSRTWS/Scheduling.pdf · 'hvljq ri 5hdo 7lph 6riwzduh 3duw 5hdo wlph 6fkhgxolqj 2 6 ydq 5rrvpdohq 9huvlrq -xo\ 2qqr ydq 5rrvpdohq 2 6](https://reader036.vdocuments.us/reader036/viewer/2022071404/60f82c70d127f5296d453b3f/html5/thumbnails/65.jpg)
Content
• Introduction• Static priority scheduling
– RM scheduling without resource contention• Periodic tasks• Sporadic tasks• Aperiodic tasks
64
• Aperiodic tasks
![Page 66: Part 1.ppt [Compatibiliteitsmodus]johanl/educ/OSRTWS/Scheduling.pdf · 'hvljq ri 5hdo 7lph 6riwzduh 3duw 5hdo wlph 6fkhgxolqj 2 6 ydq 5rrvpdohq 9huvlrq -xo\ 2qqr ydq 5rrvpdohq 2 6](https://reader036.vdocuments.us/reader036/viewer/2022071404/60f82c70d127f5296d453b3f/html5/thumbnails/66.jpg)
Aperiodic Tasks
• True aperiodic tasks – Can be arbitrarily released– No guarantee can be given if released too often– Deal with them without spoiling schedulability of periodic
and sporadic tasks
• Several approaches among which:
65
• Several approaches among which:– Run as background tasks – Reserving space with a high priority periodic task– Deferred server– Sporadic server – ...
![Page 67: Part 1.ppt [Compatibiliteitsmodus]johanl/educ/OSRTWS/Scheduling.pdf · 'hvljq ri 5hdo 7lph 6riwzduh 3duw 5hdo wlph 6fkhgxolqj 2 6 ydq 5rrvpdohq 9huvlrq -xo\ 2qqr ydq 5rrvpdohq 2 6](https://reader036.vdocuments.us/reader036/viewer/2022071404/60f82c70d127f5296d453b3f/html5/thumbnails/67.jpg)
Run at Background
• Run the aperiodic tasks at lowest priority.– Periodic and sporadic tasks experience no interference.– Aperiodic tasks may run when the processor is not
allocated to the periodic/sporadic ones.– Possibly no timeliness of any of the aperiodic task-
instances.
66
instances.
![Page 68: Part 1.ppt [Compatibiliteitsmodus]johanl/educ/OSRTWS/Scheduling.pdf · 'hvljq ri 5hdo 7lph 6riwzduh 3duw 5hdo wlph 6fkhgxolqj 2 6 ydq 5rrvpdohq 9huvlrq -xo\ 2qqr ydq 5rrvpdohq 2 6](https://reader036.vdocuments.us/reader036/viewer/2022071404/60f82c70d127f5296d453b3f/html5/thumbnails/68.jpg)
Run in High-Priority Task
• Introduce a fictitious high priority server task– Period Ts
– Execution time Cs
– Aperiodic tasks run in slots of this high priority one.– If no aperiodic task are released before or within this slot
the processor is available
67
the processor is available– Outside these slots no running of the aperiodic tasks
• Schedulability of the periodic tasks is determined including the fictitious task
• If execution time of an aperiodic task is smaller Csthen such task can finish within time Ts + Cs
– At least, if aperiodic tasks are not released too oftenare not released too often
![Page 69: Part 1.ppt [Compatibiliteitsmodus]johanl/educ/OSRTWS/Scheduling.pdf · 'hvljq ri 5hdo 7lph 6riwzduh 3duw 5hdo wlph 6fkhgxolqj 2 6 ydq 5rrvpdohq 9huvlrq -xo\ 2qqr ydq 5rrvpdohq 2 6](https://reader036.vdocuments.us/reader036/viewer/2022071404/60f82c70d127f5296d453b3f/html5/thumbnails/69.jpg)
Deferred Server
• Slight modification– Avoid idle processor if no aperiodic tasks are released– Slot for server process starts every period Td
• If aperiodic processes have been released
– Execute them for period Cd
• If no aperiodic processes are released: deferdefer server execution to moment such tasks are released
68
moment such tasks are released– Preempt other tasks
– Execute them for period Cd
– Capacity reset to Cd at start of period Td
– Utilization bound • Aperiodic tasks handled by the deferred server have utilization Ud
• Periodic tasks have utilization Up
652.0 dp UU
![Page 70: Part 1.ppt [Compatibiliteitsmodus]johanl/educ/OSRTWS/Scheduling.pdf · 'hvljq ri 5hdo 7lph 6riwzduh 3duw 5hdo wlph 6fkhgxolqj 2 6 ydq 5rrvpdohq 9huvlrq -xo\ 2qqr ydq 5rrvpdohq 2 6](https://reader036.vdocuments.us/reader036/viewer/2022071404/60f82c70d127f5296d453b3f/html5/thumbnails/70.jpg)
Sporadic Server
• Slight modification – To avoid server to execute two periods back-to-back
– Slot for server process starts every period Ts and has capacity Cs
• When aperiodic processes are released
– Execute them for requested period Cc<Cs
– Capacity Cc is added to remaining capacity after Ts time from startfrom start of
C
69
cconsumption of Cc
– Sporadic server behaves like a sporadic task with period Ts
– Utilization bound • Aperiodic tasks handled by the deferred server have utilization Us
• Periodic tasks have utilization Up
1
2ln
sp U
U
![Page 71: Part 1.ppt [Compatibiliteitsmodus]johanl/educ/OSRTWS/Scheduling.pdf · 'hvljq ri 5hdo 7lph 6riwzduh 3duw 5hdo wlph 6fkhgxolqj 2 6 ydq 5rrvpdohq 9huvlrq -xo\ 2qqr ydq 5rrvpdohq 2 6](https://reader036.vdocuments.us/reader036/viewer/2022071404/60f82c70d127f5296d453b3f/html5/thumbnails/71.jpg)
Content
• Introduction• Static priority scheduling
– RM scheduling without resource contention• Periodic tasks• Sporadic tasks• Aperiodic tasks
70
• Aperiodic tasks
– RM scheduling with resource contention
![Page 72: Part 1.ppt [Compatibiliteitsmodus]johanl/educ/OSRTWS/Scheduling.pdf · 'hvljq ri 5hdo 7lph 6riwzduh 3duw 5hdo wlph 6fkhgxolqj 2 6 ydq 5rrvpdohq 9huvlrq -xo\ 2qqr ydq 5rrvpdohq 2 6](https://reader036.vdocuments.us/reader036/viewer/2022071404/60f82c70d127f5296d453b3f/html5/thumbnails/72.jpg)
Shared Resources
• Tasks may need other resources apart from processor– Typical example: mutual exclusive access to data
• Important instances– Reserve the resource: R(a)– Wait for the resource (blocked). Blocking period: B
71
– Wait for the resource (blocked). Blocking period: Bi
– Hold the resource– Release (de-reserve) the resource: D(a)
R(a) D(a)
Bi
holdingwaiting
![Page 73: Part 1.ppt [Compatibiliteitsmodus]johanl/educ/OSRTWS/Scheduling.pdf · 'hvljq ri 5hdo 7lph 6riwzduh 3duw 5hdo wlph 6fkhgxolqj 2 6 ydq 5rrvpdohq 9huvlrq -xo\ 2qqr ydq 5rrvpdohq 2 6](https://reader036.vdocuments.us/reader036/viewer/2022071404/60f82c70d127f5296d453b3f/html5/thumbnails/73.jpg)
Problem: Priority Inversion
• Consider three tasks– Priorities p1> p2> p3
– Share a single resource a– Events
• 3 holds resource• 1 reserves resource and waits
72
• 1 reserves resource and waits • 2 starts, executes and finishes• 3 releases resource• 1 gets resource but executes after 2 !!!
R(a)
1
2
3
R(a) D(a)
D(a)
1 has to wait forlower priority task 2
3 1 2
![Page 74: Part 1.ppt [Compatibiliteitsmodus]johanl/educ/OSRTWS/Scheduling.pdf · 'hvljq ri 5hdo 7lph 6riwzduh 3duw 5hdo wlph 6fkhgxolqj 2 6 ydq 5rrvpdohq 9huvlrq -xo\ 2qqr ydq 5rrvpdohq 2 6](https://reader036.vdocuments.us/reader036/viewer/2022071404/60f82c70d127f5296d453b3f/html5/thumbnails/74.jpg)
• Blocking task inherits higher priority of blocked task
Solution: Priority Inheritance
1
2
R(a) D(a)
3 1 2
3 not preempted by 2
2 experiences push-through blocking
73
• Disadvantage:– Deadlocks remains possible
• If tasks reserves resources while holding others (hold and block)• Creating a circular wait condition
R(a)
2
3
D(a)
3 inherits priority of 1
1 experiences direct blocking
![Page 75: Part 1.ppt [Compatibiliteitsmodus]johanl/educ/OSRTWS/Scheduling.pdf · 'hvljq ri 5hdo 7lph 6riwzduh 3duw 5hdo wlph 6fkhgxolqj 2 6 ydq 5rrvpdohq 9huvlrq -xo\ 2qqr ydq 5rrvpdohq 2 6](https://reader036.vdocuments.us/reader036/viewer/2022071404/60f82c70d127f5296d453b3f/html5/thumbnails/75.jpg)
Utilization bound
• A given task i can be scheduled if
12 /1
1
i
i
ii
j j
j iT
B
T
C
74
• For m tasks:
12max /11
11
m
i
im
i
m
j j
j mT
B
T
C
![Page 76: Part 1.ppt [Compatibiliteitsmodus]johanl/educ/OSRTWS/Scheduling.pdf · 'hvljq ri 5hdo 7lph 6riwzduh 3duw 5hdo wlph 6fkhgxolqj 2 6 ydq 5rrvpdohq 9huvlrq -xo\ 2qqr ydq 5rrvpdohq 2 6](https://reader036.vdocuments.us/reader036/viewer/2022071404/60f82c70d127f5296d453b3f/html5/thumbnails/76.jpg)
Response-Time Approach
• Assume a single resource shared by tasks i
• Blocking delay Bi for task i
– Direct blocking– Push-through blocking
• The worst case response time ri of a i and should now include these blocking contributions
75
i inow include these blocking contributions
iij
ii
jji BC
T
rCr
1
1 Blocking
![Page 77: Part 1.ppt [Compatibiliteitsmodus]johanl/educ/OSRTWS/Scheduling.pdf · 'hvljq ri 5hdo 7lph 6riwzduh 3duw 5hdo wlph 6fkhgxolqj 2 6 ydq 5rrvpdohq 9huvlrq -xo\ 2qqr ydq 5rrvpdohq 2 6](https://reader036.vdocuments.us/reader036/viewer/2022071404/60f82c70d127f5296d453b3f/html5/thumbnails/77.jpg)
Blocking Contribution
• Single resource a• Ca,i is execution time of resource a by task i
– Note: execution times Ci include such contributions!
• pa is the highest priority among tasks possibly reserving a• Two cases
– pa pi > pm then m
CB max
76
– pa pi > pm then
– pa < pi i = m then
• Computation intensive for more resources due to chained chained blockingblocking.
jaij
i CB ,1
max
0iB
i does not reserve a
m does not experience
blocking
i only blocked by lower priority
tasks
![Page 78: Part 1.ppt [Compatibiliteitsmodus]johanl/educ/OSRTWS/Scheduling.pdf · 'hvljq ri 5hdo 7lph 6riwzduh 3duw 5hdo wlph 6fkhgxolqj 2 6 ydq 5rrvpdohq 9huvlrq -xo\ 2qqr ydq 5rrvpdohq 2 6](https://reader036.vdocuments.us/reader036/viewer/2022071404/60f82c70d127f5296d453b3f/html5/thumbnails/78.jpg)
Schedulability of Task i
• Consider:
– Again task i can be scheduled if a solution for t in Wi(t)/t =1 exists– The response time ri equals the smallest of such solution.
• We only need to consider W (t) at integer multiples of the
ij
i
jji B
T
tCtW
1
)(
77
• We only need to consider Wi(t) at integer multiples of the periods Ti
![Page 79: Part 1.ppt [Compatibiliteitsmodus]johanl/educ/OSRTWS/Scheduling.pdf · 'hvljq ri 5hdo 7lph 6riwzduh 3duw 5hdo wlph 6fkhgxolqj 2 6 ydq 5rrvpdohq 9huvlrq -xo\ 2qqr ydq 5rrvpdohq 2 6](https://reader036.vdocuments.us/reader036/viewer/2022071404/60f82c70d127f5296d453b3f/html5/thumbnails/79.jpg)
Example
• Task set:• 1 : C1 = 40 T1 = 100 B1 = 40• 2 : C2 = 40 T2 = 150 B2 = 30• 3 : C3 = 100 T3 = 350 B3 = 0
– Consider: t = 100, 150, 200, 300, 350
T3
Here we know schedulability
T1 T2 T3
1
2
3
100 200 300 400
2T1
3T1
2T2
78
• W1(100) = C1 + B1 = 80 ok
• W2(100) = C1 + C2 + B2 = 110 not ok• W2(150) = 2C1 + C2 + B2 = 150 ok
• W3(100) = C1 + C2 + C3 = 180 not ok • W3(150) = 2C1 + C2 + C3 = 220 not ok• W3(200) = 2C1 + 2C2 + C3 = 260 not ok• W3(300) = 3C1 + 2C2 + C3 = 300 ok• W3(350) = 4C1 + 3C2 + C3 = 380 not ok
![Page 80: Part 1.ppt [Compatibiliteitsmodus]johanl/educ/OSRTWS/Scheduling.pdf · 'hvljq ri 5hdo 7lph 6riwzduh 3duw 5hdo wlph 6fkhgxolqj 2 6 ydq 5rrvpdohq 9huvlrq -xo\ 2qqr ydq 5rrvpdohq 2 6](https://reader036.vdocuments.us/reader036/viewer/2022071404/60f82c70d127f5296d453b3f/html5/thumbnails/80.jpg)
Exercises
• Calculate RM schedulability of the following task sets– Exercise 4. Task set:
• 1 : C1 = 4 T1 = 10 B1 = 3• 2 : C2 = 3 T2 = 15 B2 = 2• 3 : C3 = 4 T3 = 20 B3 = 0
79
• 3 : C3 = 4 T3 = 20 B3 = 0
![Page 81: Part 1.ppt [Compatibiliteitsmodus]johanl/educ/OSRTWS/Scheduling.pdf · 'hvljq ri 5hdo 7lph 6riwzduh 3duw 5hdo wlph 6fkhgxolqj 2 6 ydq 5rrvpdohq 9huvlrq -xo\ 2qqr ydq 5rrvpdohq 2 6](https://reader036.vdocuments.us/reader036/viewer/2022071404/60f82c70d127f5296d453b3f/html5/thumbnails/81.jpg)
• Chained blocking when using multiple resources:
Problem: Chained Blocking
1
2
3
R(a)3 12R(b)D(a) D(b)
80
• Disadvantage:– Not just a single low-priority task can block the higher
one.
R(a) D(a) D(b)R(b)
![Page 82: Part 1.ppt [Compatibiliteitsmodus]johanl/educ/OSRTWS/Scheduling.pdf · 'hvljq ri 5hdo 7lph 6riwzduh 3duw 5hdo wlph 6fkhgxolqj 2 6 ydq 5rrvpdohq 9huvlrq -xo\ 2qqr ydq 5rrvpdohq 2 6](https://reader036.vdocuments.us/reader036/viewer/2022071404/60f82c70d127f5296d453b3f/html5/thumbnails/82.jpg)
Solution: Priority Ceiling
• To avoid chained blocking– Ceiling cr of a resource r is highest priority found among the
potentially reserving tasks– System ceiling c is highest ceiling of all currently held resources– A task i may hold a resource r if pi > c or i already holds a resource
with cr = c– Priority inheritance like before when tasks block because of resource
81
– Priority inheritance like before when tasks block because of resource usage by other tasks
– ca= cb = p1 ;R(a)
c:= caD(a)
R(a)p1 c3 12
R(b)p1> cD(a) D(b)
D(b)R(b)p2c
![Page 83: Part 1.ppt [Compatibiliteitsmodus]johanl/educ/OSRTWS/Scheduling.pdf · 'hvljq ri 5hdo 7lph 6riwzduh 3duw 5hdo wlph 6fkhgxolqj 2 6 ydq 5rrvpdohq 9huvlrq -xo\ 2qqr ydq 5rrvpdohq 2 6](https://reader036.vdocuments.us/reader036/viewer/2022071404/60f82c70d127f5296d453b3f/html5/thumbnails/83.jpg)
Priority Ceiling
• Also avoids deadlock
R(d)p1> cc:= cd
3 12
R(a)holds c
D(d)c:= ca D(a) D(b)
R(b)p2 c
82
R(a)c:= ca
D(a)D(b)R(b)
holds c
![Page 84: Part 1.ppt [Compatibiliteitsmodus]johanl/educ/OSRTWS/Scheduling.pdf · 'hvljq ri 5hdo 7lph 6riwzduh 3duw 5hdo wlph 6fkhgxolqj 2 6 ydq 5rrvpdohq 9huvlrq -xo\ 2qqr ydq 5rrvpdohq 2 6](https://reader036.vdocuments.us/reader036/viewer/2022071404/60f82c70d127f5296d453b3f/html5/thumbnails/84.jpg)
Blocking Contribution
• Ca,i is execution time of resource a by task i
• BRi are the resources that can block i
– BRi = { r | cr pi }
• Blocking for task i
83
jrBRr
m
iji CB
i,
1maxmax
i only blocked by lower priority
tasks
![Page 85: Part 1.ppt [Compatibiliteitsmodus]johanl/educ/OSRTWS/Scheduling.pdf · 'hvljq ri 5hdo 7lph 6riwzduh 3duw 5hdo wlph 6fkhgxolqj 2 6 ydq 5rrvpdohq 9huvlrq -xo\ 2qqr ydq 5rrvpdohq 2 6](https://reader036.vdocuments.us/reader036/viewer/2022071404/60f82c70d127f5296d453b3f/html5/thumbnails/85.jpg)
Content
• Introduction• Static priority scheduling
– RM scheduling without resource contention• Periodic tasks• Sporadic tasks• Aperiodic tasks
84
• Aperiodic tasks
– RM scheduling with resource contention – DM scheduling
![Page 86: Part 1.ppt [Compatibiliteitsmodus]johanl/educ/OSRTWS/Scheduling.pdf · 'hvljq ri 5hdo 7lph 6riwzduh 3duw 5hdo wlph 6fkhgxolqj 2 6 ydq 5rrvpdohq 9huvlrq -xo\ 2qqr ydq 5rrvpdohq 2 6](https://reader036.vdocuments.us/reader036/viewer/2022071404/60f82c70d127f5296d453b3f/html5/thumbnails/86.jpg)
Deadline Period
• Up to now the assumption with regard to deadline Di= Ti
• If Di< Ti , two possibilities – DM assignment of priorities: Di< Dj pi> pj
– RM assignment of priorities
• In either case, the response time formula is
85
• In either case, the response time formula is applicable– Modified use of the response time formula
• Compute response time ri for each task
• Compare ri with Di
![Page 87: Part 1.ppt [Compatibiliteitsmodus]johanl/educ/OSRTWS/Scheduling.pdf · 'hvljq ri 5hdo 7lph 6riwzduh 3duw 5hdo wlph 6fkhgxolqj 2 6 ydq 5rrvpdohq 9huvlrq -xo\ 2qqr ydq 5rrvpdohq 2 6](https://reader036.vdocuments.us/reader036/viewer/2022071404/60f82c70d127f5296d453b3f/html5/thumbnails/87.jpg)