May 26, 2005
C++ gets a multicore tune-up

http://plg.uwaterloo.ca/~usystem/uC++.html

Alexander Wolfe
(05/24/2005 3:09 PM EDT)
URL: http://www.eetimes.com/showArticle.jhtml?articleID=163700706

In a bid to ease the burden of programmers trying to write software that can
take full advantage of dual-core and multi-threading processors, a Canadian
computer-science professor has developed a set of extensions to the popular C++
programming language.
"You won't be able to buy a computer in five years that doesn't have a dual-core
processor," said Peter Buhr, a professor of computer science at the University
of Waterloo, in Waterloo, Ontario. "We can ignore it, or we can try to get
software in place so that every programmer has an opportunity to take advantage
of this. But it can't be as complicated as it is now; we have to make it
simpler."

Enter Buhr's project, which is called micro-C++. It adds four new classes not in the original C++ language, which programmers can use to define separate threads in their code. "What you do is, you imagine how you want your program subdivided, and you write the code so it has multiple threads," explained Buhr. "These threads can then run independently. You don't have to worry about all the low-level details; that's the point of using a high-level language. Micro-C++ is going to make your whole development process neater and cleaner."

Because Buhr's extensions aren't part of the standard C++ language, he's implemented micro-C++ as a translator. It reads program written with the extensions and translates them into standard C++ statements, which can then be turned into an executable image by a compiler that links the source code to a micro-C++ runtime library provided by Buhr.

During its development phase, Buhr's work received financial support from the Gelato Federation, an organization funded by Intel and Hewlett-Packard, among others, that's dedicated to building support for Intel's Itanium processor in high-performance computing applications running under Linux. Despite Gelato's focus on Linux, micro-C++ is processor- and operating-system-agnostic, running on x86, Sparc and MIPS processors.

Buhr is looking to build support for micro-C++ this week, at a group-wide technical meeting of the Gelato Federation in San Jose, Calif. "For the last six years, everybody's been herded over to the Java side, and I was working on C++, so I was kind of ignored," Buhr said. "Now, everybody's coming back to C++ and suddenly there's interest again."

At the meeting, Buhr plans to talk with representatives from Intel and HP, who have expressed interest in his work. Outside of Gelato, he said he's had discussions with Sun Microsystems.

While micro-C++ appears to be the most recent effort to add concurrent programming features to a high-level programming language, it isn't the only one. Historically, one of the most popular methods has been Posix threads, or pthreads, which are a set of procedure calls originally developed for use with the C ((stet, C)) programming language. While pthreads have seen service in many quarters, they're considered cumbersome in that they often require a lot of work on the part of the programmer to ensure that different threads don't step on each other.

Other recent efforts to bring concurrency to C++ include the Boost.org project, the C++ threads library on the popular open-source software site Sourceforge, and the toolkit offered by the Adaptive Computing Environment. However, none appears to have gained widespread popularity and none has yet become an official part of C++.

However, over the long term, programmers working in C++ probably won't have to rely on specialty addition such as Buhr's extensions or its software cousins. That's because the C++ standards committee is currently considering revisions that might fold such features into the definition of the language.

"I'm on the subcommittee that's looking into adding concurrency into C++," Buhr said. "At the moment, it's completely open as far as what we're going to do. It's still early and we're trying to hammer out some of the lower level stuff. Different people have different ideas."

For now, micro-C++ is available for free download. Buhr said he's releasing it as open-source software.