Multicore processing has reached the deployment stage in embedded systems. The transition from single to multicore processors is motivated primarily by the need to increase performance while conserving power. This has placed more responsibility on the shoulders of software engineers to get it right.
The first step is being able to select the right multicore software architecture for the application. There are several ways to benefit from multicore processing. Software migrations will most likely start from serial code bases. Therefore, the target software design needs to identify the solution to meet the migration requirements.
There are several factors that will guide the plan for multicore migration. Factors include the starting point (design) of the original source code, as well as migration goals and constraints. Each method has its own strengths.
This article will walk through a multicore “decision tree” to select that multicore software architecture best suited to the application space under consideration. This decision tree is shown in Figure 1.
on image to enlarge.
Figure 1. A Decision Tree for picking a multicore software architecture
Decision 1: Select the programming model
The first decision is to decide whether the programming model should be Symmetric Multiprocessing (SMP) or Asymmetric Multiprocessing (AMP), keeping in mind that the application can be partitioned to support both.
Choose SMP if one operating system will be run, using all of the cores as equal processing resources, and the applications can be parallelized to benefit from SMP systems.
SMP requires application analysis to identify opportunities for parallelism in the code and then rewriting the code to achieve this parallelism using multithreading. For CPU intensive code, which is difficult to redesign for parallel processing using SMP and multithreading, asymmetric multiprocessing (AMP) could be a good alternative solution.
AMP requires no application changes to leverage the benefits of multiple cores. AMP leverages multiple cores by running multiple instances of the OS and application in separate partitions that are dedicated to specific cores, peripherals, and system memory areas.
This can be beneficial when an increased level of security is required on some cores. Devices are assigned to cores and the I/O connections and secure applications are separated by the MMU.
Keep in mind, AMP requires a boot loader that supports AMP and to partition the hardware resources and make OS and application assignments to those partitions. The OS must be relocate-able, must be able to restrict its memory region, and must only operate on its assigned PCI devices.