Ada and Multicore

Programming multicore systems is a hot topic these days. As Robert Dewar notes in his EE Times commentary, “There’s nothing new about multicore mania”. Ada has been supporting multiprocessor, multicore, and multithreaded architectures as long it has existed. As he notes, “decades of experience have been accumulated in using Ada to deal with the problem of writing programs that run effectively on machines using more than one processor”.

For some reason, many pundits are ignoring all of this experience and clamoring for new ways to do multiprocessor programs. Indeed, Microsoft thinks that a programming model for multicore systems is “will not emerge for five to 10 years”, according to this article. While we’re all waiting for that to happen, Ada practitioners will be using Ada to build high-performance multicore applications. For instance, Karl Nyberg of Grebyn Corporation won a Sun Fire T1000 server in Sun Microsystems Open Performance Contest by building a parallel application using Ada. No need to wait 10 years.

Overview of Ada’s concurrency features

A concurrent program typically comprises active components that interact with each other either directly or through shared resources. Ada directly supports each of these elements. An active component is modeled by a task, Ada’s unit of concurrent execution. Direct communication between two tasks is achieved by a rendezvous, which provides synchronous passing of data. A shared resource can be mapped to a protected object (which provides mutual exclusion) or to other less general features. These semantic building blocks are high-level enough to be appropriate for modeling the architecture of a concurrent program.

Ada tasks (logical threads of execution) can be mapped to multiple processors, to multiple threads on a single processor (with or without hardware support), or to multiple cores of a single processor, depending on the compiler and target environment. The program need not change to run in any of these environments.

Resources on Ada’s concurrency features

A brief overview of Ada tasks and related features (with examples) can be found in the Tasking section of the Ada Programming Wikibook. An equally brief introduction can be found in Chapter 19 of Ada95: The Craft of Object Oriented Programming. Sections can be found in other free resources on Ada as well; see our learning materials page for other examples.

More extensive introductions can be found in the regular textbooks for Ada 2005; the Barnes and Ben-Ari books both have substantial sections on tasking. See our learning materials page for details on these books.

The “bible” of Ada tasking is the book Concurrent and Real-Time Programming in Ada by Burns and Welling. It has recently been revised to include Ada 2005 features and recent research in the field. This is very in-depth material and is recommended for those that want the most information available.

Share and Enjoy:
  • email
  • LinkedIn
  • Twitter
  • Facebook
  • Digg
  • RSS