You are not logged in.

#1 2023-11-16 16:32:33

snack
Member
From: Italy
Registered: 2009-01-13
Posts: 872

Multithreading in C++: stdlib or TBB?

I'm totally new to multithreading in C++, I just read something about the standard library approach (future, promise et al.) and about Intel TBB. I don't have a clear idea of the advantages of one approach vs the other; the mean-squared-opinion on the web seems to be in favor of TBB but I couldn't find an apple-to-apple comparison (maybe because they're different things?). So if there's anybody willing to help me with this before I start my experiments it could be of great help.
Thanks in  advance.

Offline

#2 2023-11-17 11:28:20

Lone_Wolf
Forum Moderator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 12,315

Re: Multithreading in C++: stdlib or TBB?

https://en.wikipedia.org/wiki/List_of_C … _libraries indicates there are a lot more choices then just two .

Do you have previous experience with multithreaded programming ?


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.


(A works at time B)  && (time C > time B ) ≠  (A works at time C)

Offline

#3 2023-11-17 15:12:15

schard
Forum Moderator
From: Hannover
Registered: 2016-05-06
Posts: 2,034
Website

Re: Multithreading in C++: stdlib or TBB?

Lone_Wolf wrote:

Do you have previous experience with multithreaded programming ?

I do. Which is why I use Rust for it now.
https://bholley.net/blog/2015/must-be-t … -code.html

Last edited by schard (2023-11-17 15:12:40)


macro_rules! yolo { { $($tokens:tt)* } => { unsafe { $($tokens)* } }; }

Offline

#4 2023-11-17 17:14:49

Alad
Wiki Admin/IRC Op
From: Bagelstan
Registered: 2014-05-04
Posts: 2,416
Website

Re: Multithreading in C++: stdlib or TBB?

TBB is mostly useful if you need special features like flow graphs or work scheduling. Otherwise the standard library is fine.

The following book (though somewhat dated) gives a good comparison between different methods:

https://books.google.com/books/about/St … edir_esc=y


Mods are just community members who have the occasionally necessary option to move threads around and edit posts. -- Trilby

Offline

#5 2023-11-20 06:33:19

snack
Member
From: Italy
Registered: 2009-01-13
Posts: 872

Re: Multithreading in C++: stdlib or TBB?

Thanks to everybody. As I wrote I am an absolute beginner with MT, I just read the multithreading section of Stroustrup's book and starting to experiment. I'll go through the references you provided. I am bound to C++ for the time being so I'll give Rust a look in a later stage.

Offline

Board footer

Powered by FluxBB