Characteristics Time constraints ShdliScheduling...Scheduling The heart of a RTOS is the short-term...
Transcript of Characteristics Time constraints ShdliScheduling...Scheduling The heart of a RTOS is the short-term...
![Page 1: Characteristics Time constraints ShdliScheduling...Scheduling The heart of a RTOS is the short-term scheduler Not crucial Fairness, Minimum average response time, … CilCrucial All](https://reader034.fdocuments.in/reader034/viewer/2022042116/5e93b1c49f5a1109390e5d44/html5/thumbnails/1.jpg)
RTOSRTOS
CharacteristicsCharacteristicsTime constraintsTime constraints
S h d liS h d liSchedulingScheduling
C. Brandolese, W. FornaciariC. Brandolese, W. Fornaciari
![Page 2: Characteristics Time constraints ShdliScheduling...Scheduling The heart of a RTOS is the short-term scheduler Not crucial Fairness, Minimum average response time, … CilCrucial All](https://reader034.fdocuments.in/reader034/viewer/2022042116/5e93b1c49f5a1109390e5d44/html5/thumbnails/2.jpg)
RealReal--Time SystemsTime Systems
Definition of real-time system“ l h h h f “A real-time system is one in which the correctness of the computation not only depends on the logical correctness of the computation, but also on the time pat which the result is computed. If the timing constraints of the system are not met, system failure is said to have occurred”s sa d to ave occu ed
Tasks or processes attempt to control or react to external events occuring in “real time”RT processes must be able to keep up events
Hard Real Time: timing violation produces a disasterS ft R l Ti ti i g i l ti d i bl b t Soft Real Time: timing violations are undesirable but not catastrophic
C. Brandolese, W. FornaciariC. Brandolese, W. Fornaciari -- 22 --
![Page 3: Characteristics Time constraints ShdliScheduling...Scheduling The heart of a RTOS is the short-term scheduler Not crucial Fairness, Minimum average response time, … CilCrucial All](https://reader034.fdocuments.in/reader034/viewer/2022042116/5e93b1c49f5a1109390e5d44/html5/thumbnails/3.jpg)
RTOSRTOS
A Real-Time Operating System (RTOS)Is just one element of a complete real-time systemMust provide sufficient functionality to enable the
ll l ti t t t it i toverall real-time system to meet its requirementsShould ensure that all time critical events are handled as quickly and efficiently as possibleas quickly and efficiently as possible
RTOS are characterized by these main featuresDeterministic behaviourDeterministic behaviourResponsivenessUser controlReliability and fail-soft operation
C. Brandolese, W. FornaciariC. Brandolese, W. Fornaciari -- 33 --
![Page 4: Characteristics Time constraints ShdliScheduling...Scheduling The heart of a RTOS is the short-term scheduler Not crucial Fairness, Minimum average response time, … CilCrucial All](https://reader034.fdocuments.in/reader034/viewer/2022042116/5e93b1c49f5a1109390e5d44/html5/thumbnails/4.jpg)
RTOS: DeterminismRTOS: Determinism
Operations are performed at fixed, predetermined times or within predetermined time intervalsConcerned with
How long the operating system delays before acknowledging an interruptWhether the system has sufficient capacity to handle Whether the system has sufficient capacity to handle all requests within required time
RTOS should show minimum interrupt latencyRTOS should show minimum interrupt latencyTypical measure:
Max delay to start ISR with highest priorityRT: 1µs - 1msNon-RT: 10ms - 100 ms
C. Brandolese, W. FornaciariC. Brandolese, W. Fornaciari -- 44 --
![Page 5: Characteristics Time constraints ShdliScheduling...Scheduling The heart of a RTOS is the short-term scheduler Not crucial Fairness, Minimum average response time, … CilCrucial All](https://reader034.fdocuments.in/reader034/viewer/2022042116/5e93b1c49f5a1109390e5d44/html5/thumbnails/5.jpg)
RTOS: ResponsivenessRTOS: Responsiveness
How long, after acknowledgment, the operating system takes to service the interruptIncludes the time to begin execution of the ISR
If a context switch is necessary, the delay is longer than an ISR executed within the context of the current processcurrent process
Includes the amount of time to perform the interrupt, depending also on the specific hardware p , p g pDepends on the possible ISR nesting and if ISRs can be interrupted
C. Brandolese, W. FornaciariC. Brandolese, W. Fornaciari -- 55 --
![Page 6: Characteristics Time constraints ShdliScheduling...Scheduling The heart of a RTOS is the short-term scheduler Not crucial Fairness, Minimum average response time, … CilCrucial All](https://reader034.fdocuments.in/reader034/viewer/2022042116/5e93b1c49f5a1109390e5d44/html5/thumbnails/6.jpg)
RTOS: User controlRTOS: User control
Much broader in RTOS than in ordinary O.S.User should be able to
Specify paging or process swappingDecide which processes must reside in main memoryEstablish the rights of processes
d l kFine-grained control over task prioritiesSelect algorithms for disks scheduling...
C. Brandolese, W. FornaciariC. Brandolese, W. Fornaciari -- 66 --
![Page 7: Characteristics Time constraints ShdliScheduling...Scheduling The heart of a RTOS is the short-term scheduler Not crucial Fairness, Minimum average response time, … CilCrucial All](https://reader034.fdocuments.in/reader034/viewer/2022042116/5e93b1c49f5a1109390e5d44/html5/thumbnails/7.jpg)
RTOS: ReliabilityRTOS: Reliability
In the application domain of RTOS, degradation of performances may have catastrophic consequencesperformances may have catastrophic consequences
Attempt either to fix the problem or minimize its effects while continuing to rungGraceful degradation can be not enough
Fail-softAbility to fail in such a way to preserve as much data and capability as possible
E g multiple attempts to improve data consistencyE.g., multiple attempts to improve data consistency
StabilityThe system adopts policies such that the most critical y p phigh priority tasks execute first, even if some needs of less important tasks can be not always met
C. Brandolese, W. FornaciariC. Brandolese, W. Fornaciari -- 77 --
![Page 8: Characteristics Time constraints ShdliScheduling...Scheduling The heart of a RTOS is the short-term scheduler Not crucial Fairness, Minimum average response time, … CilCrucial All](https://reader034.fdocuments.in/reader034/viewer/2022042116/5e93b1c49f5a1109390e5d44/html5/thumbnails/8.jpg)
RTOS: Typical featuresRTOS: Typical features
Low cost, small sizeManagement of at least 20 tasksHave minimum interrupt latencyD t i i ti ti ti f ll k l iDeterministic execution time for all kernel servicesProvide at least the following services
Allow tasks to be dynamically created and deletedAllow tasks to be dynamically created and deletedProvide semaphore management services and IPCAllow time delays and timeouts on kernel servicesyManagement of special alarmsUse of special file to accumulate data at a fast ratePreemptive priority-based scheduling with fast context switch
C. Brandolese, W. FornaciariC. Brandolese, W. Fornaciari -- 88 --
![Page 9: Characteristics Time constraints ShdliScheduling...Scheduling The heart of a RTOS is the short-term scheduler Not crucial Fairness, Minimum average response time, … CilCrucial All](https://reader034.fdocuments.in/reader034/viewer/2022042116/5e93b1c49f5a1109390e5d44/html5/thumbnails/9.jpg)
Time constraintsTime constraints
Computational activities in a real-time system generally have timing constraints
computation time
ready scheduled completed deadline
time
C. Brandolese, W. FornaciariC. Brandolese, W. Fornaciari -- 99 --
![Page 10: Characteristics Time constraints ShdliScheduling...Scheduling The heart of a RTOS is the short-term scheduler Not crucial Fairness, Minimum average response time, … CilCrucial All](https://reader034.fdocuments.in/reader034/viewer/2022042116/5e93b1c49f5a1109390e5d44/html5/thumbnails/10.jpg)
Time constraintsTime constraints
The "ready" event may bePeriodic
Tasks: Overall activityJ b I t ti ti i di id ll h d l d Jobs: Instantiations or individually scheduled computations of the task. A task is a stream of jobs
Aperiodic but predictablepe od c but p ed ctableUnpredictable
The "computation time" may beFixed in durationVariableUnpredictable
C. Brandolese, W. FornaciariC. Brandolese, W. Fornaciari -- 1010 --
![Page 11: Characteristics Time constraints ShdliScheduling...Scheduling The heart of a RTOS is the short-term scheduler Not crucial Fairness, Minimum average response time, … CilCrucial All](https://reader034.fdocuments.in/reader034/viewer/2022042116/5e93b1c49f5a1109390e5d44/html5/thumbnails/11.jpg)
DeadlinesDeadlines
DeadlinesHard
The computation must be completed by the deadline time or a fatal error will occurtime or a fatal error will occur
SoftThe deadline may just be a recommendation or The deadline may just be a recommendation or preference for completion of the computation
A "Value Function"Indicates the criticality of a deadlineIndicates the value that the completion of a task
t ib t t th ll l f th tcontributes to the overall value of the system
C. Brandolese, W. FornaciariC. Brandolese, W. Fornaciari -- 1111 --
![Page 12: Characteristics Time constraints ShdliScheduling...Scheduling The heart of a RTOS is the short-term scheduler Not crucial Fairness, Minimum average response time, … CilCrucial All](https://reader034.fdocuments.in/reader034/viewer/2022042116/5e93b1c49f5a1109390e5d44/html5/thumbnails/12.jpg)
DeadlinesDeadlines
In a non real-time system the time by which a task is completed does not influence the overall value –or quality – of the systemTh l f ti i th f ll iThe value function is the following
V
tR0
tR
C. Brandolese, W. FornaciariC. Brandolese, W. Fornaciari -- 1212 --
![Page 13: Characteristics Time constraints ShdliScheduling...Scheduling The heart of a RTOS is the short-term scheduler Not crucial Fairness, Minimum average response time, … CilCrucial All](https://reader034.fdocuments.in/reader034/viewer/2022042116/5e93b1c49f5a1109390e5d44/html5/thumbnails/13.jpg)
DeadlinesDeadlines
Catastrophic effect Hard Deadline
V V
tR0
-∞ tR0
D D
Ramped Hard Deadline Soft Deadline
V V
tR0
D tR0
D
C. Brandolese, W. FornaciariC. Brandolese, W. Fornaciari -- 1313 --
tR D tR D
![Page 14: Characteristics Time constraints ShdliScheduling...Scheduling The heart of a RTOS is the short-term scheduler Not crucial Fairness, Minimum average response time, … CilCrucial All](https://reader034.fdocuments.in/reader034/viewer/2022042116/5e93b1c49f5a1109390e5d44/html5/thumbnails/14.jpg)
PreemptionPreemption
A computation or task is preemptable if it can be interrupted (suspended) when another more critical task needs to be executedA t ti bA computation can be
PreemptablePreemptable with one or more non preemptible Preemptable with one or more non-preemptible critical regionsNon-preemptableNon preemptable
C. Brandolese, W. FornaciariC. Brandolese, W. Fornaciari -- 1414 --
![Page 15: Characteristics Time constraints ShdliScheduling...Scheduling The heart of a RTOS is the short-term scheduler Not crucial Fairness, Minimum average response time, … CilCrucial All](https://reader034.fdocuments.in/reader034/viewer/2022042116/5e93b1c49f5a1109390e5d44/html5/thumbnails/15.jpg)
PreemptionPreemption
IRQpreemption completed
Task 1
time
Task 2
IRQno preemption completedno preemption completed
Task 1
time
Task 2
C. Brandolese, W. FornaciariC. Brandolese, W. Fornaciari -- 1515 --
time
![Page 16: Characteristics Time constraints ShdliScheduling...Scheduling The heart of a RTOS is the short-term scheduler Not crucial Fairness, Minimum average response time, … CilCrucial All](https://reader034.fdocuments.in/reader034/viewer/2022042116/5e93b1c49f5a1109390e5d44/html5/thumbnails/16.jpg)
SchedulingScheduling
The heart of a RTOS is the short-term schedulerNot crucial
Fairness, Minimum average response time, …
C i lCrucialAll hard-RT tasks must complete by their deadlineAs many soft-RT tasks as possible should also complete As many soft-RT tasks as possible should also complete meeting their deadlines
Most RTOSs are unable to deal with deadlinesDesigned to be as responsive as possible to RT tasks
When deadline approaches, RT tasks can be quickly h d l dscheduled
This approach requires deterministic response time sometimes below milliseconds
C. Brandolese, W. FornaciariC. Brandolese, W. Fornaciari -- 1616 --
sometimes below milliseconds
![Page 17: Characteristics Time constraints ShdliScheduling...Scheduling The heart of a RTOS is the short-term scheduler Not crucial Fairness, Minimum average response time, … CilCrucial All](https://reader034.fdocuments.in/reader034/viewer/2022042116/5e93b1c49f5a1109390e5d44/html5/thumbnails/17.jpg)
SchedulingScheduling
In a Round Robin non-preemptive schedulerThe RT task is appended at the end of the ready queue
Wait for its next timeslice
Th d l b t bl f RT li tiThe delay can be unacceptable for RT applications
Request for RT Task
ticks
Task 1 Task 2 Task 3 Task N RT Task Task 1
Scheduling time
C. Brandolese, W. FornaciariC. Brandolese, W. Fornaciari -- 1717 --
Scheduling time
![Page 18: Characteristics Time constraints ShdliScheduling...Scheduling The heart of a RTOS is the short-term scheduler Not crucial Fairness, Minimum average response time, … CilCrucial All](https://reader034.fdocuments.in/reader034/viewer/2022042116/5e93b1c49f5a1109390e5d44/html5/thumbnails/18.jpg)
SchedulingScheduling
Priority driven non-preemptive schedulerRT tasks have higher priorityA RT task is scheduled when the current task T
Is blocked, orRuns to completion (even if with low priority)
The RT is added at the head of the ready queueThe RT is added at the head of the ready queuePossible delay of seconds, unacceptable for real-time
Request for RT Task
Task T RT Task Task N
Scheduling time
C. Brandolese, W. FornaciariC. Brandolese, W. Fornaciari -- 1818 --
Scheduling time
![Page 19: Characteristics Time constraints ShdliScheduling...Scheduling The heart of a RTOS is the short-term scheduler Not crucial Fairness, Minimum average response time, … CilCrucial All](https://reader034.fdocuments.in/reader034/viewer/2022042116/5e93b1c49f5a1109390e5d44/html5/thumbnails/19.jpg)
SchedulingScheduling
Priority driven preemptive on preemption pointsPreemption can only take place at the end of some regular intervalsI th i tIn those points
The highest priority task is scheduledIncluding kernel tasksIncluding kernel tasks
Delays in the order of some ms, adequate for some applications not for more demanding ones
Request for RT Task
RT Task Task T (resumed)
Scheduling time
Task T
preemptionpoints
C. Brandolese, W. FornaciariC. Brandolese, W. Fornaciari -- 1919 --
Scheduling timep
![Page 20: Characteristics Time constraints ShdliScheduling...Scheduling The heart of a RTOS is the short-term scheduler Not crucial Fairness, Minimum average response time, … CilCrucial All](https://reader034.fdocuments.in/reader034/viewer/2022042116/5e93b1c49f5a1109390e5d44/html5/thumbnails/20.jpg)
SchedulingScheduling
Immediate preemptive schedulingThe service to the interrupt is almost immediate
Apart from the case OS is executing a critical region
S h d li d l f ll d t 100 lScheduling delays fall down to 100 µs, or lessA minimum amount of time is nevertheless required to save the context and to switch to the new contextsave the context and to switch to the new context
Good for critical systems
Request for RT Task
RT Task Task T (resumed)
Scheduling time
Task T
preemptionpoints
C. Brandolese, W. FornaciariC. Brandolese, W. Fornaciari -- 2020 --
Scheduling timep
![Page 21: Characteristics Time constraints ShdliScheduling...Scheduling The heart of a RTOS is the short-term scheduler Not crucial Fairness, Minimum average response time, … CilCrucial All](https://reader034.fdocuments.in/reader034/viewer/2022042116/5e93b1c49f5a1109390e5d44/html5/thumbnails/21.jpg)
Factors influencing schedulingFactors influencing scheduling
Schedulability analysisYes/NoStatic/dynamic
The result of the analysis can beA clear scheduling
l f ll f k d hA "plan" to follow at run-time for task dispatching
Classes of algorithmsS i bl d iStatic table-drivenStatic priority-driven preemptiveDynamic planning basedDynamic planning-basedDynamic best-effort
C. Brandolese, W. FornaciariC. Brandolese, W. Fornaciari -- 2121 --
![Page 22: Characteristics Time constraints ShdliScheduling...Scheduling The heart of a RTOS is the short-term scheduler Not crucial Fairness, Minimum average response time, … CilCrucial All](https://reader034.fdocuments.in/reader034/viewer/2022042116/5e93b1c49f5a1109390e5d44/html5/thumbnails/22.jpg)
Static tableStatic table--drivendriven
Through a static feasibility analysis of schedule, determines at run time when a task must begin determines, at run-time, when a task must begin execution
Applicable to periodic tasksApplicable to periodic tasksAnalysis inputs
Periodic arrival timeExecution timePeriodic ending deadlineR l ti i it f h t kRelative priority of each task
Predictable but inflexible approachAny change in the requirements of tasks imply the Any change in the requirements of tasks imply the computation of a new schedule
Example: Earliest-deadline first
C. Brandolese, W. FornaciariC. Brandolese, W. Fornaciari -- 2222 --
![Page 23: Characteristics Time constraints ShdliScheduling...Scheduling The heart of a RTOS is the short-term scheduler Not crucial Fairness, Minimum average response time, … CilCrucial All](https://reader034.fdocuments.in/reader034/viewer/2022042116/5e93b1c49f5a1109390e5d44/html5/thumbnails/23.jpg)
Static priorityStatic priority--driven preemptivedriven preemptive
Uses standard priority-driven preemptive schedulerStatic analysis is performed
No schedule is drawn-upAssigns priorities to tasksIn RT systems depends on time constraints associated to tasksto tasks
Example: Rate Monotonic
C. Brandolese, W. FornaciariC. Brandolese, W. Fornaciari -- 2323 --
![Page 24: Characteristics Time constraints ShdliScheduling...Scheduling The heart of a RTOS is the short-term scheduler Not crucial Fairness, Minimum average response time, … CilCrucial All](https://reader034.fdocuments.in/reader034/viewer/2022042116/5e93b1c49f5a1109390e5d44/html5/thumbnails/24.jpg)
Dynamic planningDynamic planning--basedbased
Feasibility is determined at run-time Rather then offline
A task is accepted for execution If and only if it is feasible to meet its time constraints
Before its execution An attempt is made to create a schedule including previous tasks and the new oneThe deadline of the extended task set must be metThe deadline of the extended task set must be met
C. Brandolese, W. FornaciariC. Brandolese, W. Fornaciari -- 2424 --
![Page 25: Characteristics Time constraints ShdliScheduling...Scheduling The heart of a RTOS is the short-term scheduler Not crucial Fairness, Minimum average response time, … CilCrucial All](https://reader034.fdocuments.in/reader034/viewer/2022042116/5e93b1c49f5a1109390e5d44/html5/thumbnails/25.jpg)
Dynamic bestDynamic best--efforteffort
Used in many commercial RT systems lEasy to implement
No feasibility analysis is performedTypically the tasks are aperiodic and no static Typically, the tasks are aperiodic and no static scheduling analysis is possible
When a task arrivesThe system assign a priority based on its characteristics
E.g., based on earliest deadlinesE.g., based on earliest deadlinesThe system tries to meet deadlines and aborts any started process whose deadline is missed
il h k i l d ( d dli i ) i i Until the task is completed (or deadline arrives), it is unknown if time constraints will be met
C. Brandolese, W. FornaciariC. Brandolese, W. Fornaciari -- 2525 --
![Page 26: Characteristics Time constraints ShdliScheduling...Scheduling The heart of a RTOS is the short-term scheduler Not crucial Fairness, Minimum average response time, … CilCrucial All](https://reader034.fdocuments.in/reader034/viewer/2022042116/5e93b1c49f5a1109390e5d44/html5/thumbnails/26.jpg)
Deadline schedulingDeadline scheduling
Real-time applications are not concerned with speed but with completing tasksPriorities
Provide a crude tool Do not capture the requirement of completion or initiation at the most valuable timeinitiation at the most valuable time
Other deadline related information should be taken into accountinto account
C. Brandolese, W. FornaciariC. Brandolese, W. Fornaciari -- 2626 --
![Page 27: Characteristics Time constraints ShdliScheduling...Scheduling The heart of a RTOS is the short-term scheduler Not crucial Fairness, Minimum average response time, … CilCrucial All](https://reader034.fdocuments.in/reader034/viewer/2022042116/5e93b1c49f5a1109390e5d44/html5/thumbnails/27.jpg)
Deadline scheduling: Deadline scheduling: Other informationOther informationOther informationOther information
Ready time h h k d f Time at which task is ready for execution
For periodic task it is a sequence of times Known in advanceKnown in advance
Starting/completion deadlineTypical RT application have either deadlines, but not yp pp ,both
Processing timeI it i li dIn some cases it is suppliedIn others cases the operating system measures an exponential averagep g
Resource requirementsIn addition to microprocessor
C. Brandolese, W. FornaciariC. Brandolese, W. Fornaciari -- 2727 --
![Page 28: Characteristics Time constraints ShdliScheduling...Scheduling The heart of a RTOS is the short-term scheduler Not crucial Fairness, Minimum average response time, … CilCrucial All](https://reader034.fdocuments.in/reader034/viewer/2022042116/5e93b1c49f5a1109390e5d44/html5/thumbnails/28.jpg)
Deadline scheduling: Deadline scheduling: Other informationOther informationOther informationOther information
PriorityMeasures relative importance of tasksHard-RT tasks have “absolute” priority
Subtask structureTask possibly decomposed in
M d b k h l i h h d RT d dliMandatory subtasks: the only with hard RT deadlinesOptional subtasks: all other subtasks
…
C. Brandolese, W. FornaciariC. Brandolese, W. Fornaciari -- 2828 --
![Page 29: Characteristics Time constraints ShdliScheduling...Scheduling The heart of a RTOS is the short-term scheduler Not crucial Fairness, Minimum average response time, … CilCrucial All](https://reader034.fdocuments.in/reader034/viewer/2022042116/5e93b1c49f5a1109390e5d44/html5/thumbnails/29.jpg)
Design issuesDesign issues
Which task to schedule next?For a given preemption strategy, scheduling tasks with the earliest deadline minimizes the fraction of tasks that miss their deadlines tasks that miss their deadlines
True for single and multiprocessor configurations
What sort of preemption is allowed?What sort of preemption is allowed?When starting deadlines are given, non-preemptive scheduler makes senseThe RT task has the responsibility to block itself afterexecuting the critical portion, allowing starting other RT d dliRT deadlines
C. Brandolese, W. FornaciariC. Brandolese, W. Fornaciari -- 2929 --
![Page 30: Characteristics Time constraints ShdliScheduling...Scheduling The heart of a RTOS is the short-term scheduler Not crucial Fairness, Minimum average response time, … CilCrucial All](https://reader034.fdocuments.in/reader034/viewer/2022042116/5e93b1c49f5a1109390e5d44/html5/thumbnails/30.jpg)
Example: Periodic tasksExample: Periodic tasks
A system collects and processes data from two sensors, A and BDeadlines:
A must be read every 20 msB must be read every 50 ms
P i ti (i l di OS h d) Processing time (including OS overhead): Processing data from A requires 10 msP i g d t f B i 25 Processing data from B requires 25 ms
The system makes scheduling decision every 10 ms
C. Brandolese, W. FornaciariC. Brandolese, W. Fornaciari -- 3030 --
![Page 31: Characteristics Time constraints ShdliScheduling...Scheduling The heart of a RTOS is the short-term scheduler Not crucial Fairness, Minimum average response time, … CilCrucial All](https://reader034.fdocuments.in/reader034/viewer/2022042116/5e93b1c49f5a1109390e5d44/html5/thumbnails/31.jpg)
Example: Periodic tasksExample: Periodic tasks
Process Arrival time Execution time DeadlineA(1) 0 10 20A(2) 20 10 40A(2) 20 10 40A(3) 40 10 60A(4) 60 10 80… … … …… … … …
B(1) 0 25 50B(2) 50 25 100… … … …
B(1) deadline
B(1) deadline
A(1) deadline
A(2) deadline
A(3) deadline
A(4) deadline
A(5) deadline
A(6) deadline
time
Task A
Task B
0 10 20 30 40 50 60 70 80 90 100 110 120
A(1)
B(1)
A(2) A(3) A(4) A(5) A(6) A(7)
B(2) B(3)
C. Brandolese, W. FornaciariC. Brandolese, W. Fornaciari -- 3131 --
time0 10 20 30 40 50 60 70 80 90 100 110 120
![Page 32: Characteristics Time constraints ShdliScheduling...Scheduling The heart of a RTOS is the short-term scheduler Not crucial Fairness, Minimum average response time, … CilCrucial All](https://reader034.fdocuments.in/reader034/viewer/2022042116/5e93b1c49f5a1109390e5d44/html5/thumbnails/32.jpg)
Example: Periodic tasksExample: Periodic tasks
Fixed priority schedulingTask A has priority Task B may miss some deadlines
A(1) B(1) A(2) A(3) A(4) A(5) A(6) A(7)B(2) B(3)B(1) B(2) B(2)B(3)
time0 10 20 30 40 50 60 70 80 90 100 110 120
B(1) is not rescheduled sinceits deadline has been reached
d ll h b l d
C. Brandolese, W. FornaciariC. Brandolese, W. Fornaciari -- 3232 --
and will thus be violated
![Page 33: Characteristics Time constraints ShdliScheduling...Scheduling The heart of a RTOS is the short-term scheduler Not crucial Fairness, Minimum average response time, … CilCrucial All](https://reader034.fdocuments.in/reader034/viewer/2022042116/5e93b1c49f5a1109390e5d44/html5/thumbnails/33.jpg)
Example: Periodic tasksExample: Periodic tasks
Fixed priority schedulingTask B has priority Task A may miss some deadlines
B(1) A(2) A(3) A(5)B(2) B(3)
time0 10 20 30 40 50 60 70 80 90 100 110 120
A(1) missed deadline A(4) missed deadline
C. Brandolese, W. FornaciariC. Brandolese, W. Fornaciari -- 3333 --
![Page 34: Characteristics Time constraints ShdliScheduling...Scheduling The heart of a RTOS is the short-term scheduler Not crucial Fairness, Minimum average response time, … CilCrucial All](https://reader034.fdocuments.in/reader034/viewer/2022042116/5e93b1c49f5a1109390e5d44/html5/thumbnails/34.jpg)
Example: Periodic tasksExample: Periodic tasks
Earliest deadline first with preemptionCompletion deadlines are consideredAt any preemption point the scheduler gives priority t th t k ith th li t d dlito the task with the earliest deadlineAll task can meet their deadlines
A(1) B(1) A(2) A(3) A(4) A(5) A(6) B(3)B(1) B(2)B(2)
time0 10 20 30 40 50 60 70 80 90 100 110 120
All task can be scheduled within their completion deadlines
C. Brandolese, W. FornaciariC. Brandolese, W. Fornaciari -- 3434 --
![Page 35: Characteristics Time constraints ShdliScheduling...Scheduling The heart of a RTOS is the short-term scheduler Not crucial Fairness, Minimum average response time, … CilCrucial All](https://reader034.fdocuments.in/reader034/viewer/2022042116/5e93b1c49f5a1109390e5d44/html5/thumbnails/35.jpg)
Example: Aperiodic tasksExample: Aperiodic tasks
Five tasks All tasks have an execution time of 20 msArrival times are unknown Starting deadlines are considered
A B C D EA B C D E
AB C DE
time0 10 20 30 40 50 60 70 80 90 100 110 120
C
Arrival timesArrival times
Starting deadlines
C. Brandolese, W. FornaciariC. Brandolese, W. Fornaciari -- 3535 --
![Page 36: Characteristics Time constraints ShdliScheduling...Scheduling The heart of a RTOS is the short-term scheduler Not crucial Fairness, Minimum average response time, … CilCrucial All](https://reader034.fdocuments.in/reader034/viewer/2022042116/5e93b1c49f5a1109390e5d44/html5/thumbnails/36.jpg)
Example: Aperiodic tasksExample: Aperiodic tasks
Earliest deadline firstStarting deadlines are unknown before the task becomes ready for schedulingS h d l th d t k ith th li t d dli Schedule the ready task with the earliest deadline and let the task run to completion
A B C D E
AB C DE
A E DC
time0 10 20 30 40 50 60 70 80 90 100 110 120
B missed deadline Tasks D and E are readyTask E has earliest deadline
C. Brandolese, W. FornaciariC. Brandolese, W. Fornaciari -- 3636 --
![Page 37: Characteristics Time constraints ShdliScheduling...Scheduling The heart of a RTOS is the short-term scheduler Not crucial Fairness, Minimum average response time, … CilCrucial All](https://reader034.fdocuments.in/reader034/viewer/2022042116/5e93b1c49f5a1109390e5d44/html5/thumbnails/37.jpg)
Example: Aperiodic tasksExample: Aperiodic tasks
Earliest deadline with unforced idle timesPossible if deadlines are know before the task is ready
Schedule the eligible task with the earliest deadline L t th t k t l tiLet the task run to completion
Elegible tasks may not be ready Processor remains idle even though ready tasks existProcessor remains idle even though ready tasks exist
A B C D E
AB C DE
B E DC A
time0 10 20 30 40 50 60 70 80 90 100 110 120
Tasks A, D and E are readyTask E has earliest deadline
C. Brandolese, W. FornaciariC. Brandolese, W. Fornaciari -- 3737 --
![Page 38: Characteristics Time constraints ShdliScheduling...Scheduling The heart of a RTOS is the short-term scheduler Not crucial Fairness, Minimum average response time, … CilCrucial All](https://reader034.fdocuments.in/reader034/viewer/2022042116/5e93b1c49f5a1109390e5d44/html5/thumbnails/38.jpg)
Example: Aperiodic tasksExample: Aperiodic tasks
First-Come, First-Serve (FCFS)Tasks are ordered based on their arrival timesTasks are served if their starting deadline is metTasks B and E do not meet their deadlines
A B C D EE missed deadline
AB C DE
DCA
time0 10 20 30 40 50 60 70 80 90 100 110 120
Tasks D and E are ready, with D coming firstTask D is served
B missed deadline
C. Brandolese, W. FornaciariC. Brandolese, W. Fornaciari -- 3838 --
![Page 39: Characteristics Time constraints ShdliScheduling...Scheduling The heart of a RTOS is the short-term scheduler Not crucial Fairness, Minimum average response time, … CilCrucial All](https://reader034.fdocuments.in/reader034/viewer/2022042116/5e93b1c49f5a1109390e5d44/html5/thumbnails/39.jpg)
Rate Monotonic SchedulingRate Monotonic Scheduling
Each task has A period T An execution time C for each occurrence
In uniprocessor systems C < T
lProcessor Utilization is U = C/T (<100%)
ti
Period
Task P P P Ptime
ExecutionTime
IdleTime
C. Brandolese, W. FornaciariC. Brandolese, W. Fornaciari -- 3939 --
![Page 40: Characteristics Time constraints ShdliScheduling...Scheduling The heart of a RTOS is the short-term scheduler Not crucial Fairness, Minimum average response time, … CilCrucial All](https://reader034.fdocuments.in/reader034/viewer/2022042116/5e93b1c49f5a1109390e5d44/html5/thumbnails/40.jpg)
Rate Monotonic SchedulingRate Monotonic Scheduling
Assigns priorities to tasks On the basis of their periodsShortest period task has highest priority
High Highest priority
y
g
Highest rate
Highest priority
Prio
rity
Rate (Hz)
Low
C. Brandolese, W. FornaciariC. Brandolese, W. Fornaciari -- 4040 --
![Page 41: Characteristics Time constraints ShdliScheduling...Scheduling The heart of a RTOS is the short-term scheduler Not crucial Fairness, Minimum average response time, … CilCrucial All](https://reader034.fdocuments.in/reader034/viewer/2022042116/5e93b1c49f5a1109390e5d44/html5/thumbnails/41.jpg)
Rate Monotonic SchedulingRate Monotonic Scheduling
A measure of a the effectiveness of a periodic scheduling algorithm is its capability to meet deadlinesC id N t k ith Consider N tasks with
A fixed period Ti
A fixed execution time CA fixed execution time Ci
To meet all deadlines, the processor utilizations of individual tasks must not exceeds the available individual tasks must not exceeds the available computational power
N C∑=
≤N
i i
i
TC
1
1
C. Brandolese, W. FornaciariC. Brandolese, W. Fornaciari -- 4141 --