RealTime System Development Introduction to RealTime Systems cwhsuehcsie

  • Slides: 33
Download presentation
Real-Time System Development 即時系統開發 Introduction to Real-Time Systems 薛智文 cwhsueh@csie. ntu. edu. tw http:

Real-Time System Development 即時系統開發 Introduction to Real-Time Systems 薛智文 cwhsueh@csie. ntu. edu. tw http: //www. csie. ntu. edu. tw/~chsueh/ 95 /5 Fall 國立台灣大學 資訊 程學系

Outline Introduction Real-Time Scheduling Pinwheel Scheduling Conclusion 1/22/2022 1 /5 資 系網媒所 NEWS實驗室

Outline Introduction Real-Time Scheduling Pinwheel Scheduling Conclusion 1/22/2022 1 /5 資 系網媒所 NEWS實驗室

e. Book and e. Learning Tool Architecture e. Learning Platform e. Book Platform Auxiliary

e. Book and e. Learning Tool Architecture e. Learning Platform e. Book Platform Auxiliary Tool e. Learning Auxiliary Tool Physical • Serial • USB • 1394 • Ir. DA • Bluetooth • 802. 11 Teaching AP Peerware AP e. Book Teaching Application Platform e. Book Digital Content Development Tool Teaching/Peer Ware Application Development Tool System Dvelopment Kit Compatibility Testing Kit e. Book OS (Kernel / UI / Communication) Protocol • Sync. ML 1/22/2022 e. Learning Platform Reader SCORM HTML XML e. Book Teaching Digital Content Development Tool e. Book Hardware ICE DDK 2 /5 資 系網媒所 NEWS實驗室

Introduction What is a real-time system? A system enforcing timing constraints, e. g. Avionics,

Introduction What is a real-time system? A system enforcing timing constraints, e. g. Avionics, Missile Control, … Real-Time v. s. High Performance What is a real-time operating system? An operation system enforcing timing constraints, Lynx, p. SOS, Vx. Works. What is a timing constraint? A constraint of timing requirements, e. g. period, distance, deadline, ready time, … 資 系網媒所 NEWS實驗室

Real-Time Application Industrial and automation system Computer networking system Gaming and multimedia Medical instrument

Real-Time Application Industrial and automation system Computer networking system Gaming and multimedia Medical instrument and devices Financial transaction applications Military defense system Security monitoring and response system Data acquisition system Machine vision/translation system 1/22/2022 4 /5 資 系網媒所 NEWS實驗室

Real-Time Systems Value Deadline Soft RTS Hard RTS Firm. RTS Time -Value 1/22/2022 5

Real-Time Systems Value Deadline Soft RTS Hard RTS Firm. RTS Time -Value 1/22/2022 5 /5 資 系網媒所 NEWS實驗室

Real-Time Systems (RTS) Open Distributed Hard RTS Soft RTS Proprietary Centralized Firm RTS Embedded

Real-Time Systems (RTS) Open Distributed Hard RTS Soft RTS Proprietary Centralized Firm RTS Embedded 1/22/2022 6 /5 資 系網媒所 NEWS實驗室

Systems Issues In RTS, the OS and AP are very tightly coupled, than time-sharing

Systems Issues In RTS, the OS and AP are very tightly coupled, than time-sharing systems. shared memory, special buses (instruction, data, event, memory, control, invalidate, …). A RTOS must response to internal and external events deterministically. Low-priority tasks may wait for high-priority task or events indefinitely. System architecture needs to provide high computational speed, high-speed interrupt handling, and high I/O throughput, + faulttolerance. 1/22/2022 7 /5 資 系網媒所 NEWS實驗室

Outline Introduction Real-Time Scheduling Pinwheel Scheduling Conclusion 1/22/2022 8 /5 資 系網媒所 NEWS實驗室

Outline Introduction Real-Time Scheduling Pinwheel Scheduling Conclusion 1/22/2022 8 /5 資 系網媒所 NEWS實驗室

Real-Time Task Model Periodic Task Model parameters are known a priori request time ready

Real-Time Task Model Periodic Task Model parameters are known a priori request time ready time deadline start finish preempt resume period worst-case execution time Predictability vs. Schedulability high predictability and schedulability easy-to-check schedulability condition 1/22/2022 9 /5 資 系網媒所 NEWS實驗室

Distance-Constrained Task Model video server inter-frame distance must be less than 33 ms robot

Distance-Constrained Task Model video server inter-frame distance must be less than 33 ms robot arm movement needs steady and smooth operations satellite/cellular phone tracking service in constant time interval more predictable inter-execution time than the periodic task model worst inter-execution time for periodic tasks is 2‧period-ei 資 系網媒所 1/22/2022 10 /5 NEWS實驗室

Scheduling Approaches Time-Driven Scheduling Approach widely used inflexible, efficient large space needed e. g.

Scheduling Approaches Time-Driven Scheduling Approach widely used inflexible, efficient large space needed e. g. cyclic executive Priority-Driven Scheduling Approach dynamic-priority e. g. earliest deadline first fixed-priority e. g. rate monotonic 1/22/2022 11 /5 資 系網媒所 NEWS實驗室

Periodic Real-Time Schedulers Earliest Deadline First : optimal dynamic-priority scheduler job with earlier deadline

Periodic Real-Time Schedulers Earliest Deadline First : optimal dynamic-priority scheduler job with earlier deadline gets higher priority schedulability condition r (T) = £ 1 Rate Monotonic : optimal fixed-priority scheduler job with smaller period gets higher priority schedulability condition 1/n r (T) £ n (2 - 1) n ∞, ㏑ 2 0. 69 1/22/2022 12 /5 資 系網媒所 NEWS實驗室

Outline Introduction Real-Time Scheduling Pinwheel Scheduling Conclusion 1/22/2022 13 /5 資 系網媒所 NEWS實驗室

Outline Introduction Real-Time Scheduling Pinwheel Scheduling Conclusion 1/22/2022 13 /5 資 系網媒所 NEWS實驗室

Pinwheel Problem Given a multiset A={a 1, a 2, . . . , an},

Pinwheel Problem Given a multiset A={a 1, a 2, . . . , an}, ai N Find an infinite sequence of symbols from {1, 2, . . . , n} such that at least one symbol i within any interval of ai symbols A={2, 3} ® 1 2 1 2. . . ® 1 1 2. . . Similar to finding a unit-time schedule 1/22/2022 14 /5 資 系網媒所 NEWS實驗室

Pinwheel Scheduler Given a multi-set of distance constraints of n tasks A={a 1, a

Pinwheel Scheduler Given a multi-set of distance constraints of n tasks A={a 1, a 2, . . . , an}, density r(A) = Si (1/ai ) Find another B={b 1, b 2, . . . , bn}, "i, bi £ ai , A is schedulable if B is schedulable. If bi’s are multiples (bi|bj) and r(B) £ 1, B is schedulable. E. g. A={3, 4, 6, 7} ®(specialized) B ={3, 3, 6, 6} schedule is “ 1 2 3 1 2 4. . . ” The goal is to minimize density increase 1/22/2022 15 /5 資 系網媒所 NEWS實驗室

Pinwheel Schedule 12 0 11 10 9 T 4 7 T 1 2 T

Pinwheel Schedule 12 0 11 10 9 T 4 7 T 1 2 T 2 8 1 T 3 3 4 5 6 Pinwheel schedule 1/22/2022 T 1 (1, 6) 6666666 T 2 (3, 6) T 3 (2, 12) T 4 (2, 12) 0 1 2 3 4 5 6 7 8 9 10 11 12 16 /5 資 系網媒所 NEWS實驗室

Pinwheel Transformation 2 E. g. A={3, 4, 6, 13} ® {3} B ={3, 3,

Pinwheel Transformation 2 E. g. A={3, 4, 6, 13} ® {3} B ={3, 3, 6, 12} ={3, 3, 3× 21, 3× 22} • single-number reduction A Pinwheel any numbers ® multiples (RM) jitterless, predictable Signal B analog ® digital (PW) 0 1/22/2022 3 6 9 12 noiseless, ease of control e. g. CD music 17 /5 資 系網媒所 NEWS實驗室

Previous Works CX: the set of all instances schedulable by Scheduler x d. X:

Previous Works CX: the set of all instances schedulable by Scheduler x d. X: the schedulable density bound for Scheduler x CS 23 CSa CSbc 1/22/2022 Sa: x=a 1 , d. Sa ³ 0. 5 Sx: a 1 /2 < x £ a 1 , d. Sx ³ 0. 65 S 23: use 2 and 3, d. S 23 ³ 7/12 0. 58 Sbc: b=a 1 , b £ c < 2 b d. Sbc ³ 2/3 0. 67 18 /5 資 系網媒所 NEWS實驗室

Single-node Pinwheel Scheduling Earlier work: use a base of 2 , find x in

Single-node Pinwheel Scheduling Earlier work: use a base of 2 , find x in (a 1/2 , a 1] Sa, Sx, Sbc, Sby, Sxy: 0. 5, 0. 65, 2/3, … distance constraints of integer, unit execution time Sr: use a base of 2 , find r in (a 1/2 , a 1] real-number distance constraints and execution times Our contributions: Srg: use a base of g Srb: try all bases (optimal for single-number reduction) HSr: near-optimal polynomial-time heuristic Integer Pinwheel Scheduling: Sxg, Sxb , HSx 1/22/2022 19 /5 資 系網媒所 NEWS實驗室

Various Pinwheel Schedulers 1/22/2022 20 /5 資 系網媒所 NEWS實驗室

Various Pinwheel Schedulers 1/22/2022 20 /5 資 系網媒所 NEWS實驗室

Synchronous Scheduling Intranode: pinwheel scheduling makes task executions regular and predictable, i. e. no

Synchronous Scheduling Intranode: pinwheel scheduling makes task executions regular and predictable, i. e. no jitter. Internode: in all nodes, transform the periods of all tasks to harmonic numbers so that tasks of the same period are synchronized. The worst case delay for a task between its arrival and the beginning of its execution on a node is one period. Nodej N 1 N 2 . . . Nm . . . 1/22/2022 21 /5 資 系網媒所 NEWS實驗室

Simplification 1/22/2022 24 /5 資 系網媒所 NEWS實驗室

Simplification 1/22/2022 24 /5 資 系網媒所 NEWS實驗室

Study of Pinwheel Scheduling n tasks are schedulable on a node (using HSr) 1/n

Study of Pinwheel Scheduling n tasks are schedulable on a node (using HSr) 1/n if the total utilization is £ n (2 - 1). n tasks are schedulable on all nodes (using DSr) 1/n-1 if the utilization on any node is £ 2. Algorithm of O (n log n + nl) to minimize the total or maximum task delay between two nodes with l different periods. Algorithm of O (mn log n + mnl) to minimize the total end-to-end delay on m nodes. Polynomial heuristics to reduce the maximum end-to-end delay on m nodes. 資 系網媒所 1/22/2022 25 /5 NEWS實驗室

Pinwheel Scheduling Properties Good jitter control in schedules Easy-to-check schedulability Predictable resource accesses Easy

Pinwheel Scheduling Properties Good jitter control in schedules Easy-to-check schedulability Predictable resource accesses Easy extension for aperiodic tasks Predictable end-to-end delay Network scheduling (INFOCOM’ 95 by Han & Shin) Flexible time-driven approach 資 系網媒所 NEWS實驗室

Time-driven Scheduling Approach on-line approach execute tasks according to off-line generated schedule or parameters

Time-driven Scheduling Approach on-line approach execute tasks according to off-line generated schedule or parameters more flexible 0 off-line approach 3 6 construct complete schedule exponential time and space generate effective time parameters start time, resume time, finish time optimization 資 系網媒所 NEWS實驗室

SSr: Pinwheel Schedule Constructor Generate start times and finish times in 5. 3 10.

SSr: Pinwheel Schedule Constructor Generate start times and finish times in 5. 3 10. 6 15. 9 21. 2 O(n 02) task 1 task 2 task 3 task 4 task 5 資 系網媒所 NEWS實驗室

Time-Driven Pinwheel Scheduling Generate effective pinwheel schedule. Generate start times and finish times using

Time-Driven Pinwheel Scheduling Generate effective pinwheel schedule. Generate start times and finish times using SSr Next resume time can be found in O(n) the latest finish time of the preempting tasks task 1 task 2 task 3 task 4 Use an on-line scheduler to schedule tasks according to the effect schedule. 資 系網媒所 NEWS實驗室

TOPS: Time-driven On-line Pinwheel Scheduler *S: start time, F: finish time, R: resume time;

TOPS: Time-driven On-line Pinwheel Scheduler *S: start time, F: finish time, R: resume time; * * amortized 資 系網媒所 NEWS實驗室

Comparison of Schedulers *for higher priority tasks 資 系網媒所 NEWS實驗室

Comparison of Schedulers *for higher priority tasks 資 系網媒所 NEWS實驗室

Designing Real-Time Applications Performance Requirement where the AP can be tested. timing constraints, resolution.

Designing Real-Time Applications Performance Requirement where the AP can be tested. timing constraints, resolution. Precise Functionality which functionalities in which programs locked in memory for high-priority process Required interprocess communication shared memory fastest, waste memory synchronization mechanism 1/22/2022 32 /5 資 系網媒所 NEWS實驗室