Instructore: Tasneem Darwish1 University of Palestine Faculty of Applied Engineering and Urban Planning Software Engineering Department Concurrent and.

Slides:



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

CSE 522 Real-Time Scheduling (4)
Exception Handling Chapter 15 2 What You Will Learn Use try, throw, catch to watch for indicate exceptions handle How to process exceptions and failures.
© Andy Wellings, 2004 Roadmap  Introduction  Concurrent Programming  Communication and Synchronization  Completing the Java Model  Overview of the.
Tasks Periodic The period is the amount of time between each iteration of a regularly repeated task Time driven The task is automatically activated by.
Java How to Program, 9/e CET 3640 Professor: Dr. José M. Reyes Álamo © Copyright by Pearson Education, Inc. All Rights Reserved.
© Andy Wellings, 2004 Roadmap  Introduction  Concurrent Programming  Communication and Synchronization  Completing the Java Model  Overview of the.
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.
Instructor: Tasneem Darwish
© Andy Wellings, 2004 Roadmap  Introduction  Concurrent Programming  Communication and Synchronization  Completing the Java Model  Overview of the.
IBM Software Group © 2005 IBM Corporation Compilation Technology Toward Deterministic Java Performance Mark Stoodley, Mike Fulton Toronto Lab, IBM Canada.
© 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.
Embedded and Real Time Systems Lecture #4 David Andrews
© Andy Wellings, 2004 Roadmap  Introduction  Concurrent Programming  Communication and Synchronization  Completing the Java Model  Overview of the.
© Andy Wellings, 2003 Roadmap  Introduction  Concurrent Programming  Communication and Synchronization  Completing the Java Model  Overview of the.
Chapter 11 Operating Systems
Enhancing the Platform Independence of the Real-Time Specification for Java Andy Wellings, Yang Chang and Tom Richardson University of York.
Real-Time Operating System Chapter – 8 Embedded System: An integrated approach.
© 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.
Java How to Program, 9/e CET 3640 Professor: Dr. Reyes Álamo © Copyright by Pearson Education, Inc. All Rights Reserved.
Embedded Java Research Geoffrey Beers Peter Jantz December 18, 2001.
Parallel Processing (CS526) Spring 2012(Week 8).  Thread Status.  Synchronization in Shared Memory Programming(Java threads ) ◦ Locks ◦ Barriars.
Real-Time Software Design Yonsei University 2 nd Semester, 2014 Sanghyun Park.
Instructore: Tasneem Darwish1 University of Palestine Faculty of Applied Engineering and Urban Planning Software Engineering Department Concurrent and.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 4: Threads.
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 소프트웨어공학 강좌 Chap 11. Real-time software Design - Designing embedded software systems whose behaviour is subject to time constraints -
EEL Software development for real-time engineering systems.
Real-Time Systems Design1 Priority Inversion When a low-priority task blocks a higher-priority one, a priority inversion is said to occur Assume that priorities:
Today’s Agenda  Quick Review  Finish Java Threads  The CS Problem Advanced Topics in Software Engineering 1.
111 © 2002, Cisco Systems, Inc. All rights reserved.
Enhancements to Java for Real Time Systems Theresa Dsena CSE Fall 2006 Prof. Ganesan.
CE Operating Systems Lecture 11 Windows – Object manager and process management.
Reference: Ian Sommerville, Chap 15  Systems which monitor and control their environment.  Sometimes associated with hardware devices ◦ Sensors: Collect.
Real-Time Scheduling CS4730 Fall 2010 Dr. José M. Garrido Department of Computer Science and Information Systems Kennesaw State University.
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.
I/O Computer Organization II 1 Interconnecting Components Need interconnections between – CPU, memory, I/O controllers Bus: shared communication channel.
14.1 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts with Java – 8 th Edition Chapter 4: Threads.
EEL The Real-Time Specification for Java (1)
EEL Real-time Java part 2. EEL Acknowledgements All the lecture slides were adopted from the slides of Andy Wellings.
15.1 Threads and Multi- threading Understanding threads and multi-threading In general, modern computers perform one task at a time It is often.
CE Operating Systems Lecture 2 Low level hardware support for operating systems.
CSCI1600: Embedded and Real Time Software Lecture 18: Real Time Languages Steven Reiss, Fall 2015.
CE Operating Systems Lecture 2 Low level hardware support for operating systems.
Thread Scheduling and Dispatching Maung Aung Han Marc E. Loy Jihua Zhong CIS 642: Seminar in Real-time Systems Instructor: Professor Insup Lee.
Silberschatz, Galvin and Gagne ©2011 Operating System Concepts Essentials – 8 th Edition Chapter 2: The Linux System Part 3.
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.
© 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.
1 G53SRP: Introduction to Real Time Scheduling Chris Greenhalgh School of Computer Science.
Introduction to operating systems What is an operating system? An operating system is a program that, from a programmer’s perspective, adds a variety of.
Embedded Real-Time Systems Processing interrupts Lecturer Department University.
G53SRP: Real Time Threads in RTSJ (part I)
Threads CSSE 332 Operating Systems Rose-Hulman Institute of Technology
Real-time Software Design
CSCI1600: Embedded and Real Time Software
Multithreaded Programming
CSCI1600: Embedded and Real Time Software
NETWORK PROGRAMMING CNET 441
Chapter 13: I/O Systems.
Presentation transcript:

Instructore: Tasneem Darwish1 University of Palestine Faculty of Applied Engineering and Urban Planning Software Engineering Department Concurrent and Real Time programming The Real-time Specification for Java

Instructore: Tasneem Darwish2 Time Values and Clocks  Java supports the notion of a wall clock (calendar time).  The Date class is intended to reflect UTC (Universal Time Coordinated), however, accuracy depends on the host system.  The RTSJ introduces clocks with high-resolution time types.  The associated classes are illustrated in the figure.

Instructore: Tasneem Darwish3 Time Values and Clocks  HighResolutionTime encapsulates time values with nanosecond and an associated clock.  A value is represented by a 64-bits millisecond and a 32-bits nanosecond component.  There are methods to read, write and compare time values, as well as methods to get and set the clock.  The class is an abstract class that has three subclasses:  one that represents relative time,  one that represents absolute time,  and one that represents "rational" time.

Instructore: Tasneem Darwish4 Time Values and Clocks  Relative time is a duration measured by a particular clock.  Absolute time is actually expressed as a time relative to some epoch. This epoch depends on the associated clock.  Rational time is a relative-time type, which has an associated frequency. It is used to represent the rate at which certain events occur (for example, periodic thread execution).

Instructore: Tasneem Darwish5 Time Values and Clocks  The RTSJ Clock class defines the abstract class from which all clocks are derived.  The specification allows many different types of clocks; for example, there could be a CPU execution-time clock (although this is not required by the RTSJ).  There is always one real-time clock that advances monotonically.  A static method getRealtimeClock allows this clock to be obtained.  Countdown clocks are called timers by the RTSJ

Instructore: Tasneem Darwish6 Schedulable Objects and Scheduling  Java allows each thread to have a priority that can be used by the JVM when allocating processing resources.  However, Java offers no guarantees that the highest priority runnable thread will be the one executing at any point in time.  This is because a JVM may be relying on a host operating system to support its threads. Some of these systems may not support preemptive priority-based scheduling.

Instructore: Tasneem Darwish7 Schedulable Objects and Scheduling  Furthermore, Java only defines 10 priority levels, and an implementation is free to map these priorities onto a more restricted host operating system's priority range if necessary  The RTSJ attacks these problems on several fronts.  Firstly, it generalizes the entities that can be scheduled away from threads toward the notion of schedulable objects.

Instructore: Tasneem Darwish8 Schedulable Objects and Scheduling  A schedulable object is one that implements the Schedulable interface.  Each schedulable object must also indicate its specific: 1.release requirement (that is, when it should become runnable), 2.memory requirements (for example, the rate at which it will allocate memory on the heap), 3.scheduling requirements (for example, the priority at which it should be scheduled).

Instructore: Tasneem Darwish9 Parameters affecting scheduling  Release requirements are specified via the ReleaseParameters class hierarchy.  Scheduling theories often identify three types of releases: 1.periodic (released on a regular basis), 2.aperiodic (released at random) and 3.sporadic (released irregularly, but with a minimum time between each release).  These are represented by the PeriodicParameters, AperiodicParameters and SporadicParameters classes respectively.

Instructore: Tasneem Darwish10 Parameters affecting scheduling  All release parameter classes encapsulate a cost and a deadline (relative time) value.  The cost is the maximum amount of CPU time (execution time) needed to execute the associated schedulable object every time it is released.  The deadline is the time at which the object must have finished executing the current release; it is specified relative to the time the object was released.

Instructore: Tasneem Darwish11 Parameters affecting scheduling  Scheduling parameters are used by a scheduler to determine which object is currently the most eligible for execution.  The abstract class SchedulingParameters provides the root class.  ImportanceParameters allow an additional numerical scheduling metric to be assigned; it is a subclass of the PriorityParameters class.

Instructore: Tasneem Darwish12 Schedulers  The scheduler is responsible for scheduling its associated schedulable objects.  The RTSJ is silent on how many schedulers might exist within a single real-time JVM but typically only a single scheduler will be present.  Although RTSJ explicitly supports priority-based scheduling via the PriorityScheduler, it acknowledges that an implementation might provide other schedulers.  Consequently, Scheduler is an abstract class with PriorityScheduler a defined subclass.

Instructore: Tasneem Darwish13 Schedulers

Instructore: Tasneem Darwish14 Meeting deadlines  Once a system accepts that schedulable objects have deadlines and a cost associated with their execution, there is an obligation on the system to undertake the following activities:  provide a means by which it is possible to predict whether a set of application objects will meet their deadlines, and  provide mechanisms whereby the system can report that an application object has missed its deadline, consumed more resources than indicated by the cost value.

Instructore: Tasneem Darwish15 Real-time Threads  One type of schedulable object is a real-time thread represented by the RealtimeThread class.  This is an extension of the Java Thread class, which also implements the Schedulable interface.  A real-time thread's parameters are illustrated in the figure.

Instructore: Tasneem Darwish16 Real-time Threads  A periodic real-time thread is a real-time thread that has periodic release parameters.  Similarly, an aperiodic (or sporadic) real-time thread is one that has aperiodic (or sporadic) release parameters.  A NoHeapRealtimeThread is one that guarantees not to create or reference any objects on the heap. Hence, its execution is totally independent of the garbage collector

Instructore: Tasneem Darwish17 Asynchronous Event Handling and Timers  Threads and real-time threads are the appropriate abstractions to use when representing concurrent activities.  However, it is also often necessary to respond to events that happen asynchronously to a thread's activity.  These events may be happenings in the environment of an embedded system or notifications received from internal activities within the program.

Instructore: Tasneem Darwish18 Asynchronous Event Handling and Timers  It is always possible to have extra threads that wait for these events, but this is inefficient and may result in an explosion of the number of threads in a program.  In Java, standard classes can be programmed that multiplex events onto a single thread that handles them in a particular order.

Instructore: Tasneem Darwish19 Asynchronous Event Handling and Timers  From a real-time perspective, events may require their handlers to respond within deadlines.  Hence, more control is needed over the order in which events are handled.  The RTSJ, therefore, generalizes Java event handlers to be schedulable entities.

Instructore: Tasneem Darwish20 Asynchronous Event Handling and Timers  The RTSJ, therefore, generalizes Java event handlers to be schedulable entities.  Like real-time threads, the schedulable entities have a variety of parameters illustrated in the figure.

Instructore: Tasneem Darwish21 Asynchronous Transfer of Control  Asynchronous events allow the program to respond in a timely fashion to a condition that has been detected by the program or the environment.  However, they do not allow a particular schedulable object to be directly informed.

Instructore: Tasneem Darwish22 Asynchronous Transfer of Control  In many applications, the only form of asynchronous notification that a real-time thread needs is a request for it to terminate itself.  instead what is required is for the schedulable object to stop what it is currently doing and begin executing an alternative algorithm.

Instructore: Tasneem Darwish23 Asynchronous Transfer of Control  In Java, it is the interrupt mechanism that attempts to provide a limited form of asynchronous notification.  unfortunately, the mechanism is synchronous and does not support timely response to the "interrupt".  Instead, a running thread has to poll for notification. This delay is deemed unacceptable for real-time systems.

Instructore: Tasneem Darwish24 Asynchronous Transfer of Control  For the previous reasons, the RTSJ provides an alternative approach for interrupting a schedulable object, using asynchronous transfer of control (ATC).  The ATC model is based on the following principles: 1.A schedulable object must explicitly indicate that it is prepared to allow an ATC to be delivered. 2.The execution of synchronized methods and statements always defers the delivery of an ATC. 3.ATCs have termination semantics; this means that the schedulable object does not resume execution at the point in its code where the ATC was delivered.

Instructore: Tasneem Darwish25 Asynchronous Transfer of Control  The RTSJ ATC model is integrated with the Java exception handling facility.  An AsynchronouslyInterruptedException (AIE) class defines the ATC event.  Every method that is prepared to allow the delivery of an AIE must indicate so via a throws AsynchronouslyInterruptedException in its declaration.

Instructore: Tasneem Darwish26 Asynchronous Transfer of Control  ATCs are deferred until the thread is executing within such a method.  The Interruptible interface provides the link between the AIE class and the object executing an interruptible method.  A subclass of AIE, called Timed, allows an ATC to be generated at a point in time (absolute or relative).  The ATC facilities also allow real-time threads to be terminated in a controlled and safe manner.