Novel optimization tools for parallel POSIX software
Author: Maximilian Odendahl, Silexica GmbH
Contribution – Embedded Software Engineering Congress 2017
Developing software for the new AUTOSAR Adaptive Platform will present developers with unprecedented challenges. Compared to existing single-core systems, and even to the existing AUTOSAR Classic Platform, distributing the software across the various processor cores of the target platform will become an increasingly significant challenge. This involves not only considering timing and functional requirements, but ideally also minimizing performance and energy consumption. Even for simpler algorithms and target systems, this results in a multitude of potential solutions, the development and evaluation of which push existing development approaches to their limits. Novel algorithms and tools from the field of software design automation can provide a solution.
Multicore programming and its challenges
The development of software for novel multi- and many-core systems presents numerous industries with new challenges. This is due to the increasing complexity of available hardware systems, where, in addition to high performance for a wide range of application scenarios, minimal power consumption is often required. This problem is further exacerbated by ever-shorter development cycles and increased security requirements. The resulting "efficiency gap" between the outstanding capabilities of modern hardware and the ability to efficiently utilize these capabilities through software cannot be economically closed using the currently common manual system design and programming methods.
The challenges here, besides parallelizing existing C/C++ code, primarily involve optimally distributing already parallelized software while considering temporal and functional constraints. This requires taking into account not only the necessary and available computing power, but also, increasingly, the communication between processor cores, which is becoming a bottleneck for system performance. Therefore, to meet all temporal and functional constraints, a combined consideration of computing power and communication is necessary.
AUTOSAR Adaptive Platform
In order to serve new application areas, the car of the future will take on more and more computationally intensive tasks, including...
- Automated driving
- Vehicle-to-X (V2X) networking with the surrounding road traffic
- Applications with permanent "over-the-air" updates
For this reason, the AUTOSAR consortium jointly specified the Adaptive Platform to enable more flexible software development for new types of central computers. However, the introduction of the AUTOSAR Adaptive Platform will bring about fundamental changes for developers. A brief technical overview of the two platforms is provided in the following table:
|
Classic Platform |
Adaptive Platform |
| Based on OSEK | Based on POSIX () |
| Static task configuration | Support for dynamic scheduling |
| Same address space for all applications | Each application has its own (virtual) address space. |
| Optimized for event-based communication (e.g., CAN, FlexRay) | Service-oriented communication |
| Running the application from the ROM | The application is loaded from RAM. |
POSIX (Portable Operating System Interface) is a standardized programming interface between the application and the operating system and was not originally developed for the automotive industry. However, POSIX operating systems make software development for vehicles significantly more flexible and allow the use of numerous existing libraries from the fields of high-performance computing, embedded vision, and machine learning.
A key difference will be the support for dynamic scheduling. Many different strategies are conceivable here, depending on the operating system used, such as round-robin or priority-based scheduling. Dynamic scheduling can theoretically increase application performance, but it significantly complicates the predictability of timing behavior. A developer can very rarely predict all potential thread interactions in complex, parallel systems. Furthermore, it is often difficult to identify the true culprit behind system effects and performance bottlenecks. Adaptive AUTOSAR also allows the dynamic creation of additional threads at runtime, which further impairs predictability.
Solutions through innovative software design tools
For the problems mentioned above, manual design and programming are no longer economically viable. Manual approaches, such as repeatedly running an application and subsequently comparing detailed traces, will become impossible in the future due to increasing complexity. We are already seeing increased costs for verification and testing, as well as more frequent project delays.
A new generation of automated development tools attempts to solve these problems through compiler-based static and dynamic data flow analysis, automatic runtime estimation, and the calculation of Affinity masks. The goal is automatic software optimization and automatic distribution across homogeneous and heterogeneous target architectures. Throughout the entire development process, the target platform is directly integrated, enabling combined software and hardware optimization.
For sequential C/C++ programming and for the AUTOSAR Classic Platform, such a toolchain is already available from Silexica. For the Adaptive Platform, it is currently under development and consists of, as shown in Figure 1 (see below). PDF) indicated, consisting of several elements.
Thread analysis is the most difficult part:
- The program flow must be abstracted and replaced by events that include their source code properties and represent semantic properties that affect both the execution flow and the global state of the application.
- Fast algorithms must be used to calculate and extract the dependencies regarding the order and data consistency of these events.
Possible events for the abstract representation of an application include the operating system's thread management, process/library loading (e.g., via vma_link), signals (e.g., via SIGSEGV), Pthreads calls for mutexes (e.g., pthread_mutex_lock), barriers, and shared access to the same memory area. Semantic analysis then requires different heuristics to understand the various effects. For example, two dependencies between two mutex events must be evaluated completely differently than the dependencies between two barrier events.
(see Fig. 2, PDF)
Full-System Simulation
Applications based on the AUTOSAR Adaptive Platform have the advantage that they are integrated into the system at runtime, allowing them to be developed, tested, distributed, and updated independently of each other.
Service-oriented communication also makes it possible to integrate applications into the overall system at any time. It is compatible with the AUTOSAR Classic Platform's SOME/IP. This will allow multiple systems to run in parallel in the central supercomputer of the car of the future, as indicated in Figure 3 (see Figure 3). PDF).
This further exacerbates the previously described, growing difficulties in understanding the overall system in terms of timing. New tools will also be necessary in the near future to manage the increasing complexity of the car of the future.
Summary
The increasing complexity of modern multiprocessor systems, combined with shortened development cycles and rising application requirements, has led to an efficiency gap: Efficient use of modern multiprocessor systems can only be achieved to a limited extent economically with manual system design and programming. With increasing platform and software complexity, this problem will only worsen in the future.
The introduction of the AUTOSAR Adaptive Platform presents software developers with additional challenges. Besides the switch from OSEK to POSIX, the possibility of dynamic scheduling is particularly noteworthy. This newfound flexibility is both a blessing and a curse, as the predictability of the system's temporal behavior is severely limited.
Novel software design automation tools can be used to make data-driven decisions, to better understand one's overall system, and to close the gap between software and hardware innovations of recent years.
author
Maximilian Odendahl He studied computer engineering at RWTH Aachen University and, after graduating, worked as a research assistant at the Institute for Communication Technologies and Embedded Systems (ICE), focusing on tool development for heterogeneous multicore systems. From January 2013 to December 2014, he also served as senior engineer at ICE. Today, he is the managing partner of Silexica GmbH and a regular speaker at conferences.
Automotive – our training & coaching
Do you want to bring yourself up to date with the latest technology?
Then find out more here MircoConsult offers training courses/seminars/workshops and individual coaching on the topic of automotive/embedded and real-time software development.
Training & coaching on the other topics in our portfolio can be found here. here.
Automotive – Expertise
Valuable expertise in automotive/embedded and real-time software development is available. here Available for you to download free of charge.
You can find expertise on other topics in our portfolio here. here
