Communication Middleware for Distributed Hard Real-Time Systems in Java
Tejera Carballa, Pablo Daniel · 2012
Distributed real-time embedded systems are becoming increasingly important to society. More demands will be made on them and greater reliance will be placed on the delivery of their services. A relevant subset of them is high-integrity or hard real-time systems, where failure can cause loss of life, environmental harm, or significant financial loss. Additionally, the evolution of communication networks and paradigms as well as the necessity of demanding processing power and fault tolerance, motivated the interconnection between electronic devices; many of the communications have the possibility of transferring data at a high speed. The concept of distributed systems emerged as systems where different parts are executed on several nodes that interact with each other via a communication network. Java’s popularity, facilities and platform independence have made it an interesting language for the real-time and embedded community. This was the motivation for the development of RTSJ (Real-Time Specification for Java), which is a language extension intended to allow the development of real-time systems. The use of Java in the development of high-integrity systems requires strict development and testing techniques. However, RTJS includes a number of language features that are forbidden in such systems. In the context of the HIJA project, the HRTJ (Hard Real-Time Java) profile was developed to define a robust subset of the language that is amenable to static analysis for high-integrity system certification. Currently, a specification under the Java community process (JSR- 302) is being developed. Its purpose is to define those capabilities needed to create safety critical applications with Java technology called Safety Critical Java (SCJ). However, neither RTSJ nor its profiles provide facilities to develop distributed realtime applications. This is an important issue, as most of the current and future systems will be distributed. The Distributed RTSJ (DRTSJ) Expert Group was created under the Java community process (JSR-50) in order to define appropriate abstractions to overcome this problem. Currently there is no formal specification. The aim of this thesis is to develop a communication middleware that is suitable for the development of distributed hard real-time systems in Java, based on the integration between the RMI (Remote Method Invocation) model and the HRTJ profile. It has been designed and implemented keeping in mind the main requirements such as the predictability and reliability in the timing behavior and the resource usage. iThe design starts with the definition of a computational model which identifies among other things: the communication model, most appropriate underlying network protocols, the analysis model, and a subset of Java for hard real-time systems. In the design, the remote references are the basic means for building distributed applications which are associated with all non-functional parameters and resources needed to implement synchronous or asynchronous remote invocations with real-time attributes. The proposed middleware separates the resource allocation from the execution itself by defining two phases and a specific threading mechanism that guarantees a suitable timing behavior. It also includes mechanisms to monitor the functional and the timing behavior. It provides independence from network protocol defining a network interface and modules. The JRMP protocol was modified to include two phases, non-functional parameters, and message size optimizations. Although serialization is one of the fundamental operations to ensure proper data transmission, current implementations are not suitable for hard real-time systems and there are no alternatives. This thesis proposes a predictable serialization that introduces a new compiler to generate optimized code according to the computational model. The proposed solution has the advantage of allowing us to schedule the communications and to adjust the memory usage at compilation time. In order to validate the design and the implementation a demanding validation process was carried out with emphasis in the functional behavior, the memory usage, the processor usage (the end-to-end response time and the response time in each functional block) and the network usage (real consumption according to the calculated consumption). The results obtained in an industrial application developed by Thales Avionics (a Flight Management System) and in exhaustive tests show that the design and the prototype are reliable for industrial applications with strict timing requirements. Los sistemas empotrados y distribuidos de tiempo real son cada vez mas importantes para la sociedad. Su demanda aumenta y cada vez mas dependemos de los servicios que proporcionan. Los sistemas de alta integridad constituyen un subconjunto de gran importancia. Se caracterizan por que un fallo en su funcionamiento puede causar perdida de vidas humanas, danos en el medio ambiente o cuantiosas perdidas economicas. La necesidad de satisfacer requisitos temporales estrictos, hace mas complejo su desarrollo. Mientras que los sistemas empotrados se sigan expandiendo en nuestra sociedad, es necesario garantizar un coste de desarrollo ajustado mediante el uso tecnicas adecuadas en su diseno, mantenimiento y certificacion. En concreto, se requiere una tecnologia flexible e independiente del hardware. La evolucion de las redes y paradigmas de comunicacion, asi como la necesidad de mayor potencia de computo y de tolerancia a fallos, ha motivado la interconexion de dispositivos electronicos. Los mecanismos de comunicacion permiten la transferencia de datos con alta velocidad de transmision. En este contexto, el concepto de sistema distribuido ha emergido como sistemas donde sus componentes se ejecutan en varios nodos en paralelo y que interactuan entre ellos mediante redes de comunicaciones. Un concepto interesante son los sistemas de tiempo real neutrales respecto a la plataforma de ejecucion. Se caracterizan por la falta de conocimiento de esta plataforma durante su diseno. Esta propiedad es relevante, por que conviene que se ejecuten en la mayor variedad de arquitecturas, tienen una vida media mayor de diez anos y el lugar ˜ donde se ejecutan puede variar. El lenguaje de programacion Java es una buena base para el desarrollo de este tipo de sistemas. Por este motivo se ha creado RTSJ (Real-Time Specification for Java), que es una extension del lenguaje para permitir el desarrollo de sistemas de tiempo real. Sin embargo, RTSJ no proporciona facilidades para el desarrollo de aplicaciones distribuidas de tiempo real. Es una limitacion importante dado que la mayoria de los actuales y futuros sistemas seran distribuidos. El grupo DRTSJ (DistributedRTSJ) fue creado bajo el proceso de la comunidad de Java (JSR-50) con el fin de definir las abstracciones que aborden dicha limitacion, pero en la actualidad aun no existe una especificacion formal. El objetivo de esta tesis es desarrollar un middleware de comunicaciones para el desarrollo de sistemas distribuidos de tiempo real en Java, basado en la integracion entre el modelo de RMI (Remote Method Invocation) y el perfil HRTJ. Ha sido disenado e implementado teniendo en cuenta los requisitos principales, como la predecibilidad y la confiabilidad del comportamiento temporal y el uso de recursos. El diseno parte de la definicion de un modelo computacional el cual identifica entre otras cosas: el modelo de comunicaciones, los protocolos de red subyacentes mas adecuados, el modelo de analisis, y un subconjunto de Java para sistemas de tiempo real critico. En el diseno, las referencias remotas son el medio basico para construccion de aplicaciones distribuidas las cuales son asociadas a todos los parametros no funcionales y los recursos necesarios para la ejecucion de invocaciones remotas sincronas o asincronas con atributos de tiempo real. El middleware propuesto separa la asignacion de recursos de la propia ejecucion definiendo dos fases y un mecanismo de hebras especifico que garantiza un comportamiento temporal adecuado. Ademas se ha incluido mecanismos para supervisar el comportamiento funcional y temporal. Se ha buscado independencia del protocolo de red definiendo una interfaz de red y modulos especificos. Tambien se ha modificado el protocolo JRMP para incluir diferentes fases, parametros no funcionales y optimizaciones de los tamanos de los mensajes. Aunque la serializacion es una de las operaciones fundamentales para asegurar la adecuada transmision de datos, las actuales implementaciones no son adecuadas para sistemas criticos y no hay alternativas. Este trabajo propone una serializacion predecible que ha implicado el desarrollo de un nuevo compilador para la generacion de codigo optimizado acorde al modelo computacional. La solucion propuesta tiene la ventaja que en tiempo de compilacion nos permite planificar las comunicaciones y ajustar el uso de memoria. Con el objetivo de validar el diseno e implementacion se ha llevado a cabo un exigente proceso de validacion con enfasis en: el comportamiento funcional, el uso de memoria, el uso del procesador (tiempo de respuesta de extremo a extremo y en cada uno de los bloques funcionales) y el uso de la red (consumo real conforme al estimado). Los buenos resultados obtenidos en una aplicacion industrial desarrollada por Thales Avionics (un sistema de gestion de vuelo) y en las pruebas exhaustivas han demostrado que el diseno y el prototipo son fiables para aplicaciones industriales con estrictos requisitos temporales.