Best practices for multicore programming
Software "best practices" are often a combination of personal experience, corporate knowledge, group-think, and even customer requirements in some cases. As developers work to create new software or migrate existing software to exploit parallelism in multicore architectures, identifying those best practices is a significant challenge - a challenge that the MCA (Multicore Association) has addressed with its release of the MPP (Multicore Programming Practices) guide.
As Markus Levy, MCA President, writes in the forward to the guide, "...it’s really a work in progress" but here's a little background on the guide, courtesy of MCA.
Goal of MPP
The Multicore Programming Practices guide details a concise set of best practices in software development for multicore processors using existing technology and existing software. In writing this document, the MPP working group made decisions and compromises in what and how much this document targets.
The following are thoughts on some of the higher level decisions made:
- API choices – Pthreads and MCAPI were selected for several reasons. These two APIs cover the two main categories of multicore programming - SMP and message passing. Second, Pthreads is a very commonly used API for SMP. MCAPI is a recently introduced API, but is novel in being a message passing-based multicore API that specifically targets embedded homogeneous and heterogeneous applications.
- Architecture categories – The architecture categories (homogeneous multicore with shared
memory, heterogeneous multicore with mix of shared and non-shared memory, and
homogeneous multicore with non-shared memory) are in priority order and reflect the group’s
assessment of use in embedded applications. Admittedly, the second category is a superset of
the first and third. The motivation for listing these three categories separately is due to the
widespread and common use of techniques associated with the first and third, namely SMP
techniques and process-level parallelism. The following paragraphs dissect this goal and offer
A concise set of best practices is a collection of best known methods for accomplishing the task of development for multicore processors. The intent is to share development techniques that are known to work effectively for multicore processors thus resulting in reduced development costs through a shorter time-to-market and a more efficient development cycle for those employing these techniques.
The phases of software development discussed in MPP and a summary of each follows:
- Program analysis and high level design is a study of an application to determine where to add concurrency and a strategy for modifying the application to support concurrency.
- Implementation and low level design is the selection of design patterns, algorithms, and data structures and subsequent software coding of the concurrency.
- Debug comprises implementation of the concurrency in a manner that minimizes latent concurrency issues, enabling of an application to be easily scrutinized for concurrency issues, and techniques for finding concurrency issues. Performance concerns improving turnaround time or throughput of the application by finding and addressing the effects of bottlenecks involving communication, synchronization, locks, load balancing, and data locality.
- Existing technology includes the programming models and multicore architectures detailed in the guide and are limited to a few that are in wide use today.
Existing software, also known as legacy software, is the currently used application as
represented by its software code. Customers using existing software have chosen to evolve the
implementation for new product development instead of re-implementing the entire application
to enable multicore processors
Readers of the MPP guide, who apply the detailed steps, may save significant costs in development projects. Cost savings can be applied to developer efficiency in analyzing and designing the implementation, a reduced number of bugs in the implementation, and increased likelihood of the implementation meeting performance requirements. These savings lead to faster time-to-market and lower development cost.
The MPP guide is written specifically for engineers and engineering managers of companies considering or implementing a development project involving multicore processors and favoring the use of existing multicore technology.
- Software developers who are experienced in sequential programming will benefit from reading this guide as it will explain new concepts which are essential when developing software targeted at multicore processors.
- Engineering managers running technical teams of hardware and software engineers will benefit from reading this guide by becoming knowledgeable about development for multicore processors and the learning curve faced by their software developers.
- Project managers scheduling and delivering complex projects will benefit from reading this guide as it will enable them to appreciate, and appropriately schedule, projects targeting multicore processors.
Test engineers developing tests to validate functionality and verify performance will benefit
from reading this guide as it will enable them to write more appropriate and more efficient tests
for multicore-related projects.
Currently no items