tasks periodic the period is the amount of time between each iteration of a regularly repeated task...
TRANSCRIPT
![Page 1: Tasks Periodic The period is the amount of time between each iteration of a regularly repeated task Time driven The task is automatically activated by](https://reader030.vdocuments.site/reader030/viewer/2022032722/56649cf55503460f949c3d78/html5/thumbnails/1.jpg)
![Page 2: Tasks Periodic The period is the amount of time between each iteration of a regularly repeated task Time driven The task is automatically activated by](https://reader030.vdocuments.site/reader030/viewer/2022032722/56649cf55503460f949c3d78/html5/thumbnails/2.jpg)
Tasks
Tasks
PeriodicThe period is the amount of time between each iteration of a regularly repeated task
Non PeriodicRespond to randomly arriving events .
Time drivenThe task is automatically activated by the kernel
at regular intervals.
Event drivenThe task is activated upon the arrival of an event
or through an explicit activation.
![Page 3: Tasks Periodic The period is the amount of time between each iteration of a regularly repeated task Time driven The task is automatically activated by](https://reader030.vdocuments.site/reader030/viewer/2022032722/56649cf55503460f949c3d78/html5/thumbnails/3.jpg)
Tasks
• Non periodic tasks can be converted to periodic tasks– Converting an interrupt handler to a
polling task. – Instead of reacting to an external event
the moment it occurs, the system polls the external input regularly.
– If the awaited event is detected, the appropriated action is performed.
![Page 4: Tasks Periodic The period is the amount of time between each iteration of a regularly repeated task Time driven The task is automatically activated by](https://reader030.vdocuments.site/reader030/viewer/2022032722/56649cf55503460f949c3d78/html5/thumbnails/4.jpg)
Tasks
Tasks
HardMissing a deadline may cause catastrophic
effects on the controlled system.
SoftMissing a deadline only causes a performance
degradation.
• Sensory acquisition• low-level control• sensory-motor planning
• Reading data from the keyboard• User command interpretation• Message displaying• Graphical activities
![Page 5: Tasks Periodic The period is the amount of time between each iteration of a regularly repeated task Time driven The task is automatically activated by](https://reader030.vdocuments.site/reader030/viewer/2022032722/56649cf55503460f949c3d78/html5/thumbnails/5.jpg)
Schedule
• A schedule is a particular assignment of tasks to the processor.
τ3τ2τ1Idle Idle
t1 t2 t3 t4
t
![Page 6: Tasks Periodic The period is the amount of time between each iteration of a regularly repeated task Time driven The task is automatically activated by](https://reader030.vdocuments.site/reader030/viewer/2022032722/56649cf55503460f949c3d78/html5/thumbnails/6.jpg)
Schedule algorithm
Schedule algorithm
PreemptiveThe running task can be
temporarily suspended in the ready queue toexecute a more important task.
Non PreemptiveThe running task cannot besuspended until completion.
![Page 7: Tasks Periodic The period is the amount of time between each iteration of a regularly repeated task Time driven The task is automatically activated by](https://reader030.vdocuments.site/reader030/viewer/2022032722/56649cf55503460f949c3d78/html5/thumbnails/7.jpg)
Schedule Preemptive
t1 t2 t3 t4t
τ1
τ2
τ3
t5
![Page 8: Tasks Periodic The period is the amount of time between each iteration of a regularly repeated task Time driven The task is automatically activated by](https://reader030.vdocuments.site/reader030/viewer/2022032722/56649cf55503460f949c3d78/html5/thumbnails/8.jpg)
Schedule Algorithms Constraints
• Timing constraints– Activation, completion, jitter.
• Precedence constraints– They impose an ordering in the
execution.
• Resource constraints– They enforce a synchronization in the
access of mutually exclusive resources.
![Page 9: Tasks Periodic The period is the amount of time between each iteration of a regularly repeated task Time driven The task is automatically activated by](https://reader030.vdocuments.site/reader030/viewer/2022032722/56649cf55503460f949c3d78/html5/thumbnails/9.jpg)
Some Schedule Algorithms
• First Come First Served• Shortest Job First• Priority Scheduling• Round Robin Not suitable for Real Time!!!!!
![Page 10: Tasks Periodic The period is the amount of time between each iteration of a regularly repeated task Time driven The task is automatically activated by](https://reader030.vdocuments.site/reader030/viewer/2022032722/56649cf55503460f949c3d78/html5/thumbnails/10.jpg)
First Come First Served
• It assigns the CPU to tasks based on their arrival times.– Very unpredictable– Response times strongly depend on task
arrivals.
![Page 11: Tasks Periodic The period is the amount of time between each iteration of a regularly repeated task Time driven The task is automatically activated by](https://reader030.vdocuments.site/reader030/viewer/2022032722/56649cf55503460f949c3d78/html5/thumbnails/11.jpg)
Shortest Job First
• It selects the task with the shortest computation time.
![Page 12: Tasks Periodic The period is the amount of time between each iteration of a regularly repeated task Time driven The task is automatically activated by](https://reader030.vdocuments.site/reader030/viewer/2022032722/56649cf55503460f949c3d78/html5/thumbnails/12.jpg)
Shortest Job First
• Sometimes…is not feasible
![Page 13: Tasks Periodic The period is the amount of time between each iteration of a regularly repeated task Time driven The task is automatically activated by](https://reader030.vdocuments.site/reader030/viewer/2022032722/56649cf55503460f949c3d78/html5/thumbnails/13.jpg)
Priority Scheduling
• Each task is assigned a priority: e.g. [0, 255]- The task with the highest priority is selected for execution.
• - Tasks with the same priority are served FCFS.
• Problem: starvation – low priority tasks may experience long
delays due to the preemption of high priority tasks.
![Page 14: Tasks Periodic The period is the amount of time between each iteration of a regularly repeated task Time driven The task is automatically activated by](https://reader030.vdocuments.site/reader030/viewer/2022032722/56649cf55503460f949c3d78/html5/thumbnails/14.jpg)
Round Robin
• The ready queue is served as FCFS• Each task cannot execute more than
Q time units (Q = time quantum).• When Q expires, the task is put back
in the queue.
CPUτ3τ2τ1
Activation
Q expired
![Page 15: Tasks Periodic The period is the amount of time between each iteration of a regularly repeated task Time driven The task is automatically activated by](https://reader030.vdocuments.site/reader030/viewer/2022032722/56649cf55503460f949c3d78/html5/thumbnails/15.jpg)
Round Robin
• Each task runs as it was executing alone on a virtual processor n times slower than the real one!!!
Q
nQ
![Page 16: Tasks Periodic The period is the amount of time between each iteration of a regularly repeated task Time driven The task is automatically activated by](https://reader030.vdocuments.site/reader030/viewer/2022032722/56649cf55503460f949c3d78/html5/thumbnails/16.jpg)
Real Time Algorithms
– Tasks can be scheduled by • Relative deadlines Di (static)• Absolute deadlines di (dynamic)
t
di
τi
Di
![Page 17: Tasks Periodic The period is the amount of time between each iteration of a regularly repeated task Time driven The task is automatically activated by](https://reader030.vdocuments.site/reader030/viewer/2022032722/56649cf55503460f949c3d78/html5/thumbnails/17.jpg)
Earliest Due Date (EDD)
– It selects the task with the earliest relative deadline. • All tasks arrive simultaneously• Fixed priority (Di is known in advance)• Preemption is not an issue• It minimizes the maximum lateness (Lmax)
![Page 18: Tasks Periodic The period is the amount of time between each iteration of a regularly repeated task Time driven The task is automatically activated by](https://reader030.vdocuments.site/reader030/viewer/2022032722/56649cf55503460f949c3d78/html5/thumbnails/18.jpg)
Earliest Deadline First (EDF)
– It selects the task with the earliest absolute deadline • Tasks may arrive at any time• Dynamic priority (di depends on arrival)• Full preemptive tasks• It minimizes the maximum lateness (Lmax)
![Page 19: Tasks Periodic The period is the amount of time between each iteration of a regularly repeated task Time driven The task is automatically activated by](https://reader030.vdocuments.site/reader030/viewer/2022032722/56649cf55503460f949c3d78/html5/thumbnails/19.jpg)
Earliest Deadline First Example
![Page 20: Tasks Periodic The period is the amount of time between each iteration of a regularly repeated task Time driven The task is automatically activated by](https://reader030.vdocuments.site/reader030/viewer/2022032722/56649cf55503460f949c3d78/html5/thumbnails/20.jpg)
Periodic Tasks Scheduling
– Defining the problem• Each group of tasks has to start after the
period defined. • Each group of tasks has to finish before the
next period come.
![Page 21: Tasks Periodic The period is the amount of time between each iteration of a regularly repeated task Time driven The task is automatically activated by](https://reader030.vdocuments.site/reader030/viewer/2022032722/56649cf55503460f949c3d78/html5/thumbnails/21.jpg)
Cyclic Scheduling
It has been used for 30 years in military systems, navigation, and monitoring systems.
Examples:– Air traffic control– Space Shuttle– Boeing 777
![Page 22: Tasks Periodic The period is the amount of time between each iteration of a regularly repeated task Time driven The task is automatically activated by](https://reader030.vdocuments.site/reader030/viewer/2022032722/56649cf55503460f949c3d78/html5/thumbnails/22.jpg)
Cyclic Scheduling Method
– The time axis is divided in intervals of equal length (time slots).
– Each task is statically allocated in a slot in order to meet the desired request rate.
– The execution in each slot is activated by a timer.
![Page 23: Tasks Periodic The period is the amount of time between each iteration of a regularly repeated task Time driven The task is automatically activated by](https://reader030.vdocuments.site/reader030/viewer/2022032722/56649cf55503460f949c3d78/html5/thumbnails/23.jpg)
Cyclic Scheduling Example
• Specification :– Task A f=40 Hz, T=25 ms– Task B f=20 Hz, T=50 ms– Task C f=10 Hz, T=100 ms
0 ms 25 ms 75 ms50 ms 100 ms
125 ms
175 ms
150 ms
225 ms
200 ms
Λ
Λ Minor Cycle
T
T Major Cycle
Assumptions guaranteed!!!:
CA + CB ≤ Λ
CA + Cc ≤ Λ