Multicore: New Chips Mean New Challenges
With the advent of multicore processors such as the Intel Core Duo, which is now commonplace in PCs, software developers must deal with a new wrinkle -- getting software to be processed across multiple cores -- in order to ensure the maximum performance from their software. But this is much easier said than done, with developers having to tackle issues with concurrency and potential performance bottlenecks. Already, 71 percent of organizations are developing multithreaded applications for multicore hardware, according to a recent IDC survey sponsored by tool vendor Coverity.
Developers need to get an organization-wide commitment to accommodate multicore software development, advises IDC analyst Melinda Ballou. "They need to approach this with a level of commitment to better practices organizationally and from a project perspective for quality management [and] change management as well as development," she says.
[ Intel's Nehalem chip will push PCs further into a multicore world. InfoWorld's Tom Yager explains why Nehalem is such a game changer. ]
Multicore processors are becoming more prominent because single-core chips have maxed out on the heat and performance scale. Power-consumption issues also have driven development of multicore chips. Chipmakers such as Intel are adding cores to their CPUs. "Over the last 20 years of computing or longer, we've really been able to ride the wave of increased computing power through frequency scaling," says Lynne Hill, general manager of Microsoft's Parallel Computing Platform. But now, a wall (power consumption) has been hit, and hardware has to change if the processing capabilities of PCs are to increase, she says.
The hardware is in fact changing, which puts the burden on developers to adapt their applications to use it. Developers must learn new techniquesand use new tools to maximize performance.
That's because multicore processors work differently than single-core ones, processing multiple instructions in parallel. That means software has to break apart its instructions to be able to be processed in parallel as well. "When you have multiple cores, your program has to take advantage of all those cores, and it has to run instructions [on those cores] simultaneously," says Ben Chelf, CTO at Coverity, which offers tools for multicore development. "The challenge is that software never had to be designed to be run in parallel on multiple cores. It always just ran on a single core," says Ray DePaul, CEO of RapidMind, another provider of multicore-development tools.
Cliff Click, a distinguished engineer at Azul Systems who has offered technical presentations on issues with large concurrent programs, stresses the difficulties of writing multithreaded programs. "It's very hard, [but] it doesn't look that hard to begin with," he says.
Companies such as Intel, Microsoft, and Sun Microsystems are providing assistance with the multicore challenge and parallel programming.
Intel's Multicore App-Dev Aids
"Absolutely, [multicore software development is] a challenge. It's a pretty big challenge," says James Reinders, director of marketing for Intel's Developer Products Division. Concurrency is a major issue in development, he stresses. "When you write a parallel program, it's easy to make a program nondeterministic, meaning where different outcomes, or logic paths, are possible," Reinders says. Multicore app dev requires a much more complicated thought process about software design than most developers understand, he says. "By and large, the majority of programmers don't have experience with it and are in need of tools and training and so forth to help take advantage of it."
Intel is stepping in to assist developers who may not be able to deal with the paradigm shift on their own. The company offers its Threading Building Blocks template library to help C++ programmers with parallel programming. The Intel Thread Checker helps find nondeterministic programming errors, and the Intel Thread Profiler helps visualize a program to check what each core is doing. Also, Intel has a code library project called Ct, for C for Throughput, that looks at providing building blocks for common data parallelism cases.
Synchronization is important for parallel programming to avoid race conditions, Reinders notes. With a race condition, concurrent conditions aren't properly synchronized, so the order in which they complete affects the outcome. Program deadlocks also can occur: Instructions that execute in parallel each waits for the other to complete, so neither ends up completing.
Microsoft's Multicore App-Dev Aids
Microsoft also is working on parallel computing efforts. "We'll be integrating parallelism into our mainstream [app development] product," Hill says. For example, its Concurrency Runtime provides a common scheduling layer that will give applications to finer control over the resources allocated to them. The technology will be part of the planned Visual Studio 2010 platform and is included in the platform's Community Technology Preview prerelease edition.
Also on tap are extensions to languages, both in native and managed code, for parallelism. Microsoft will look at libraries and services for developers, plus it has developed PLinq, which adds parallelism to its Linq language-integrated query technology. Additionally, the company offers its parallel language extensions, which use the Concurrency Runtime.
Sun's Multicore App-Dev Aids
Sun Microsystems is considering multicore issues as potential improvements to the Java Virtual Machine. "There's a whole range of optimizations in the JVM that can be done," says Danny Coward, chief architect for client Java at Sun. "We've done some of them. We've got more that we want to [do]."
The Java application layer has supporting functions built into the programming model for applications to take advantage of multiple cores and multiple processors, Coward says. To address parallelism, Sun has taken a two-pronged approach: parallelizing the virtual machine and supporting applications with a concurrency model. This concurrency model is needed where applications do massively serial work, such as large data processing applications, Coward notes.
The 2004 release of Java Platform, Standard Edition (SE) included a concurrency framework that features APIs to let developers process a large amount of data. The framework also lets developers break up a task into smaller tasks to be executed on different threads in parallel, Coward notes.
With the planned Java Developer Kit 7, which is Sun's implementation of Java SE 7, Sun is pondering a new type of garbage collection -- for memory management -- that is more concurrent and parallel. The current Java garbage collector can't always be optimized on multiple cores, Coward says. The kit is planned for late 2009. Also planned for JDK 7 are concurrency APIs such as the fork/join framework.
Multicoreapp-Dev Tools Are Increasingly Available
Today, corporate developers typically accommodate multicore or multithreaded application development by using IDEs and some level of automated quality assurance, says IDC's Ballou. They tend to use frequent releases to add multicore support incrementally as they gain experience, she adds.
Azul's Click, who once worked on the development of the JVM while at Sun, says there are languages that attempt to address multicore issues. One is Clojure, which provides capabilities for multithreaded JVM programming. Another language in this vein is Scala, which is interoperable with Java, he notes. Click recommends using Java and JDK concurrency utilities and libraries, as well as reading best-practices books such as Brian Goetz's Java Concurrency in Practice.
Among specialty vendors with multicore-oriented tools are Cilk Arts, Coverity, Fortify, RapidMind, and SureLogic.