© Andy Wellings, 2004 Roadmap  Introduction  Concurrent Programming  Communication and Synchronization  Completing the Java Model  Overview of the.

Slides:



Advertisements
Similar presentations
Real Time Scheduling.
Advertisements

EE5900 Advanced Embedded System For Smart Infrastructure
Introduction to Embedded Systems Resource Management - III Lecture 19.
Real-Time Systems and Programming Languages © Alan Burns and Andy Wellings Chapter 12: Programming Schedulable Systems.
Priority INHERITANCE PROTOCOLS
© Andy Wellings, 2004 Roadmap  Introduction  Concurrent Programming  Communication and Synchronization  Completing the Java Model  Overview of the.
Concurrency Important and difficult (Ada slides copied from Ed Schonberg)
Scheduling Theory ITV Real-Time Systems Anders P. Ravn Aalborg University March 2007.
Programming R-T Abstractions TSW November 2009 Anders P. Ravn Aalborg University.
© Andy Wellings, 2004 Roadmap  Introduction  Concurrent Programming  Communication and Synchronization  Completing the Java Model  Overview of the.
© Andy Wellings, 2004 Roadmap  Introduction  Concurrent Programming  Communication and Synchronization  Completing the Java Model  Overview of the.
© Andy Wellings, 2004 Roadmap  Introduction  Concurrent Programming  Communication and Synchronization  Completing the Java Model  Overview of the.
© Andy Wellings, 2004 Roadmap  Introduction  Concurrent Programming  Communication and Synchronization  Completing the Java Model  Overview of the.
Scheduling Theory ITV Multiprogramming and Real-Time Programs Anders P. Ravn Aalborg University May 2009.
© Andy Wellings, 2004 Roadmap  Introduction  Concurrent Programming  Communication and Synchronization  Completing the Java Model  Overview of the.
Introduction to Operating Systems – Windows process and thread management In this lecture we will cover Threads and processes in Windows Thread priority.
© Andy Wellings, 2003 Roadmap  Introduction  Concurrent Programming  Communication and Synchronization  Completing the Java Model  Overview of the.
Chapter 11 Operating Systems
© Andy Wellings, 2004 Roadmap  Introduction  Concurrent Programming  Communication and Synchronization  Completing the Java Model  Overview of the.
Enhancing the Platform Independence of the Real-Time Specification for Java Andy Wellings, Yang Chang and Tom Richardson University of York.
By Group: Ghassan Abdo Rayyashi Anas to’meh Supervised by Dr. Lo’ai Tawalbeh.
CprE 458/558: Real-Time Systems
© Andy Wellings, 2004 Roadmap  Introduction  Concurrent Programming  Communication and Synchronization  Completing the Java Model  Overview of the.
© Andy Wellings, 2004 Roadmap  Introduction  Concurrent Programming  Communication and Synchronization  Completing the Java Model  Overview of the.
EMBEDDED SOFTWARE Team victorious Team Victorious.
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 15 Slide 1 Real-time Systems 1.
Real-Time Software Design Yonsei University 2 nd Semester, 2014 Sanghyun Park.
Collage of Information Technology University of Palestine Advanced programming MultiThreading 1.
Real-Time Java Martin Schöberl. Real Time Java2 Overview What are real-time systems Real-time specification for Java RTSJ issues, subset Real-time profile.
1 Previous lecture review n Out of basic scheduling techniques none is a clear winner: u FCFS - simple but unfair u RR - more overhead than FCFS may not.
Lecture 2 Process Concepts, Performance Measures and Evaluation Techniques.
Scheduling policies for real- time embedded systems.
Instructore: Tasneem Darwish1 University of Palestine Faculty of Applied Engineering and Urban Planning Software Engineering Department Concurrent and.
Enhancements to Java for Real Time Systems Theresa Dsena CSE Fall 2006 Prof. Ganesan.
Reference: Ian Sommerville, Chap 15  Systems which monitor and control their environment.  Sometimes associated with hardware devices ◦ Sensors: Collect.
Prepare by : Ihab shahtout.  Overview  To give an overview of fixed priority schedule  Scheduling and Fixed Priority Scheduling.
Instructore: Tasneem Darwish1 University of Palestine Faculty of Applied Engineering and Urban Planning Software Engineering Department Concurrent and.
EEL The Real-Time Specification for Java (1)
Copyright ©: Nahrstedt, Angrave, Abdelzaher1 Scheduling II: priority scheduling.
EEL Real-time Java part 2. EEL Acknowledgements All the lecture slides were adopted from the slides of Andy Wellings.
Real-time Software Design King Saud University College of Computer and Information Sciences Department of Computer Science Dr. S. HAMMAMI.
CSCI1600: Embedded and Real Time Software Lecture 24: Real Time Scheduling II Steven Reiss, Fall 2015.
Real time scheduling G.Anuradha Ref:- Stallings. Real time computing Correctness of the system depends not only on the logical result of computation,
Introduction to Embedded Systems Rabie A. Ramadan 5.
CSCI1600: Embedded and Real Time Software Lecture 23: Real Time Scheduling I Steven Reiss, Fall 2015.
Thread Scheduling and Dispatching Maung Aung Han Marc E. Loy Jihua Zhong CIS 642: Seminar in Real-time Systems Instructor: Professor Insup Lee.
Introduction to Real-Time Systems
Real-Time Operating System Design
For a good summary, visit:
Silberschatz, Galvin and Gagne ©2011 Operating System Concepts Essentials – 8 th Edition Chapter 2: The Linux System Part 3.
Multithreading & Synchronized Algoritma Pemrograman 3 Sistem Komputer – S1 Universitas Gunadarma 1.
11 G53SRP: Feasibility analysis Chris Greenhalgh School of Computer Science.
1.  System Characteristics  Features of Real-Time Systems  Implementing Real-Time Operating Systems  Real-Time CPU Scheduling  An Example: VxWorks5.x.
Undergraduate course on Real-time Systems Linköping University TDDD07 Real-time Systems Lecture 2: Scheduling II Simin Nadjm-Tehrani Real-time Systems.
© Andy Wellings, 2004 Thread Priorities I  Although priorities can be given to Java threads, they are only used as a guide to the underlying scheduler.
Agenda  Quick Review  Finish Introduction  Java Threads.
1 G53SRP: Introduction to Real Time Scheduling Chris Greenhalgh School of Computer Science.
Embedded Real-Time Systems Processing interrupts Lecturer Department University.
Real-Time Operating Systems RTOS For Embedded systems.
Real-time Software Design
REAL-TIME OPERATING SYSTEMS
Wayne Wolf Dept. of EE Princeton University
G53SRP: Real Time Threads in RTSJ (part I)
Real-time Software Design
G53SRP: Asynchronous Events in RTSJ
G53SRP: Resource Sharing Issues
CSCI1600: Embedded and Real Time Software
Multithreading.
Multithreaded Programming
Real Time Java : Synchronization
Presentation transcript:

© Andy Wellings, 2004 Roadmap  Introduction  Concurrent Programming  Communication and Synchronization  Completing the Java Model  Overview of the RTSJ  Memory Management  Clocks and Time  Scheduling and Schedulable Objects  Asynchronous Events and Handlers  Real-Time Threads  Asynchronous Transfer of Control  Resource Control  Schedulability Analysis  Conclusions

© Andy Wellings, 2004 Scheduling and Schedulable Objects Lecture aims:  To give an overview of fixed priority schedule  To present the RTSJ Basic Scheduling Model

© Andy Wellings, 2004 Introduction  Real-time systems must be able to interact with their environment in a timely and predictable manner  Designers must engineer analysable systems whose timing properties can be predicted and mathematically proven correct  Scheduling is the ordering of thread/process executions so that the underlying hardware resources (processors, networks, etc.) and software resources (shared data objects) are efficiently and predictably used

© Andy Wellings, 2004 Scheduling  In general, scheduling consists of three components  an algorithm for ordering access to resources (scheduling policy)  an algorithm for allocating the resources (scheduling mechanism)  a means of predicting the worst-case behaviour of the system when the policy and mechanism are applied (schedulability analysis or feasibility analysis)  Once the worst-case behaviour of the system has been predicted, it can be compared with the system ’ s timing requirements to ensure that all deadlines will be met

© Andy Wellings, 2004 Fixed Priority Scheduling: Policy  FPS requires  statically allocating schedulable objects to processors  ordering the execution of schedulable objects on a single processor according to a priority  assigning priorities to schedulable objects at their creation time — although no particular priority assignment algorithm is mandated by FPS, it is usual to assign priorities according to the relative deadline of the schedulable object (relative to the schedulable object ’ s release time); the shorter the deadline, the higher the priority  priority inheritance when accessing resources

© Andy Wellings, 2004 FPS: Mechanism and Analysis  Mechanism: FPS requires pre-emptive priority-based dispatching of processes — the processing resource is always given to the highest priority runnable schedulable object (allocated to that processor)  Feasibility analysis: There are many different techniques for analyzing whether a fixed priority-based system will meet its deadlines. Perhaps the most flexible is response time analysis

© Andy Wellings, 2004 Information Needed for Analysis  Most approaches view the system as consisting of a number of schedulable objects  Each schedulable object is characterized by its  release profile  processing cost per release  other hardware resources needed per release  software resources per release  deadline  value

© Andy Wellings, 2004 Release Profile  Typically after a schedulable object is started, it waits to be released (or may be release immediately)  When released it performs some computation and then waits to be released again (its completion time)  The release profile defines the frequency with which the releases occur; they may be time triggered (periodic) or event triggered  Event triggered releases are further classified into sporadic (meaning that they are irregular but with a minimum inter- arrival time) or aperiodic (meaning that no minimum inter- arrival assumptions can be made)

© Andy Wellings, 2004 Processing cost per release  This is some measure of how much of the processor ’ s time is required to execute the computation associated with the schedulable object ’ s release  This may be a worst-case value or an average value depending on the feasibility analysis

© Andy Wellings, 2004 Other resources  Hardware: (other than the processor)  For networks, it is usually the time needed or bandwidth required to send the schedulable objects ’ messages across the network  For memory, it is the amount of memory required by the schedulable objects (and if appropriate, the types of memory).  Software resources: a list of the non shareable resources that are required and the cost of using each resource  Access to non-shareable resources is a critical factor when performing schedulability analysis  Non shareable resources are usually non pre-emptible. Consequently when a schedulable object tries to acquire a resource it may be blocked if that resource is already in use  This blocking time has to be taken into account in any

© Andy Wellings, 2004 Deadline  The time which the schedulable object has to complete the computation associated with each release  As usually only a single deadline is given, the time is a relative value rather than an absolute value

© Andy Wellings, 2004 Value  A metric which indicates the schedulable objects contribution to the overall functionality of the application. It may be  a very coarse indication (such as safety critical, mission critical, non critical),  a numeric value giving a measure for a successful meeting of a deadline, or  a time-valued function which takes the time at which the schedulable object completes and returns a measure of the value (for those systems where there is no fixed deadline)

© Andy Wellings, 2004 Online versus Off-line Analysis  A key characteristic of schedulability (feasibility) analysis is whether the analysis is performed off-line or on-line  For safety critical systems, where the deadlines associated with schedulable objects must always be met, off-line analysis is essential  Other systems do not have such stringent timing requirements or do not have a predictable worst case behavior; here, on-line analysis may be appropriate or, the only option available  These systems must be able to tolerate schedulable objects not being schedulable and offer degraded services  Furthermore, they must be able to handle deadlines being missed or situations where the assumed worst-case loading scenario has been violated

© Andy Wellings, 2004 The RTSJ Basic Model  The RTSJ provides a framework from within which on-line feasibility analysis of priority-based systems can be performed for single processor systems  The specification also allows the real-time JVM to monitor the resources being used and to fire asynchronous event handlers if those resources go beyond that specified by the programmer  The RTSJ introduces the notion of a schedulable object rather than considering just threads  A schedulable object is any object which implements the Schedulable interface

© Andy Wellings, 2004 Schedulable Objects Attributes I  ReleaseParameters  the processing cost for each release  its deadline  if the object is periodic or sporadic then an interval is also given  event handlers can be specified for the situation where the deadline is missed or the processing resource consumed is greater than the cost specified  There is no requirement to monitor the processing time consumed by a schedulable object

© Andy Wellings, 2004 Schedulable Objects Attributes II  SchedulingParameters  an empty class  subclasses allow the priority of the object to be specified and, potentially, its importance to the overall functioning of the application  although the RTSJ specifies a minimum range of real- time priorities (28), it makes no statement on the allowed values of the importance parameter

© Andy Wellings, 2004 Schedulable Objects Attributes III  MemoryParameters  the maximum amount of memory used by the object in an associated memory area  the maximum amount of memory used in immortal memory  a maximum allocation rate of heap memory.  ProcessingGroupParameters  allows several schedulable objects to be treated as a group and to have an associated period, cost and deadline It should be noted that the RTSJ makes no mention of blocking time in any of the parameters associated with schedulable objects

© Andy Wellings, 2004 The Schedulable Interface Three groups of methods  Methods which will communicate with the scheduler and will result in the scheduler either adding or removing the schedulable object from the list of objects it manages, or changing the parameters associated with the schedulable object  the scheduler performs a feasibility test on the objects it manages  Methods which get or set the parameter classes associated with the schedulable object  If the parameter object set is different from the one currently associated with the schedulable object, the previous value is lost and the new one will be used in any future feasibility analysis performed by the scheduler  Methods which get or set the scheduler

© Andy Wellings, 2004 Schedulable Interface I package javax.realtime; public interface Schedulable extends Runnable { // example method resulting in feasibility being tested public boolean addIfFeasible(); public boolean addToFeasibility(); public boolean removeFromFeasibility(); public boolean setIfFeasible( ReleaseParameters release, MemoryParameters memory); public boolean setIfFeasible(ReleaseParameters release, MemoryParameters memory, ProcessingGroupParamters groupParameters); public boolean setReleaseParametersIfFeasible( ReleaseParameters release); public boolean setSchedulingParametersIfFeasible( SchedulingParameters sched);

© Andy Wellings, 2004 Schedulable Interface II // methods which get/set the various parameter classes public MemoryParameters getMemoryParameters(); public void setMemoryParameters(MemoryParameters memory); public ProcessingGroupParameters getProcessingGroupParameters(); public void setProcessingGroupParameters( ProcessingGroupParameters groupParameters); public ReleaseParameters getReleaseParameters(); public void setReleaseParameters(ReleaseParameters release); public SchedulingParameters getSchedulingParameters(); public void setSchedulingParameters( SchedulingParameters sched);

© Andy Wellings, 2004 Schedulable Interface III // methods which get or set the scheduler public Scheduler getScheduler(); public void setScheduler(Scheduler scheduler); public void setScheduler(Scheduler scheduler, SchedulingParameters scheduling, ReleaseParameters release, MemoryParameters memory, ProcessingGroupParameters processing); } Both real-time threads and asynchronous event handlers implement this interface

© Andy Wellings, 2004 Scheduler I package javax.realtime; public abstract class Scheduler { protected Scheduler();... public abstract boolean setIfFeasible( Schedulable schedulable, ReleaseParameters release, MemoryParameters memory); public abstract boolean setIfFeasible( Schedulable schedulable, ReleaseParameters release, MemoryParameters memory, ProcessingGroupParameters group); public abstract void fireSchedulable( Schedulable schedulable); public static Scheduler getDefaultScheduler(); public abstract String getPolicyName(); public static void setDefaultScheduler( Scheduler scheduler); }

© Andy Wellings, 2004 Scheduler 2 package javax.realtime; public abstract class Scheduler {... protected abstract boolean addToFeasibility( Schedulable schedulable); public abstract boolean isFeasible(); protected abstract boolean removeFromFeasibility( Schedulable schedulable); }

© Andy Wellings, 2004 The Priority Scheduler: Policy  Orders the execution of schedulable objects on a single processor according to a priority  Supports a real-time priority range of at least 28 unique priorities (the larger the value, the higher the priority)  Allows the programmer to define the priorities (say according to the relative deadline of the schedulable object)  Allows priorities may be changed at run time  Supports priority inheritance or priority ceiling emulation inheritance for synchronized objects (covered later)

© Andy Wellings, 2004 The Priority Scheduler: Mechanism  Supports pre-emptive priority-based dispatching of schedulable objects — the processing resource is always given to the highest priority runnable schedulable object  Does not defined where in the run queue (associated with the priority level), a pre-empted object is placed; however, a particular implementation is required to document its approach  Places a blocked schedulable object which becomes runnable, or has its priority changed at the back of the run queue associated with its (new) priority  Places a thread which performs a yield operation at the back of the run queue associated with its (new) priority

© Andy Wellings, 2004 The Priority Scheduler: Feasibility Analysis  Requires no particular analysis to be supported  Default analysis assumes an adequately fast machine

© Andy Wellings, 2004 The PriorityScheduler Class I public class PriorityScheduler extends Scheduler { // fields public static final int MAX_PRIORITY; public static final int MIN_PRIORITY; // constructors protected PriorityScheduler(); // methods which test feasibility protected boolean addToFeasibility( Schedulable schedulable); public boolean isFeasible(); protected boolean removeFromFeasibility( Schedulable schedulable); public boolean setIfFeasible(Schedulable schedulable, ReleaseParameters release, MemoryParameters memory); public boolean setIfFeasible(Schedulable schedulable, ReleaseParameters release, MemoryParameters memory, ProcessingGroupParameters group);

© Andy Wellings, 2004 The PriorityScheduler Class II // other methods public void fireSchedulable(Schedulable schedulable); public int getMaxPriority(); public static int getMaxPriority(Thread thread); public int getMinPriority(); public static int getMinPriority(Thread thread); public int getNormPriority(); public static int getNormPriority(Thread thread); public String getPolicyName(); }

© Andy Wellings, 2004 Summary I  Scheduling is the ordering of thread/process executions so that the underlying hardware (processors, networks, etc.) and software (shared data objects) resources are efficiently and predictably used  The RTSJ has two types of schedulable objects: real-time threads and event handlers. The only scheduler guaranteed to be provided by an RTSJ implementation is a fixed priority scheduler (FPS) which has the following characteristics.

© Andy Wellings, 2004 Summary II  Scheduling policy: FPS requires  statically allocating schedulable objects to processors  ordering the execution of schedulable objects on a single processor according to a priority  assigning priorities to schedulable objects at their creation time  priority inheritance when accessing resources.  Scheduling mechanism: FPS requires pre-emptive priority- based dispatching of processes  Feasibility analysis: The RTSJ does not mandate any particular schedulability analysis technique

© Andy Wellings, 2004 Further Reading and Exercises