ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

Other Software > Developer's Corner

Multithreading tutorials

(1/4) > >>

bgd77:
Hello to everyone,

I want to develop some multithreading skills and I was wondering if you could recommend me some online tutorials (or books) with some theory and/or with examples in C/C++/MFC.

Thanks a lot!

Eóin:
Taking advantage of some existing libraries can be a great idea since then you've documentation and sample code hand-in-hand. Two good one's I'm aware of are


* Intel Threading Building Blocks
* Boost.Thread
The Boost library would be a very steep learning curve if you've never come across Boost before. Codeproject would have loads of smaller, more accessible, examples. For example Synchronization in Multithreaded Applications with MFC. That might be more your thing if you don't want to go down the road of big libraries.

Another advanced source of expert advice would be Herb Sutter's "Effective Concurrency" columns.

Jibz:
Just wanted to point to the quote in my signature about multi-threading :D.

ecaradec:
A simple way to use threads is to share no data at all. Clone or allocate data then send them to another thread via PostThreadMessage or PostMessage and forget about them. In the other thread, when the loading, computing, ... is complete, post a message to the main thread with the result. It's very easy.

f0dder:
Not sharing data (at least not for write) is good advice, since the required synchronization can eat up most of the performance you gain from going multi-thread. Threading is hard... it can be difficult parallelizing your algorithms, it's easy to fall into race conditions or deadlocks, and debugging thread-related bugs can be nightmarish (be glad when you do find them on your development system, though, since it's no fun when code blows up after distribution). Oh, and if you get all those right, then there's the possible performance issues - enjoy :)

Navigation

[0] Message Index

[#] Next page

Go to full version