Linked by Thom Holwerda on Sun 9th Sep 2007 18:08 UTC, submitted by koki
Thread beginning with comment 269929
To read all comments associated with this story, please click here.
To read all comments associated with this story, please click here.
RE: Writing multithreaded applications in C++
by stippi on Mon 10th Sep 2007 09:33
in reply to "Writing multithreaded applications in C++"
RE[2]: Writing multithreaded applications in C++
by tuttle on Mon 10th Sep 2007 10:35
in reply to "RE: Writing multithreaded applications in C++"
It does depend on the available API to a certain degree. Writing multithreaded applications using the BeOS api is certainly less painful then writing them using the Win32 API.
And using a transactional memory library writing low level/high performance multithreaded code can be almost bearable.
But for example implementing message passing is much more pleasant in a language that has support for pattern matching. And generally writing multithreaded code requires good support for immutable data structures.
A garbage collector is also immensely helpful for message passing. C++ has neither of those, so it is just a bad choice for multithreaded applications.
RE: Writing multithreaded applications in C++
by Vanders on Mon 10th Sep 2007 12:42
in reply to "Writing multithreaded applications in C++"
Writing multithreaded applications in C++ is like pulling teeth.
I don't agree. The problem is that a lot of developers just won't or will not understand multi-threading. Using a language that "hides" the locking & message passing details may help mitigate that problem somewhat, but they'll still have very little idea of how it works.
Writing multi-threaded C++ is easy. There are three or four rules to remember and that's about it. Any developer should be capable of it.
RE[2]: Writing multithreaded applications in C++
by TQH ! on Mon 10th Sep 2007 13:32
in reply to "RE: Writing multithreaded applications in C++"
RE[2]: Writing multithreaded applications in C++
by tuttle on Mon 10th Sep 2007 13:33
in reply to "RE: Writing multithreaded applications in C++"
I don't agree. The problem is that a lot of developers just won't or will not understand multi-threading.
The majority of developers are incapable of writing multithreaded code with fine-grained locking. That is just a fact. So your approach is to tell these people to learn low level multithreading primitives or go to hell. Great way to get new developers for your niche platform.
Using a language that "hides" the locking & message passing details may help mitigate that problem somewhat, but they'll still have very little idea of how it works.
First of all, scala does not hide the message passing details. It just lets you write a message handler in 1/10th the lines of code compared to C++.
And what is the problem about hiding complexity? Many people use the stl without having the slightest idea about the alorithms used by it. Are you saying that abstraction is bad?
Besides, just because somebody does not get low level threading primitives like semaphores and mutexes does not mean that he is a bad programmer. Maybe he has valuable domain specific knowledge.
And I guess all those people using Erlang to program high performance telecommunications gear must be idiots because they use a language that hides many multithreading problems...
RE: Writing multithreaded applications in C++
by dylansmrjones on Mon 10th Sep 2007 15:42
in reply to "Writing multithreaded applications in C++"







Member since:
2006-03-01
...is like pulling teeth. Many BeOS applications were full of multithreading bugs. They always kind of worked, but were never really stable.
Modern languages like scala make writing multithreaded apps much easier. Scala has a very powerful message passing library (actors) that is somewhat similar to the erlang approach. The pattern matching of scala makes writing message handlers extremely pleasant.
http://lamp.epfl.ch/~phaller/doc/ActorsTutorial.html