DMD 1.029 and 2.013 releases

Sean Kelly sean at invisibleduck.org
Thu Apr 24 12:29:30 PDT 2008


== Quote from Walter Bright (newshound1 at digitalmars.com)'s article
> Sean Kelly wrote:
> > Every tool can be mis-used with insufficient understanding.
> Of course. But successfully writing multithreaded code that uses shared
> memory requires a level of expertise that is rare, and the need to write
> safe multithreaded code is far greater than the expertise available.
> Even for those capable of doing it, writing correct multithreaded code
> is hard, time-consuming, resistant to testing, and essentially
> impossible to prove correct. It's like writing assembler code with a hex
> editor.

I disagree... see below.

> > Look at shared-
> > memory multiprogramming for instance.  It's quite easy and understandable
> > to share a few data structures between threads
> It is until one of those threads tries to change the data.

I suppose I should have been more clear.  An underlying assumption of mine is
that no thread maintains references into shared data unless they hold the lock
that protects that data.

> > (which I'd assert is the original
> > intent anyway), but common practice among non-experts is to use mutexes
> > to protect code rather than data, and to call across threads willy-nilly.  It's
> > no wonder the commonly held belief is that multiprogramming is hard.
> The "multiprogramming is hard" is not based on a misunderstanding. It
> really is hard.

My claim is that multiprogramming is hard because the ability to share memory
has been mis-used.  It's not hard in general, in my opinion.

> > Regarding lock-free programming in particular, I think it's worth pointing
> > out that leaving out support for lock-free programming in general excludes
> > an entire realm of code being written--not only library code to be ultimately
> > used by everyday programmers, but kernel code and such as well.  Look at
> > the Linux source code, for example.
> I agree that lock free programming is important, but volatile doesn't
> get you there.

How is it lacking?  I grant that it's very low-level, but it does address the key
concern for lock-free programming.

>  >  As for the C++0x discussions, I feel
>  > that some of the participants of the memory model discussion are experts
>  > in the field and understand quite well the issues involved.
> Yes, there are a handful who do really understand it (Hans Boehm and
> Herb Sutter come to mind). If only the rest of us were half as smart <g>.

My personal belief is that the issue is really more a lack of plain old explanation
of the concepts than anything else.  The topic is rarely discussed outside of
research papers, and most other documentation is either confusing or just plain
wrong (the IA-86 memory model spec comes to mind, for example).  Not to
belittle the knowledge or experience of the C++ folks in any respect--this is
simply my experience with the information surrounding the topic :-)


Sean


More information about the Digitalmars-d-announce mailing list