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

Slides:



Advertisements
Similar presentations
Concurrency: Deadlock and Starvation Chapter 6. Deadlock Permanent blocking of a set of processes that either compete for system resources or communicate.
Advertisements

Chapter 6 Concurrency: Deadlock and Starvation Operating Systems: Internals and Design Principles, 6/E William Stallings Patricia Roy Manatee Community.
Concurrency: Deadlock and Starvation Chapter 6. Deadlock Permanent blocking of a set of processes that either compete for system resources or communicate.
Operating System Structure
Model for Supporting High Integrity and Fault Tolerance Brian Dobbing, Aonix Europe Ltd Chief Technical Consultant.
© Andy Wellings, 2004 Roadmap  Introduction  Concurrent Programming  Communication and Synchronization  Completing the Java Model  Overview of the.
Chapter 13 Embedded Systems
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.
Concurrency CS 510: Programming Languages David Walker.
© Andy Wellings, 2004 Roadmap  Introduction  Concurrent Programming  Communication and Synchronization  Completing the Java Model  Overview of the.
Witawas Srisa-an Chapter 6
© Andy Wellings, 2004 Roadmap  Introduction  Concurrent Programming  Communication and Synchronization  Completing the Java Model  Overview of the.
Chapter 13 Embedded Systems
CPSC 4650 Operating Systems Chapter 6 Deadlock and Starvation
© Andy Wellings, 2003 Roadmap  Introduction  Concurrent Programming  Communication and Synchronization  Completing the Java Model  Overview of the.
Chapter 11 Operating Systems
1 Concurrency: Deadlock and Starvation Chapter 6.
© 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.
CprE 458/558: Real-Time Systems
© Andy Wellings, 2004 Roadmap  Introduction  Concurrent Programming  Communication and Synchronization  Completing the Java Model  Overview of the.
Embedded Java Research Geoffrey Beers Peter Jantz December 18, 2001.
Concurrency: Deadlock and Starvation Chapter 6. Goal and approach Deadlock and starvation Underlying principles Solutions? –Prevention –Detection –Avoidance.
1 Concurrency: Deadlock and Starvation Chapter 6.
Instructore: Tasneem Darwish1 University of Palestine Faculty of Applied Engineering and Urban Planning Software Engineering Department Concurrent and.
Parallel Programming Models Jihad El-Sana These slides are based on the book: Introduction to Parallel Computing, Blaise Barney, Lawrence Livermore National.
B.Ramamurthy9/19/20151 Operating Systems u Bina Ramamurthy CS421.
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.
Threads in Java. History  Process is a program in execution  Has stack/heap memory  Has a program counter  Multiuser operating systems since the sixties.
Real-Time Java on JOP Martin Schöberl. Real-Time Java on JOP2 Overview RTSJ – why not Simple RT profile Scheduler implementation User defined scheduling.
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:
Instructore: Tasneem Darwish1 University of Palestine Faculty of Applied Engineering and Urban Planning Software Engineering Department Concurrent and.
Chapter 101 Multiprocessor and Real- Time Scheduling Chapter 10.
111 © 2002, Cisco Systems, Inc. All rights reserved.
Enhancements to Java for Real Time Systems Theresa Dsena CSE Fall 2006 Prof. Ganesan.
1 Announcements The fixing the bug part of Lab 4’s assignment 2 is now considered extra credit. Comments for the code should be on the parts you wrote.
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.
1 G53SRP: Introduction to Real Time Specification for Java (RTSJ) Chris Greenhalgh School of Computer Science Including material © Andy Wellings from his.
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.
111 G53SRP: RTSJ Memory Areas Chris Greenhalgh School of Computer Science.
CSCI1600: Embedded and Real Time Software Lecture 18: Real Time Languages Steven Reiss, Fall 2015.
1 VxWorks 5.4 Group A3: Wafa’ Jaffal Kathryn Bean.
Deadlock Operating Systems: Internals and Design Principles.
13-1 Chapter 13 Concurrency Topics Introduction Introduction to Subprogram-Level Concurrency Semaphores Monitors Message Passing Java Threads C# Threads.
Thread basics. A computer process Every time a program is executed a process is created It is managed via a data structure that keeps all things memory.
CSE 153 Design of Operating Systems Winter 2015 Midterm Review.
Real-Time Operating System Design
© 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.
Embedded Real-Time Systems Processing interrupts Lecturer Department University.
1 Chapter 2: Operating-System Structures Services Interface provided to users & programmers –System calls (programmer access) –User level access to system.
REAL-TIME OPERATING SYSTEMS
Processes and threads.
Topics Covered What is Real Time Operating System (RTOS)
Introduction to Operating System (OS)
Real-time Software Design
Chapter 3: Windows7 Part 2.
Chapter 3: Windows7 Part 2.
Real Time Java : Synchronization
Concurrency: Mutual Exclusion and Process Synchronization
Operating Systems : Overview
Operating Systems : Overview
CSE 153 Design of Operating Systems Winter 19
CSE 153 Design of Operating Systems Winter 2019
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 The Real-Time Specification for Java Lecture aims  To give the background of the RTSJ and the NIST requirements  To provide an introduction to  Memory management  Time values and clocks  Schedulable objects and scheduling

© Andy Wellings, 2004 Background and NIST Requirements  In the late 1990s, the US National Institute of Standards and Technology (NIST) coordinated the derivation of several guiding principles and a set of requirements for real-time extensions to the Java platform  Among the guiding principles was that Real-Time Java (RTJ) should take into account current real-time practices and facilitate advances in the state of the art of real-time systems implementation technology

© Andy Wellings, 2004 Support for Current State of Practice  Fixed priority and round robin scheduling  Mutual exclusion locking (avoiding priority inversion)  Inter-thread communication (e.g. semaphores)  User-defined interrupt handlers and device drivers — including the ability to manage interrupts (e.g., enabling and disabling)  Timeouts and aborts on running threads The NIST group recognized that profiles of RTJ were necessary in order to cope with the wide variety of potential applications, these included: safety critical, no dynamic loading, and distributed real-time profiles

© Andy Wellings, 2004 Implementations must provide  A framework for finding available profiles  Bounded pre-emption latency on any garbage collection  A well-defined model for real-time Java threads  Communication and synchronization between real-time and non real- time threads  Mechanisms for handling internal and external asynchronous events  Asynchronous thread termination  Mutual exclusion without blocking  The ability to determine whether the running thread is real-time or non real-time  A well-defined relationship between real-time and non real-time threads

© Andy Wellings, 2004 RTSJ Guiding Principles  Be backward compatible with non real-time Java programs  Support the principle of “ Write Once, Run Anywhere ” but not at the expense of predictability  Address the current real-time system practice and allow future implementations to include advanced features  Give priority to predictable execution in all design trade- offs  Require no syntactic extensions to the Java language  Allow implementers flexibility

© Andy Wellings, 2004 Overview of Enhancements  The RTSJ enhances Java in the following areas:  memory management  time values and clocks  schedulable objects and scheduling  real-time threads  asynchronous event handling and timers  asynchronous transfer of control  synchronization and resource sharing  physical memory access

© Andy Wellings, 2004 Warning It should be stressed that the RTSJ only really addresses the execution of real-time Java programs on a single processor systems. It attempts not to preclude execution on a shared- memory multiprocessor systems but it has no facilities directly to control, say, allocation of threads to processors.

© Andy Wellings, 2004 Memory Management I  Many real-time systems have only a limited amount of memory available because of  the cost  other constraints associated with the surrounding system (e.g., size, power or weight constraints)  It is necessary to control how this memory is allocated so that it can be used effectively  Where there is more than one type of memory (with different access characteristics), it may be necessary to instruct the compiler to place certain data types at certain locations  By doing this, the program is able to increase performance and predictability as well as interact with the outside world

© Andy Wellings, 2004 Heap Memory  The JVM is responsible for managing the heap  Key problems are deciding how much space is required (the sizeEstimator class in RTSJ helps here) and when allocated space can be released  The latter can be handled in several ways, including: 1. require the programmer to return the memory explicitly — this is error prone but is easy to implement 2. require the JVM to monitor the memory and determine when it can logically no longer be accessed 3. require the JVM to monitor the memory and release chunks which are no longer being used (garbage collection); this is, perhaps, the most general approach as it allows memory to be freed even though its associated access type is still in scope

© Andy Wellings, 2004 Real-Time Garbage Collection  From a real-time perspective, the approaches have an increasing impact on the ability to analyse the timing properties of the program  Garbage collection may be performed either when the heap is full or by an incremental activity  In either case, running the garbage collector may have a significant impact on the response time of a time-critical thread  All objects in standard Java are allocated on the heap and the language requires garbage collection for an effective implementation  The garbage collector runs as part of the JVM  Although there has been much work on real-time garbage collection and progress continues to be made, there is still a reluctance to rely on these techniques in time-critical systems

© Andy Wellings, 2004 Memory Areas  The RTSJ provides memory management which is not affected by the vagaries of garbage collection  It defines memory areas, some of which exist outside the traditional Java heap and never suffer garbage collection  RTSJ requires that the garbage collector can be preempted by real-time threads and that there should be a bounded latency for preemption to take place  The MemoryArea class is an abstract class from which for all RTSJ memory areas are derived  When a particular memory area is entered, all object allocation is performed within that area

© Andy Wellings, 2004 Subclasses of MemoryArea  HeapMemory allows objects to be allocated in the Java heap  ImmortalMemory is shared among all threads; objects created here are never subject to garbage collection and are freed only when the program terminates  ScopedMemory is a memory area for objects that have a well- defined lifetime; associated with each scoped memory is a reference count which keeps track of how many real-time entities are currently using the area  When the reference count reaches goes from 1 to 0, all objects resident in the scoped memory have their finalization method executed and the memory is reclaimed  The ScopedMemory class is an abstract class which has several subclasses  VTMemory : where allocations may take variable amounts of time  LTMemory : where allocations occur in linear time (related to the size of the object)

© Andy Wellings, 2004 Memory Parameters  Can be given when real-time threads and asynchronous event handlers are created; they specify  the maximum amount of memory a thread/handler can consume in a memory area,  the maximum amount of memory that can be consumed in immortal memory,  a limit on the rate of allocation from the heap (in bytes per second),  Can be used by the scheduler as part of an admission control policy and/or for the purpose of ensuring adequate garbage collection

© Andy Wellings, 2004 Memory Management Classes MemoryArea HeapMemory ImmortalMemory ScopedMemory LTMemoryVTMemory SizeEstimator MemoryParameters GarbageCollector RTSJ class RTSJ abstract class

© Andy Wellings, 2004 Time Values  HighResolutionTime encapsulates time values with nanosecond granularity  A value is represented by a 64 bits milliseconds and a 32 bits nanoseconds component  The class is an abstract class which has three subclasses:  AbsoluteTime : expressed as a time relative to some epoch. This epoch depends of the associated clock. It might be January 1, 1970, GMT for the wall clock or system start-up time for a monotonic clock  RelativeTime  RationalTime 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)  Time values are also relative to particular clocks

© Andy Wellings, 2004 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 which advances monotonically  A static method getRealtimeClock allows this clock to be obtained

© Andy Wellings, 2004 Time Values and Clocks HighResolutionTime RationalTime AbsoluteTime RelativeTime Clock relativeTo standard Java interface RTSJ class RTSJ abstract class

© Andy Wellings, 2004 Summary  The RTSJ originates from the desire to use Java in real-time  Java ’ s main problems include unsuitable memory management because of garbage collection and poor support for clocks and time  The RTSJ stems from the NIST requirements  Memory management is augmented by imoortal and scoped memory area  Clocks and time are augmented by a real-time clock and by high resolution absolute and relate time types

© Andy Wellings, 2004 Further Reading  Read the NIST requirements at Carnahan, L., and Ruark, M. (Eds) (1999), “Requirements for Real-time Extensions for the Java Platform”, NIST Publication ,