cloudparts

oneTBB

oneAPI Threading Building Blocks, formerly Intel TBB: a C++ library that splits work into tasks and runs them on a shared pool of worker threads with a work-stealing scheduler, plus parallel algorithms, concurrent containers and a scalable memory allocator.

UXL Foundation project
What it is
Multithreading
Type
Open source
Made by
UXL Foundation (Linux Foundation), started at Intel
License
Apache 2.0
Facts checked
28 October 2026

What it is

Writing parallel C++ with raw threads means deciding how many threads to start, splitting the work evenly between them and keeping every core busy when some pieces take longer than others. oneTBB lets you describe the parallelism instead: you call parallel_for over a range, parallel_reduce to combine results, parallel_pipeline for stages, or a task_group for anything else, and the library maps that onto threads. Each worker thread has its own deque of ready tasks. It pushes new tasks onto the bottom and takes its next task from the bottom too, so it works depth-first on fresh, cache-warm data; a thread that runs out of work steals the oldest task from the top of a randomly chosen other thread’s deque, which hands over a large piece of work at once. By default the scheduler uses every available core, and a task_arena can limit a piece of work to fewer threads, one NUMA node or one core type on hybrid processors.

Around the scheduler sit thread-safe containers such as concurrent_hash_map, concurrent_vector and concurrent queues, a flow graph for dependency and data-flow networks, thread-local storage, mutexes, and tbbmalloc, a scalable allocator that can replace malloc for a whole program. GCC’s libstdc++ uses TBB to run the C++17 parallel algorithms (std::execution::par), and Numba picks TBB first as its threading layer when it is installed. Intel released TBB in 2006, open-sourced it in 2007 and renamed it oneTBB in 2020 as part of oneAPI; it is now one of the libraries governed by the UXL Foundation, and 2023.2.0 came out on October 28, 2026.

Why teams pick it

  • Describes work as tasks, not threads, so the same code uses 4 or 128 cores without changes; the docs say starting and ending a task on Linux is about 18 times faster than a thread
  • Work stealing balances uneven pieces of work automatically, without the programmer sizing chunks for each core
  • One shared thread pool per process, so libraries that all use oneTBB don’t each start a full set of threads and oversubscribe the machine
  • Mature: developed since 2006, Apache 2.0, and the backend GCC’s libstdc++ uses for the C++17 parallel algorithms

Watch out for

  • CPU only: GPUs and other accelerators need oneDPL, SYCL or another library
  • Doesn’t prevent mistakes: oneTBB makes no promise of determinism or freedom from data races, so shared state still needs care
  • No fork() support, and static linking loses the shared thread pool that makes it compose well
  • C++ templates throughout, so it is a C++ library first; other languages reach it only through bindings such as its Python module

How it fits with other technologies

Square-root a vector in parallel, then sum it · cpp

#include <oneapi/tbb/blocked_range.h>
#include <oneapi/tbb/parallel_for.h>
#include <oneapi/tbb/parallel_reduce.h>
#include <cmath>
#include <functional>
#include <vector>

int main() {
    std::vector<double> v(10'000'000, 2.0);
    tbb::blocked_range<size_t> all(0, v.size());

    // the range is split into chunks; idle threads steal chunks from busy ones
    tbb::parallel_for(all, [&](const tbb::blocked_range<size_t>& r) {
        for (size_t i = r.begin(); i != r.end(); ++i) v[i] = std::sqrt(v[i]);
    });

    double sum = tbb::parallel_reduce(all, 0.0,
        [&](const tbb::blocked_range<size_t>& r, double acc) {
            for (size_t i = r.begin(); i != r.end(); ++i) acc += v[i];
            return acc;
        },
        std::plus<double>());   // combines the partial sums
    return sum > 0 ? 0 : 1;
}

See it in a real stack

No architecture uses oneTBB yet. Drop it into the playground and wire it up yourself.Open playground →
Where it came from2006–2026

By the mid-2000s desktop processors were gaining more cores, and most C++ code could only use one. Intel released Threading Building Blocks in 2006 as a commercial library that let C++ programmers express parallel loops and tasks with templates, in the style of the STL, instead of managing threads by hand. In July 2007 it published the code under the GPLv2 with a runtime exception, keeping a $299 commercial edition alongside, and with TBB 2017, released in September 2016 on GitHub, it moved to the Apache 2.0 licence.

In December 2020 TBB became oneTBB 2021.1, part of Intel’s oneAPI toolkits. The release cleaned up the API and removed long-deprecated interfaces such as the low-level task API and task_scheduler_init, with a migration guide for older code. When Intel turned oneAPI into the vendor-neutral UXL Foundation in 2023, oneTBB was among the projects it brought along, and its repository moved from Intel’s oneapi-src GitHub organisation to uxlfoundation.

Why it’s built this way

Tasks instead of threads
Programmers describe what can run in parallel and the library decides how many threads to use, avoiding both idle cores and more threads than cores.
Work stealing with per-thread deques
Each thread runs its newest task for cache locality, and idle threads steal the oldest, largest pieces from others, so load balances without a central queue.
Templates in the style of the STL
Algorithms such as parallel_for take ranges and function objects, so the compiler can inline the loop body and the code stays generic.

Timeline

  1. 2006

    Intel releases Threading Building Blocks as a commercial library

  2. 2007

    Open-sourced under GPLv2 with a runtime exception (July)

  3. 2016

    TBB 2017 moves to the Apache 2.0 licence and to GitHub

  4. 2020

    Renamed oneTBB with version 2021.1 (December), part of oneAPI

  5. 2023

    UXL Foundation launched; oneTBB becomes one of its projects

  6. 2026

    Version 2023.2.0 released on October 28

Sources11 · facts checked 28 October 2026

Improve this page on GitHub