170 likes | 218 Views
Telvis Calhoun CSc 8320. Real Time Scheduling. Outline. Introduction Real-Time Scheduling Overview Tasks, Jobs and Schedules Rate/Deadline Monotonic Deferrable Scheduling [Xiong, 2005] Real-Time Synchronization Priority Inheritance/Priority Ceiling Protocols. Introduction.
E N D
Telvis Calhoun CSc 8320 Real Time Scheduling
Outline • Introduction • Real-Time Scheduling Overview • Tasks, Jobs and Schedules • Rate/Deadline Monotonic • Deferrable Scheduling [Xiong, 2005] • Real-Time Synchronization • Priority Inheritance/Priority Ceiling Protocols
Introduction • Real-Time systems include: • Automotive control systems • Telecommunications • Industrial Process Control • Real-Time Systems impose temporal consistency constraints • Database must “closely” represent the real-time system in real time. • Value of data decreases with time.
Hard Real Time vs. Soft Real Time [McObject, 2006] Critical real-time systems such as nuclear power plants or fly-by-wire airplanes are Hard Real Time Non-critical real time systems where missed transactions only degrade system quality are Soft Real Time Firm real-time systems are similar to soft real-time, except late tasks are discarded. Scheduling algorithm depends on real time system characteristics
Tasks, Jobs and Schedules Aperiodic tasks arrive at the system at arbitrary times. Periodic tasks have predictable arrival, execution times and deadlines. Each task executes a job or performs some function in the real-time system. A real-time schedule assigns tasks to the CPU in order to satisfy the system temporal constraints.
Rate Monotonic Simplest type of real-time scheduling Tasks are periodic Tasks do not communicate with each other Tasks are scheduled according to fixed priorities Calculates the critical instant for each task. Task completion time considering all other higher priority tasks. If a tasks deadline is scheduled at the critical instant, the task always meets its deadline.
Deadline Monotonic Tasks are assigned priority Tasks with shortest deadline get the highest priority. Cannot guarantee a feasible schedule NOT optimal for fixed priority non-pre-emptive scheduling
Deferrable Scheduling for Fixed Priority Systems [Xiong, 2005] Goal: Actively schedule the maximum time between periodic sensor updates to minimize energy consumption. Target System: Process control systems that require continuous sensor updates
DS: Definitions Validity interval: Time that a data item is considered fresh after an update transaction. Response Time: Time required to retrieve data from a sensor. Transaction Deadline: Time when a transaction must be complete
DS: Basic Algorithm Set the update transaction deadline (d) to be the end of the validity interval. The transaction start time is derived backward from the deadline using the known response time (r).
DS: Basic Algorithm cont. Adjust the schedule for high priority preemption. Construct a hyper-period that executes the schedule repeatedly to decrease scheduling overhead. [Xiong, 2005]
Real-Time Synchronization Tasks cooperate and share resources in a pre-emptive, priority-based environment. Tasks may be synchronized using traditional mutexes or semaphores. Potential Issues Priority Inversion – A situation in which a higher priority job is blocked by lower priority jobs for an indefinite period of time [Sha, 1990] Chain Blocking – A situation in which a high priority task is blocked for more than one lock due to more than one lower priority task. [Sha, 1990]
Priority Inversions [Netrino, 2007] • Low priority task is using a shared resource. • A medium-priority task preempts the lower-priority task. • If the higher-priority task is otherwise ready to run, but a medium-priority task is currently running instead, a priority inversion is said to occur.
Priority Inheritance and Priority Ceiling protocols [SHA, 1990] • Priority Inheritance Protocol (PIP) • Eliminates priority inversion problems • The algorithm will increase the priority of a task to the maximum priority of any task waiting for any resource the task has a resource lock on. • Priority Ceiling Protocol (PCP) • Each resource is assigned a priority ceiling, which is a priority equal to the highest priority of any task which may lock the resource.
Hardware Support for Priority Inheritance [Akgul, 2003] • SoCLC: System-on-a-Chip Lock Cache • Reduces on-chip memory traffic, provides • A fair and fast lock hand-off, simplifies software, increases • The real-time predictability of the system and improves performance. • PIP Implemented in an RTOS
References Chow, Randy, et. al.,Distributed Operating Systems & Algorithms, Addison Wesley, March 18, 1997 McObject LLC, “Real-time Databases for Embedded Systems”, Precision Data Management, 2006 M. Xiong, S. Han and K.Y. Lam, ”A Deferrable Scheduling Algorithm for Real-Time Transactions Maintaining Data Freshness,” IEEE Real-Time Systems Symposium, 2005. http://www.netrino.com/Publications/Glossary/PriorityInversion.php, 2007 Sha, L.; Rajkumar, R.; Lehoczky, J.P.; Priority inheritance protocols: an approach to real-time synchronization, Computers, IEEE Transactions on Volume 39, Issue 9, Sept. 1990 Page(s):1175 – 1185 Akgul, B.E.S.; Mooney III, V.J.; Thane, H.; Kuacharoen, P.; Hardware support for priority inheritance, Real-Time Systems Symposium, 2003. RTSS 2003. 24th IEEE 2003 Page(s):246 - 255