Multiple Threads Make Chunk Change

Sept. 27, 2006
Making efficient use of multiple processing cores in a symmetrical multiprocessing (SMP) environment can be tricky. But Intel's Thread Building Blocks (TBB) aim to ease the challenge.

Making efficient use of multiple processing cores in a symmetrical multiprocessing (SMP) environment can be tricky. But Intel's Thread Building Blocks (TBB) aim to ease the challenge.

TBB is based on C++ templates that provide a set of thread-safe parallel control and data objects suitable for writing efficient parallel algorithms. Compared to approaches like OpenMP, these class templates make mapping conventional loop constructs such as for and while and data structures such as vectors and queues a straightforward process that allows the TBB objects to operate in parallel without requiring explicit thread management by the programmer.

TBB doesn't create a plethora of threads. Instead, it creates one thread per logical core. (A hyperthreading core may support two or more logical threads.) Each working thread manages a work queue (see Figure). The main thread creates the TBB objects like a vector and performs operations on the vector such as scanning all the entries.

In this case, the operation will be part of the program code. It will be referenced by multiple chunks to span the vector where each chunk will process a subset of the vector. These chunks are spread across the work queues of the working threads. An idle working thread grabs the next chunk out of the queue and then performs the work to be done on its block of data.

This approach is very similar to distributed Web-based servers like Java 2 Enterprise Edition (J2EE), except the J2EE fills the queue with incoming Web requests. In general, the TBB is much more data-structure-driven, whereas J2EE is more I/O-oriented. Likewise, J2EE threads typically are allocated based on the estimated I/O load versus the number of cores the system is running on. That’s because the J2EE threads often will have to wait on other operations, while the TBB threads have all the data available to them when the chunk is being processed.

Complementary products for Linux with 64-bit support include Thread Checker and Thread Profiler. These tools can be used with TBB, but they're just as useful for any multithreaded application. Thread Checker uses binary instrumentation. It can find problems such as race conditions and deadlock automatically. New command line support is ideal for batch mode and regression testing. The Thread Profiler presents TBB information in a more abstract fashion commensurate with TBB's source abstraction.

TBB costs $299. It's available for Windows, Linux, and Mac operating systems. Thread Checker costs $999, and Thread Profiler is $299.

Related Links Intel
www.intel.com

Sponsored Recommendations

What are the Important Considerations when Assessing Cobot Safety?

April 16, 2024
A review of the requirements of ISO/TS 15066 and how they fit in with ISO 10218-1 and 10218-2 a consideration the complexities of collaboration.

Wire & Cable Cutting Digi-Spool® Service

April 16, 2024
Explore DigiKey’s Digi-Spool® professional cutting service for efficient and precise wire and cable management. Custom-cut to your exact specifications for a variety of cable ...

DigiKey Factory Tomorrow Season 3: Sustainable Manufacturing

April 16, 2024
Industry 4.0 is helping manufacturers develop and integrate technologies such as AI, edge computing and connectivity for the factories of tomorrow. Learn more at DigiKey today...

Connectivity – The Backbone of Sustainable Automation

April 16, 2024
Advanced interfaces for signals, data, and electrical power are essential. They help save resources and costs when networking production equipment.

Comments

To join the conversation, and become an exclusive member of Electronic Design, create an account today!