Presentation is loading. Please wait.

Presentation is loading. Please wait.

Enforcing Real-Time Behavior I

Similar presentations


Presentation on theme: "Enforcing Real-Time Behavior I"— Presentation transcript:

1 Enforcing Real-Time Behavior I
Chris Gill, James Orr, and Son Dinh CSE 522S - Advanced Operating Systems Washington University in St. Louis St. Louis, MO 63130

2 Uniprocessor Real-Time Systems
Each task τi is modeled as cyclic process, with period Ti, deadline Di, and computation time Ci Ex: Task τ1 T1=D1=5, C1=4 Goal: meet all tasks’ deadlines Time τ1 5 10 15 C. Liu, and J. Layland, “Scheduling Algorithms for Multiprogramming in a Hard Real-Time Environment,” Journal of the ACM 20(1), January 1973. CSE 522S – Advanced Operating Systems

3 Uniprocessor Real-Time Systems
Task τi utilization Ui=Ci/Ti is % of processor to schedule a task Can schedule task sets with total utilization up to (e.g., earliest-deadline first, or with rate monotonic if harmonic) Taskset 1 Taskset 2 Task Ci Ti=Di Ui τ1 2 10 0.20 τ2 6 20 0.30 τ3 7 14 0.50 Task Ci Ti=Di Ui τ1 3 12 0.25 τ2 7 20 0.35 τ3 40 0.50 1.00 1.10 C. Liu, and J. Layland, “Scheduling Algorithms for Multiprogramming in a Hard Real-Time Environment,” Journal of the ACM 20(1), January 1973. CSE 522S – Advanced Operating Systems

4 Real-Time Terminology
Release time is when a job of a task is ready Start time is when a job is first scheduled Response time is completion minus release Sometimes also called “response latency” Execution time is sum of scheduled intervals Jitter is the variation in any one of those Higher priority job may preempt running one Τ1,1 Τ2,1 Τ1,1 Time released resumed preempted completed CSE 522S – Advanced Operating Systems

5 CSE 522S – Advanced Operating Systems
Scheduling Classes Linux schedulers are implemented as different scheduling classes Normal: SCHED_IDLE: lowest priority scheduler SCHED_BATCH: low priority, non-interactive CFS tasks SCHED_NORMAL: regular, interactive CFS tasks Real-time: SCHED_RR: round-robin SCHED_FIFO: first-in, first-out SCHED_DEADLINE: earliest deadline first (rt-preempt) CSE 522S – Advanced Operating Systems

6 CSE 522S – Advanced Operating Systems
SCHED_RR Round-robin scheduling Among tasks of equal priority: Rotate through all tasks Each task gets a fixed time slice Cannot run if higher priority tasks are runnable Task 1 Task 2 Task 3 Time CSE 522S – Advanced Operating Systems

7 CSE 522S – Advanced Operating Systems
SCHED_FIFO First-in, First-out scheduling The first enqued task of highest priority executes to completion A task will only relinquish a processor when it completes, yields, or blocks Task 1 Task 2 Task 3 Time CSE 522S – Advanced Operating Systems

8 CSE 522S – Advanced Operating Systems
SCHED_DEADLINE Earliest Deadline First (EDF) scheduling Whichever task has next deadline gets to run Theory exists to analyze such systems Linux implements bandwidth reservation to prevent deadline abuse Task 3 Deadline: 8 Exec time: 2 Task 2 Deadline: 12 Exec time: 3 Task 1 Deadline: 5 Exec time: 4 Time 0 Task 1 Task 2 Task 3 5 8 12 CSE 522S – Advanced Operating Systems

9 Periodic Real-Time Tasks on Linux
Threads wake up, run task code, suspend Thread per priority level may work for FIFO Thread per task may be needed for RR, DEADLINE Timers expire, wake threads, reschedule Number of timers needed depends on granularity of differences in task release times A single timer can keep a “wheel” of release times Task 1 Task 2 Task 3 5 10 15 CSE 522S – Advanced Operating Systems


Download ppt "Enforcing Real-Time Behavior I"

Similar presentations


Ads by Google