370 likes | 536 Views
Hardware/Software Co-design Embedded & Real-Time System Scheduling & Performance Estimation. Advisor: Sao-Jie Chen Member: 黃佩菁 P92921009 蔡勝中 P92943005. Outline. A Co-design framework Partitioning and Mapping Scheduling criteria Scheduling algorithms
E N D
Hardware/Software Co-designEmbedded & Real-Time SystemScheduling & Performance Estimation Advisor: Sao-Jie Chen Member: 黃佩菁 P92921009 蔡勝中 P92943005
Outline • A Co-design framework • Partitioning and Mapping • Scheduling criteria • Scheduling algorithms • Performance estimation • WCET Analysis • ILP Method • Conclusion
Co-design Framework System description Compiler System behavior Validation Partitioning & Mapping Partitioned specification Performance Estimation Evaluation SW synthesis Interface synthesis HW synthesis Prototype
Outline • A Co-design framework • Partitioning and Mapping • Scheduling criteria • Scheduling algorithms • Performance estimation • WCET Analysis • ILP Method • Conclusion
P1 P2 P3 P5 P4 Task 1 Task 2 P1 P5 P2 P3 PE1 PE2 P4 PE3 Partitioning and Mapping • Period / Deadline of each task • Process dependencies in tasks • PEs: CPU, DSP, ASIC, ... • Allocation: Processes -> PEs • Scheduling: Priorities -> Processes
Outline • A Co-design framework • Partitioning and Mapping • Scheduling criteria • Scheduling algorithms • Performance estimation • WCET Analysis • ILP Method • Conclusion
Scheduling Criteria • CPU utilization Keep CPU as busy as possible • Throughput Number of processes that complete their execution per time unit • Turnaround time Amount of time to execute a particular process • Waiting time Amount of time a process has been waiting in the ready queue • Response time Amount of time it takes from when a request was submitted until the first response is produced, not output
Outline • A Co-design framework • Partitioning and Mapping • Scheduling criteria • Scheduling algorithms • Performance estimation • WCET Analysis • ILP Method • Conclusion
Scheduling Algorithms • FCFS scheduling algorithm • SJF scheduling algorithm • EDF scheduling algorithm • RR scheduling algorithm • Priority scheduling algorithm • Multilevel queue scheduling algorithm • RM scheduling algorithm
Fist-Come, First-Served Scheduling • The process that requests the CPU first is allocated the CPU first. • FCFS scheduling is not real time scheduling • Case where FCFS request in a failure • Process 1: execution time = 4, t6 deadline • Process 2: execution time = 2, t4 deadline
Scheduling Algorithms • FCFS scheduling algorithm • SJF scheduling algorithm • EDF scheduling algorithm • RR scheduling algorithm • Priority scheduling algorithm • Multilevel queue scheduling algorithm • RM scheduling algorithm
Shortest-Job-First Scheduling • The process that request less CPU burst is allocated the CPU first. • Case where SJF request in a failure • Process 1: execution time = 2 , t4 deadline • Process 2: execution time = 4 , t5 deadline
Scheduling Algorithms • FCFS scheduling algorithm • SJF scheduling algorithm • EDF scheduling algorithm • RR scheduling algorithm • Priority scheduling algorithm • Multilevel queue scheduling algorithm • RM scheduling algorithm
Earliest-Deadline-First Scheduling • The process that have earlier deadline is have higher priority. Priority is determined by deadline. • Case where EDF results in a failure • Process 1: execution time = 2 , t4 deadline • Process 2: execution time = 4 , t5 deadline
Scheduling Algorithms • FCFS scheduling algorithm • SJF scheduling algorithm • EDF scheduling algorithm • RR scheduling algorithm • Priority scheduling algorithm • Multilevel queue scheduling algorithm • RM scheduling algorithm
Round-Robin Scheduling • Each process is assigned a time interval • If the process is still running at the end of the quantum, the CPU is preempted and given to another process • Issue – length of the quantum • Too short will cause too many process switches and lowers the CPU efficiency • Too long will cause poor response to short interactive request.
Scheduling Algorithms • FCFS scheduling algorithm • SJF scheduling algorithm • EDF scheduling algorithm • RR scheduling algorithm • Priority scheduling algorithm • Multilevel queue scheduling algorithm • RM scheduling algorithm
Priority Scheduling • Each process is assigned priority, and the runable process with the highest priority is allowed to run. • Priorities assign algorithms are classified as fixed priority, dynamic priority, or mixed priority.
Scheduling Algorithms • FCFS scheduling algorithm • SJF scheduling algorithm • EDF scheduling algorithm • RR scheduling algorithm • Priority scheduling algorithm • Multilevel queue scheduling algorithm • RM scheduling algorithm
Multilevel queue Scheduling • Ready queue is partitioned into separate queues: Foreground and background • Each queue has its own scheduling algorithm • Foreground – RR, higher priority • Background - FCFS
Scheduling Algorithms • FCFS scheduling algorithm • SJF scheduling algorithm • EDF scheduling algorithm • RR scheduling algorithm • Priority scheduling algorithm • Multilevel queue scheduling algorithm • RM scheduling algorithm
Rate-Monotonic Scheduling • RMS is the optimal fixed-priority algorithm • The shorter period, the higher priority • If a task set cannot be scheduled using the RM algorithm, it cannot be scheduled using any fixed-priority algorithm • The deadlines of n processes can be met if the processor utilization: U: Processor utilization n: the number of tasks in a system Ci: Computation time Pi: Process
Outline • A Co-design framework • Partitioning and Mapping • Scheduling criteria • Scheduling algorithms • Performance estimation • WCET Analysis • ILP Method • Conclusion
Performance Estimation • How to estimation embedded software performance? • Simulate • Estimate • The importance of Worst-Case Execution Time (WCET) in embedded systems • Simple architecture • Instruction execution time is fixed • Cached architecture • Two possible execution times – cache and miss
Outline • A Co-design framework • Partitioning and Mapping • Scheduling criteria • Scheduling algorithms • Performance estimation • WCET Analysis • ILP Method • Conclusion
WCET Analysis • WCET solutions • find the longest path and sum up each instruction’s time • cache miss, pipeline stall, etc, make an instruction time vary. Take them into account and sum up the modified instruction’s time • WCET analysis can be divided into two components: • Program Path Determines the sequence of instructions to be executed in the worst-case scenario. • Microarchitecture modeling Models the underlying hardware systems and computes the WCET of a known sequence of instructions.
Outline • A Co-design framework • Partitioning and Mapping • Scheduling criteria • Scheduling algorithms • Performance estimation • WCET Analysis • ILP Method • Conclusion
ILP Method • Integer linear programming (ILP) method • Basic Block • ILP formulation
ILP Method - Basic Block • Basic block • Only have straight-line sequence of instructions
ILP Formulation • If we let variable xibe the execution count of a basic block Bi, and constant cibe the execution time of the basic block, then the total execution time of the program is given as where N is the number of basic blocks in the program. note:ximust be integer values
Outline • A Co-design framework • Partitioning and Mapping • Scheduling criteria • Scheduling algorithms • Performance estimation • WCET Analysis • ILP Method • Conclusion
Conclusion • Limitation of fixed-priority scheduling is that it is not always possible to fully utilize the CPU • Scheduling Algorithms will effect embedded real time system performance • Estimated must be tight • Embedded software is hot in the feature no matter O.S or App.
Reference • Krithi Ramamritham and Jonh Stankovic, “Scheduling Algorithms and Operating System Support for Real-Time System,” Proceedings of the IEEE, Volume 82, No.1, January 1994, P.55-65 • Y.-T. S. Li, S. Malik, and A. Wolfe, “Performance estimation of embedded software with instruction cache modeling,” ACM Transactions on Design Automation of Electronic Systems 4, no. 3 (July 1999) • Jochen Liedtke, “Toward real microkernels,” ACM Transaction on Communications, Volume 39 Issue 9 • Harbour, M.G.; Klein, M.H.; Lehoczky, J.P., “Timing analysis for fixed-priority scheduling of hard real-time systems,” Software Engineering, IEEE Transactions on , Volume: 20 , Issue: 1 , Jan. 1994 Pages:13 – 28
Reference • Ti-Yen Yen; Wolf, W., “Performance estimation for real-time distributed embedded systems,” Parallel and Distributed Systems, IEEE Transactions on , Volume: 9 , Issue: 11 , Nov. 1998 • C. L. Liu, James W. Layland, “Scheduling Algorithms for Multiprogramming in a Hard-Real-Time Environment,” Journal of the ACM (JACM), Volume 20 Issue 1, Jan. 1973 • Engblom, J.; Ermedahl, A., “Modeling complex flows for worst-case execution time analysis,” Real-Time Systems Symposium, 2000. Proceedings. The 21st IEEE , 27-30 Nov. 2000