Subj : Re: C++ desired features To : (Usenet) From : Sergey P. Derevyago Date : Wed Feb 23 2005 04:44 pm Hans Boehm wrote: > > Some people think that MT is about locking. While the original idea > > is MT is about parallel simultaneous execution. > > > Could you expand on this? > Please let me cite a David Butenhof's posting: "multithreading is defined by an application design that ALLOWS FOR concurrent or simultaneous execution". Obviously, (excessive) locking does NOT allow for simultaneous execution. A lot of people are used to write old good ST code and "add some locks to make it thread-safe" _afterwards_. The realworld result is always frustrating: the application is terribly slow and doesn't scale. Sure, we need some synchronization primitives (such as mutexes) to implement inter-thread communication. As a rule, thoroughly designed MT application is a set of fully independent threads which communicate via the message queues. The synchronization primitives are used inside these queues and virtually no locks are supposed outside the queues. But what we see in real life is herds of mutexes spread across the code. "MT-aware classes" try to lock almost every method... And even more, some "industrial-strength" PLs have the built-in mutex per every object! IMHO there is no excuse for this madness. > Multithreaded programming is clearly about parallel execution. But > we'd also like to preserve program correctness in the process, which > means we need a way to prevent threads from operating on intermediate, > inconsistent versions of data structures that are being modified by > other threads. > The data that really has to be modified from several threads simultaneously is very rare. Yes, I'm talking about properly designed applications. -- With all respect, Sergey. http://ders.angen.net/ mailto : ders at skeptik.net [ See http://www.gotw.ca/resources/clcm.htm for info about ] [ comp.lang.c++.moderated. First time posters: Do this! ] .