Intel tool tackles threading in C++
- By Kathleen Richards
Intel Corp. extended its multi-threading dev toolset this week with a C++ runtime library. The threaded app is designed to take advantage of multi-core processors by running “threads of execution”—typically one thread per execution core—allowing the app to perform tasks simultaneously.
Unlike C#, Java and Windows, C++ lacks built-in threading support, causing app developers to use the native threading capabilities of the Windows operating system. Developers spend a lot of time explaining in C++ language how to break the problem up in parallel: writing code for creating threads, managing threads and dividing up the workload. But Intel’s Threading Building Blocks 1.0 alleviates the drudgery.
“We think that should be the job of a programming language or runtime system, it should not be something every programmer has to run on their own,” says James Reinder, marketing director, Intel's Developer Products Division.
The OpenMP API, which Intel's compilers support, offers shared-memory parallel programming extensions to C/C++ and Fortran. “OpenMP is pretty limiting,” Reinder says. “It works really well for a class of applications, often very scientific applications. It has not been that sort of general purpose answer to, ‘How do I use threads without becoming an extreme threading expert?’”
Threading Building Blocks 1.0 uses C++ templates to extend the programming language without having to change the compiler (Intel, Microsoft and GNU). It ships with a cross-platform API for Windows, Linux, and the Mac OS platforms. The suggested product pricing is $299 per developer, no royalty. According to Intel, the C++ runtime library supports scalability, meaning additional coding is not required for future multi-core platforms. All of Intel's compilers and libraries work on Intel and AMD processors.
Earlier this month, Intel updated its other threading tools by adding support for Intel 64-bit apps, additional operating systems, and third-party dev tools. Analysis tool Thread Checker 3.0 now supports native Linux—command line views only. Both Thread Checker 3.0 and Thread Profiler 3.0 for Windows, which helps optimize application performance, now offer integration with Microsoft Visual Studio 2005. The analysis tools are designed to optimize app performance on Intel systems.
“Parallelism is a reality, it is not a temporary thing,” asserts Reinders. "Power has become an issue across the board,” he says. “It used to be a laptop or mobile issue but servers, which have become immensely popular, are consuming plenty of power now. Our customers have said they are not interested in us making processors that are twice as powerful but consume twice as much power.”
Intel is spearheading an educational program at 45 universities worldwide to expand computer science curriculums to include courses on multi-core platforms and multithreaded apps.
For developers, parallel programming presents many unique challenges. Managing the interaction of the threads, or synchronization, is at the top of the list. If you get the coordination wrong, it can lead to a debugging nightmare for new types of bugs known as data races or deadlock conditions. “The elephant in the room is, ‘How do you make parallel programming easier than it has been, so that it gets widely adopted?’” says Reinder.
AMD, Intel, Sun and IBM ship dual-core processors. In general, people can expect to see quad-core servers in 2006, and quad-core desktops within 2007, according to Reinder. Today, many companies already use machines with two dual-core sockets, and that trend is likely to continue with the release of quad-core processors.
Kathleen Richards (email@example.com) is the editor of RedDevNews.com and executive editor of Visual Studio Magazine.