Tbb: What Is a Master Thread?

In the docs for TBB, there is a note about reserving slots for 'master' threads in an arena:

A master thread can join any thread 'slot' in an arena, but worker threads cannot join the slot reserved for a master thread. Also, a task arena is allowed more than one master slot. So far so good. What is not clear to me, is what exactly does being a master thread entail? Is it "just" the main application thread? If so, how can there be more than one master thread?

1 Answer

Conceptually, the term "master thread" refers to any application thread that starts a parallel job. In contrast, a "worker thread" is a TBB-created thread which helps master threads process their job.

Specifically for task_arena, master threads submit jobs via the public API of the class, while worker threads join an arena through the internal interface.

A worker thread that joined an arena from inside can also become a master thread in another arena, in case a task it executes in the first arena calls task_arena::execute().

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Robert Thorne

Robert Thorne

Automotive & Future Transportation Editor

Robert Thorne covers electric vehicle innovations, autonomous driving systems, global mobility trends, and automotive engineering developments.

Share this article
Twitter Facebook Pinterest