Skip to main content
gamedev.net
🔒 Locked

multi-threaded programming book

Started by thesimon 8 replies 750+ views
Original Post
thesimon
thesimon
hi guys, lately i've been trying to improve my knowledge of multi-threaded programming (i'm using native c++, windows, boost (a lot) and i'm quite comfortable with c++). the thing is, i'd like to have a book that really goes deep into multi-threaded land (doesn't need to be windows specific). i've been writing some threaded applications so i know some of the basics but i just 'sorta' know. is there something that you could recommend? it should be as technical as possible and really not hiding any of the gorey stuff (which i like). it would be nice if i could learn from this book "how people do it". theory is nice (that i can in part learn by browsing the web) but i 'm looking for how it's done in common practice. any suggestions? thanks in advance, simon
_winterdyne_
_winterdyne_
This is quite good:

Win32 Multithreaded Programming, by Cohen and Woodring. Published by O'Reilly, ISBN 1-59592-296-4.

It's win32 specific but the basic theories for multithreading (when and why) are covered, along with win32 api functions.

Winterdyne Solutions Ltd is recruiting - this thread for details!
CrazyCdn
CrazyCdn
"Multithreading Applications in Win32 -- The Complete Guide to Threads" by Jim Beveridge and Robert Wiener was excellent.
"Those who would give up essential liberty to purchase a little temporary safety deserve neither liberty nor safety." --Benjamin Franklin
ajas95
ajas95
Well, if you're glancing through tables of contents, I would make sure that a book addresses Lock-Free programming. Probably, you'll not write many lock-free routines as they are quite difficult to do correctly. But in order to understand the difficulty of multi-threaded programming at its core, you must understand the difficulty of lock-free (and its advantages too!).

In essence, with lock-free you need to conceptualize your dataflow at the hardware level-- between caches, reordered reads and writes at the compiler and hardware levels. If you understand this, you'll appreciate what is accomplished by higher-level synchronization primitives... otherwise, it may all seem like a bunch of hocus-pocus.

If multi-threaded seems easy, your implementation is either really inefficient, really buggy... Or you're a genius :)

thesimon
thesimon
thanks for your comments everyone :) i 'll have a look at all of your suggestions. ajas95, that's a good hint. i'm aware that lock-free techniques exist and also i'm aware of the controversy surrounding lock-free programming. i think even Sutter is attacking the people striving for lock-free structures once in a while. that's making it even more necessary to have a closer look at this.
somehow i 'm more and more feeling the urge of having to dive deep into multi-threadedness. i know its the 'hype' right know (and it's selling well), but somehow i feel we're all screwed if we don't jump on this train right now, order piles of books and more importantly give stuff a try. i can't argue with Sutter on this one. each year in programming i set myself a general broad goal.. the stuff i want to investigate and dive into. i think this year is thread year.
from searching for some useful material i also learned that books on pthreads seem to get generally recommended by readers. i'm always afraid, though, that when i buy a book it's half about c++/mfc/win32 or something and then a couple of sections on the main topic - which seems to be relatively common, unfortunately.

thanks again, guys.
-simon
bakery2k1
bakery2k1
Quote:
Original post by _winterdyne_
Win32 Multithreaded Programming, by Cohen and Woodring. Published by O'Reilly, ISBN 1-59592-296-4.


Quote:
"Multithreading Applications in Win32 -- The Complete Guide to Threads" by Jim Beveridge and Robert Wiener


I've got both of these, and of the two, would recommend the latter.

The former starts off well enough, but then spends quite a bit of the book setting up wrapper classes for everything, which you then have to learn in order to follow anything past about chapter 6. The latter book, however, sticks to the functions in the Win32 API.
Rebooted
Rebooted
This is quite good. Multithreading in C++ isn't easy. There is no support for or notion of concurrency in the C++ standard at all. You have no language support, and neither are there any good libraries available. The ACE libraries are OK, and the boost library is decent, but it's only a layer above the low level locking routines provided by your OS.

If you really want to do this in C++ and not another language with better support for it, I recommend you use design patterns like those in the book I linked to, and emulate techniques like message passing concurrency. Try to stay away from shared state and low level locking if you can. Lock-free algorithms are also very difficult to get right: also on a very low, assembly-like level.

If this is all just to learn though it shouldn't matter that you'll find it hard.
thesimon
thesimon
"Multithreading Applications in Win32 -- The Complete Guide to Threads" by Jim Beveridge looks primising, indeed. as i said, i'm trying to stay away from books that mostly build their own abstraction library.

rebooted, i love c++ too much in order to use another language for multi-threaded applications and i have high hopes that some day we'll get to play with herb sutter's concur project. i don't mind multi-threaded stuff being hard to grasp at all as i believe that understanding what's going on at the metal level helps to make more efficient use of the higher primitives provided by various libraries. i suppose the different threading api's are basically just implementation detail (for the most part) so for me it makes more sense to learn what those API's are built on. the book you suggested looks very promising especially because it seems to deliver a more large-scale view accompanying the metal level details.

thanks a lot guys :)

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.