Developing New Apps: In Parallel or Serial?

With all the legacy code we have around (seems kinda funny to think about C++ apps as "legacy" code), we'll be converting serial applications to parallel versions in order for those applications to run effectively on multi-core platforms. We can add explicit threads, OpenMP pragmas, or threading libraries like Rogue Wave's Threads.h++ (is this still available?) or Intel Threading Building Blocks.

What about developing code from scratch? Let's say you wanted to give Oracle a run for their money and develop a database application. Would you plan for and build in concurrency and parallelism to the system design from the beginning (making sure your code will scale to processors with more cores later)?  Or would you do everything in serial and then thread the code after serial QA is passed?

With the current state of tools and theory, I'm guessing that the latter method (design and write in serial with an eye toward what could be made to run in parallel) would be the one most employed, even for new development.  One reason for this is that debugging freshly written parallel code has two potential sources of problems: logic errors in the code and threading problems with the implementation. Even though tools can help with the threading errors, it may still be difficult to locate incorrectly implemented code that is executing in parallel.

A second reason is that there is precious little theory and experience for developing (non-obvious) parallelism in code today. Serial execution on abstract computation models has been developed and refined for decades. However, as Prof. Edward A. Lee recently pointed out, these models fall apart when attempting to deal with the nondeterminism of threads. Before we can train our software engineers to be natural parallel programmers, we'll need a useful abstraction of parallel platforms and a more deterministic programming model (language) than we have today.

I can't even guess when a universally acceptable theoretical model for parallel platforms will be found, but I don't think it will be any time soon (I've already seen several attempts come and go). Even after we have such a model, we'll need some programming methods that can be realized in actual code. Then we've got to start training budding software engineers in all of this.

While none of these questions may be settled before I'm retired, or even in my lifetime, the advent of multi-core processors has helped to point out the absences of models and methods. With the added "pressure" of parallelism for the masses, I might be pleasantly surprised.
For more complete information about compiler optimizations, see our Optimization Notice.