Siemens has developed an open-source implementation of the Multicore Task Management Application Programming Interface (MTAPI) published by the Multicore Association to make it easier to divide and manage concurrent tasks that run on systems with multiple processors. The implementation is part of a larger project called Embedded Multicore Building Blocks (EMB2), designed to ease the job of creating parallelized software for embedded systems.
Tobias Schuele, the lead developer on the EMB2 project at Siemens, said: “What we observed is that there is a variety of different libraries and language extensions for parallel programming such as OpenMP but these approaches are mainly intended for desktop and server applications. They don’t give you guarantees regarding runtime and memory consumption.
“We often want fine-grained control over when memory is allocated and the same regarding execution times,” Schuele added. “Most of [the other] approaches have some kind of task scheduling but no way to express priorities or task affinities. So we took the decision to develop EMB2.
Image EMB2 and its relationship to MTAPI and the runtime system
The EMB2 software takes care of creating and allocating lightweight threads to processors rather than forcing developers to create their own thread-management code. “In today’s systems, you may have hundreds of threads running but most are idling,” said said Urs Gleim, head of the Smart Embedded Systems research group at Siemens, pointing out that the threading models provided by most RTOS implementations are not tuned for runtime efficiency. “They are not designed for utilizing the computing power of the parallel processor.
“With a traditional operating systems you would have a much higher overhead for thread creation and shutting them down, and synchronization primitives such as mutexes are very expensive. That does not work. The machine ends up just synchronizing rather than processing,” Gleim explained.
“What we do is split the workload into hundreds or even thousands of little pieces that allow us to perform load-balancing that can scale from dual-core platforms to those with eight, twelve or more cores. The challenging part of this that you have to have minimal overhead to do this. But it really scales.”
Explaining the decision to release EMB2 as open source, Gleim said: “We have a long history of doing open-source software. The team is very active in the area of Linux. Nobody buys because of the operating system in industrial control, so we consolidate our effort with that of other companies.
“Secondly, we want to ensure longer term maintenance for the software. If we develop as a research department we have to find a way to maintain the work for several years,” said Gleim, which means either supporting the work solely within the group or enlisting outside assistance through open source. “If we see that there is interest from other companies, we move to open source.”
Although the group had some modules built for managing concurrent tasks, Schuele said the Siemens team decided to start again and base EMB2 on the MTAPI specification when it was released. As well as providing an implementation that conforms to the API, the company built modules on top that ease the creation of systems that use a dataflow structure or implement a callable algorithm. “They are not part of MTAPI but they are completely aligned.
“We included the dataflow component because our experience is that in the embedded domain many systems process continuous streams of data. We have applications from image processing for example where image sequences need to be analyzed. And multimedia devices are largely stream based.”
Schuele added: “EMB2 will grow to contain additional features. We can see the need for useful extensions. But we covered the most important building blocks with these.”
Today’s implementation is geared for homogeneous multicore processors but Siemens is working on one that can support heterogeneous platforms that incorporate DSPs, GPUs and other accelerators.