170 likes | 372 Views
Introduction to Real-Time Scheduling: Continued. Fred Kuhns Applied Research Laboratory Computer Science Washington University. Introduction. Considerations: schedulability analysis performed static or dynamic schedulability analysis analysis result includes schedule
E N D
Introduction to Real-Time Scheduling: Continued Fred Kuhns Applied Research Laboratory Computer Science Washington University
Introduction • Considerations: • schedulability analysis performed • static or dynamic schedulability analysis • analysis result includes schedule • Scheduling Paradigms • static table-driven - static analysis and schedule • static priority driven - static analysis, no (explicit) schedule, priorities. • dynamic planning based - feasibility check at run-time, schedule produced • dynamic best effort - No feasibility check, attpemts to meet deadlines but no guarantee. CS523 – Operating Systems
Scheduling Algorithms • Most instances, scheduling problem is intractable • Resource constrained scheduling is NP-complete. Precedence constraints agravate the problem. • Heuristics and approximation techniques used to handle tasks with complex requirements. CS523 – Operating Systems
Static Table Driven • Typically applied to systems with safety critical requirements. • Resources preallocated to tasks • Periodic tasks: feasible schedule if and only if there exists a feasible schedule for the Hyperperiod (least common multiple of the periods) • RM or EDF used for relatively simple systems (simple characteristics) CS523 – Operating Systems
Priority-driven Preemptive • Most famous analysis of the problem is Liu and Layland where they described RM and EDF. • single processor, periodic tasks, preemption • RM: static priorities based on period. Optimal among static-priority schemes. • EDF: dynamic priority based on deadline. • May assign priority based on laxity - LLF: Least Laxity First • May assign priority based on any of the tasks parameters CS523 – Operating Systems
Priority Driven • Preemptive scheduling may simplify analysis but overhead needs to be considered. • scheduling algorithm • task dispatcher • context switch overhead CS523 – Operating Systems
Dynamic Planning-based • Focus on dynamic feasibility checks • Must consider worst case execution times, resource requirements, timing constraints, periodic tasks, preemption, precedence constraints, importance levels and fault tolerance • If task arrival times are not known a priori, cannot guarantee performance • Various heuristic algorithms for scheduling tasks in a distributed environment. CS523 – Operating Systems
Dynamic Best-Effort • Used by many systems: system computes task priorities and schedules accordingly. Extensive simulations are used to gain confidence in behavior • May compensate for other priority driven algorithms (EDF and RM) which perform poorly in overload conditions • May use a value function to schedule during overload: maximize sum of task values. May also discard low value tasks • Dynamic scheduling is optimal if it always produces a feasible schedule whenever a clairvoyant algorithm does. CS523 – Operating Systems
Other Issues • Fault tolerance • static: primary and alternate tasks. • static: precomputed contingency schedules to speed recovery • fault-tolerance vs timeliness • Combine dynamic scheduling with imprecise computations to effect tradeoffs CS523 – Operating Systems
Resource Reclaiming • Utilizing unused time: variance in task execution time may result in unused time. • Run time anomalies: when actual computation times of nonpreemptive tasks differ from expected causing unexpected behavior. • Resource reclamation algorithms can improve schedulability of dynamically arriving tasks. CS523 – Operating Systems
RTOS • Primary function areas • Process management and synchronization • Memory management • Interprocess communication • I/O • Categories of RTOS • small proprietary • RT extensions to commercial timesharing systems • research operating systems CS523 – Operating Systems
Small Proprietary OSes • Typically, kernel provides • fast context switch, small size, quick interrupt response time (predictable?), minimize interrupt disable times, memory partitions (no virtual memory, why?), special sequential files (why?) • Timing • bounded execution time of most primitives • real-time clock • priority scheduling mechanism • special alarms and timeout CS523 – Operating Systems
RT Extensions to Commercial OSes • Advanced SW development environments • Problems: • optimized for average case • assigns resources on demand • ignore application specific information • independent CPU scheduling and resource allcoation CS523 – Operating Systems
Research Operating System • Develop extended or new process models • RT synchronization mechanisms • facilitate timing analysis • fault tolerance • multiprocessor or distributed support • real-time micro-kernel CS523 – Operating Systems
Clock Driven • Scheduling time instants: When scheduling decisions are made • clock-driven - instants predefined offline • table-driven - table precomputed offline Scheduling time instants CS523 – Operating Systems
Weighted Round Robin • Round Robin Scheduling - time-sharing systems • Weighted Round Robin: associate weight with each job. • weight w = number of time slices • adjusting weight allocates CPU shares CS523 – Operating Systems
Priority Driven • Work-conserving: The highest priority, runnable job is always dispatched to available CPU • resources are never idle while runnable jobs • Priority list, preemptions and other rules describe algorithm completly • Example algorithms: EDF, FIFO, LIFO etc. • preemption versus non-preemption CS523 – Operating Systems