Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
C++ Threads, what's the status quo?
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  Messages 1 - 25 of 202 - Collapse all  -  Translate all to Translated (View all originals)   Newer >
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
pon...@gmail.com  
View profile  
 More options Dec 26 2006, 3:32 pm
Newsgroups: comp.lang.c++.moderated
From: pon...@gmail.com
Date: 26 Dec 2006 15:32:03 -0500
Local: Tues, Dec 26 2006 3:32 pm
Subject: C++ Threads, what's the status quo?
While people as brilliant as Hans have already come up with the whole
bunch of proposals and ideas which make me feel that threads in C++
will have a bright future, I did come across an article that seemingly
said that there was something wrong with the way people did the whole
thing.
While I'm certainly not qualified to judge the thing, I'd like to put
the post to the forefront, and let people who can to comment on this.

http://enfranchisedmind.com/blog/archive/2006/10/21/163

To quote a few lines(please redirect to the blog to see the details,
coz I haven't asked the one if I could put the entire post(which is
pretty long) here):

I'm reading this post on the C++ committee's dealings on threading,
and, I am pleased to announce, there is absolutely no chance what so
ever of anything sane, workable, or sensible accidentally arising from
these precedings...

--
      [ See http://www.gotw.ca/resources/clcm.htm for info about ]
      [ comp.lang.c++.moderated.    First time posters: Do this! ]


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Gianni Mariani  
View profile  
 More options Dec 27 2006, 4:48 am
Newsgroups: comp.lang.c++.moderated
From: Gianni Mariani <gi3nos...@mariani.ws>
Date: 27 Dec 2006 04:48:57 -0500
Local: Wed, Dec 27 2006 4:48 am
Subject: Re: C++ Threads, what's the status quo?
pon...@gmail.com wrote:

...
...

It appears the major gripe is the simplification to use fully
synchronized atomic access and the effect on performance.

While for some code this may be a major factor, in most cases it is not.

Threading is a complex beast to most people, and so is C++.  If the
default model was to make things so complex that most people who are
already familiar with threaded code become alienated by complexity, then
we're not looking at a winning formula.

The few users with performance critical applications that need the
control of load/store visibility can continue to experiment and there is
nothing stopping them from using these "optimal" primitives in their
applications - like they are today.

Personally, I think it's a sound compromise.

--
      [ See http://www.gotw.ca/resources/clcm.htm for info about ]
      [ comp.lang.c++.moderated.    First time posters: Do this! ]


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Mathias Gaunard  
View profile  
 More options Dec 27 2006, 4:54 am
Newsgroups: comp.lang.c++.moderated
From: Mathias Gaunard <loufo...@remove.gmail.com>
Date: 27 Dec 2006 04:54:36 -0500
Local: Wed, Dec 27 2006 4:54 am
Subject: Re: C++ Threads, what's the status quo?

pon...@gmail.com wrote:
> While people as brilliant as Hans have already come up with the whole
> bunch of proposals and ideas which make me feel that threads in C++
> will have a bright future, I did come across an article that seemingly
> said that there was something wrong with the way people did the whole
> thing.
> While I'm certainly not qualified to judge the thing, I'd like to put
> the post to the forefront, and let people who can to comment on this.

> http://enfranchisedmind.com/blog/archive/2006/10/21/163

He's basically only saying he doesn't like atomics because they disable
optimizations.
Given that it is simply their *goal*, this remark is just stupid.

He's also saying that a high-level language proposal was refused and the
same proposal as a library was considered.
It's simply because it was decided not to add needless elements to the
language. Only low-level ones are added.

> I'm reading this post on the C++ committee's dealings on threading,
> and, I am pleased to announce, there is absolutely no chance what so
> ever of anything sane, workable, or sensible accidentally arising from
> these precedings...

That guy clearly says he doesn't like C++. He probably doesn't even
realize how C++ code should be.
For example, he says he doesn't understand why so much attention was
given to the design rather than the behaviour.

--
      [ See http://www.gotw.ca/resources/clcm.htm for info about ]
      [ comp.lang.c++.moderated.    First time posters: Do this! ]


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Francis Glassborow  
View profile  
 More options Dec 27 2006, 4:52 am
Newsgroups: comp.lang.c++.moderated
From: Francis Glassborow <fran...@robinton.demon.co.uk>
Date: 27 Dec 2006 04:52:14 -0500
Local: Wed, Dec 27 2006 4:52 am
Subject: Re: C++ Threads, what's the status quo?
In article <1167139437.608835.58...@79g2000cws.googlegroups.com>,
pon...@gmail.com writes

I am greatly saddened by the tone of that article. He chooses to quote
private discussions (and I am certain that he did so without the consent
of the person quoted and without the context)

The comments are arrogant and if he was just an observer the blogger is
unlikely to know as much as those who have been working on this solidly
for over a year.

--
Francis Glassborow      ACCU
Author of 'You Can Do It!' and "You Can Program in C++"
see http://www.spellen.org/youcandoit
For project ideas and contributions: http://www.spellen.org/youcandoit/projects

      [ See http://www.gotw.ca/resources/clcm.htm for info about ]
      [ comp.lang.c++.moderated.    First time posters: Do this! ]


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Howard Hinnant  
View profile  
 More options Dec 27 2006, 12:31 pm
Newsgroups: comp.lang.c++.moderated
From: Howard Hinnant <howard.hinn...@gmail.com>
Date: 27 Dec 2006 12:31:53 -0500
Local: Wed, Dec 27 2006 12:31 pm
Subject: Re: C++ Threads, what's the status quo?
In article <1167139437.608835.58...@79g2000cws.googlegroups.com>,

It is so much easier to stand up, shout, point and ridicule, than it is
to actually help.  People have been doing that since there were people.

Thank goodness there are some people who have the courage to put their
hide on the line and make concrete proposals for a better standard.  You
can too.  On the library side you can send proposals directly to me.

But check the attitude at the door.  You may find out that you're not
the only smart person working towards a better C++ standard.

Howard Hinnant
Library Working Group Chair

--
      [ See http://www.gotw.ca/resources/clcm.htm for info about ]
      [ comp.lang.c++.moderated.    First time posters: Do this! ]


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Beman Dawes  
View profile  
 More options Dec 28 2006, 1:59 pm
Newsgroups: comp.lang.c++.moderated
From: Beman Dawes <bda...@acm.org>
Date: 28 Dec 2006 13:59:37 -0500
Local: Thurs, Dec 28 2006 1:59 pm
Subject: Re: C++ Threads, what's the status quo?

Not to mention that it is almost certainly a mis-quote. I've said
several times that the committee would be bad shape without Hans'
encyclopedic knowledge of *garbage collection*. As for threading, the
committee has a number of people with both broad and deep knowledge and
experience.

--Beman

--
      [ See http://www.gotw.ca/resources/clcm.htm for info about ]
      [ comp.lang.c++.moderated.    First time posters: Do this! ]


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Bertrand Motuelle  
View profile  
 More options Dec 29 2006, 2:46 pm
Newsgroups: comp.lang.c++.moderated
From: "Bertrand Motuelle" <tib.motue...@laposte.net>
Date: 29 Dec 2006 14:46:27 -0500
Local: Fri, Dec 29 2006 2:46 pm
Subject: Re: C++ Threads, what's the status quo?

Beman Dawes wrote:
> Francis Glassborow wrote:
> > I am greatly saddened by the tone of that article. He chooses to quote
> > private discussions (and I am certain that he did so without the consent
> > of the person quoted and without the context)

> Not to mention that it is almost certainly a mis-quote. I've said
> several times that the committee would be bad shape without Hans'
> encyclopedic knowledge of *garbage collection*. As for threading, the
> committee has a number of people with both broad and deep knowledge and
> experience.

> --Beman

To be fair with the blogger, the corresponding quotes can be found in a
public article of the C++ source:
http://www.artima.com/cppsource/threads_meeting.html

Bertrand.

--
      [ See http://www.gotw.ca/resources/clcm.htm for info about ]
      [ comp.lang.c++.moderated.    First time posters: Do this! ]


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Howard Hinnant  
View profile  
 More options Dec 29 2006, 7:32 pm
Newsgroups: comp.lang.c++.moderated
From: Howard Hinnant <howard.hinn...@gmail.com>
Date: 29 Dec 2006 19:32:29 -0500
Local: Fri, Dec 29 2006 7:32 pm
Subject: Re: C++ Threads, what's the status quo?
In article <1167379436.110055.298...@79g2000cws.googlegroups.com>,
 "Bertrand Motuelle" <tib.motue...@laposte.net> wrote:

Yes, it would have been most helpful if the blogger had referenced where
he was getting his quotes from.  I was familiar with the article and
thus easily able to locate it as well.  But others might not be, or
might not go to the trouble to hunt the reference down.

-Howard

--
      [ See http://www.gotw.ca/resources/clcm.htm for info about ]
      [ comp.lang.c++.moderated.    First time posters: Do this! ]


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
patrik.kah...@googlemail.com  
View profile  
 More options Jan 2 2007, 2:07 pm
Newsgroups: comp.lang.c++.moderated
From: patrik.kah...@googlemail.com
Date: 2 Jan 2007 14:07:32 -0500
Local: Tues, Jan 2 2007 2:07 pm
Subject: Re: C++ Threads, what's the status quo?

> > To be fair with the blogger, the corresponding quotes can be found in a
> > public article of the C++ source:
> > http://www.artima.com/cppsource/threads_meeting.html

I found a interesting follow up post called "The Solution to C++
Threading is Erlang":

http://radio.weblogs.com/0103955/categories/stupidHumanProgramming/20...
5.html

and a similar blog post about the erlang way..

http://codemines.blogspot.com/2006/09/hell-is-multi-threaded-c-progra...

They argue that multi threading is complicated and error prone, and
that the alternative of using shared memory stores between native OS
processes are to slow. But they say there is an alternative model. A
mix between the two. You could have threads that dont share any data
but only communicate thru messages. That kind of thread might sound
alot like a regular native OS process but i guess the difference is
that you have more control over them and they are more efficient
because they are supported directly by the language instead of by the
operating system.

Sounds simple and good to me. What do you guys think?

I guess the down side would be that to share any data you would be
sending a copy of it. The cost of getting simple value semantics might
just be worth it..

Regards Patrik

--
      [ See http://www.gotw.ca/resources/clcm.htm for info about ]
      [ comp.lang.c++.moderated.    First time posters: Do this! ]


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Sean Kelly  
View profile  
 More options Jan 3 2007, 9:04 am
Newsgroups: comp.lang.c++.moderated
From: "Sean Kelly" <s...@f4.ca>
Date: 3 Jan 2007 09:04:31 -0500
Local: Wed, Jan 3 2007 9:04 am
Subject: Re: C++ Threads, what's the status quo?

patrik.kah...@googlemail.com wrote:

> They argue that multi threading is complicated and error prone, and
> that the alternative of using shared memory stores between native OS
> processes are to slow. But they say there is an alternative model. A
> mix between the two. You could have threads that dont share any data
> but only communicate thru messages. That kind of thread might sound
> alot like a regular native OS process but i guess the difference is
> that you have more control over them and they are more efficient
> because they are supported directly by the language instead of by the
> operating system.

> Sounds simple and good to me. What do you guys think?

This is already done informally in many multithreaded programs.  The
producer-consumer model, for example, is message-oriented in nature.
But I do think it would be useful to formalize things further.  Some
projects have attempted this in modern adaptions of Hoare's CSP, but
the designs I've seen aren't terrific from a semantic perspective.
Also, I think CSP itself isn't sufficient, because it doesn't apply
terribly well to distributed processing.  And while the Pi calculus is
useful here, it isn't that great for in-process concurrency.  An ideal
solution would adapt equally well to both low-latency and high-latency
communication channels, but while I've seen some projects in this area
(PEPA maybe?  it's been a while since I looked), all were still in the
design phase.

> I guess the down side would be that to share any data you would be
> sending a copy of it. The cost of getting simple value semantics might
> just be worth it..

For in-process concurrency, data doesn't necessarily have to be copied,
it just can't be shared between threads.  So I think the actual cost of
messaging is generally quite acceptable.

Sean

--
      [ See http://www.gotw.ca/resources/clcm.htm for info about ]
      [ comp.lang.c++.moderated.    First time posters: Do this! ]


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Thant Tessman  
View profile  
 More options Jan 3 2007, 2:28 pm
Newsgroups: comp.lang.c++.moderated
From: Thant Tessman <a...@standarddeviance.com>
Date: 3 Jan 2007 14:28:40 -0500
Local: Wed, Jan 3 2007 2:28 pm
Subject: Re: C++ Threads, what's the status quo?

Howard Hinnant wrote:

[...]

> It is so much easier to stand up, shout, point and ridicule, than it
> is to actually help. [...] Thank goodness there are some people who
> have the courage to put their hide on the line and make concrete
> proposals for a better standard. [...]

Threading is basically a solved problem and has been for a while.
Someone mentioned Erlang. I'll mention Concurrent ML. I'll also mention
first-class continuations which are supported by several languages and
with which you can construct your own threading mechanism that looks
like anything you want. Shoehorning threading into C++ just seems like a
misallocation of talent and effort--counterproductive even. Is it
"ridicule" to point this out?

-thant

--
      [ See http://www.gotw.ca/resources/clcm.htm for info about ]
      [ comp.lang.c++.moderated.    First time posters: Do this! ]


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Francis Glassborow  
View profile  
 More options Jan 4 2007, 4:04 pm
Newsgroups: comp.lang.c++.moderated
From: Francis Glassborow <fran...@robinton.demon.co.uk>
Date: 4 Jan 2007 16:04:03 -0500
Local: Thurs, Jan 4 2007 4:04 pm
Subject: Re: C++ Threads, what's the status quo?
In article <engf6f$c...@news.xmission.com>, Thant Tessman
<a...@standarddeviance.com> writes

>Threading is basically a solved problem and has been for a while.
>Someone mentioned Erlang. I'll mention Concurrent ML. I'll also mention
>first-class continuations which are supported by several languages and
>with which you can construct your own threading mechanism that looks
>like anything you want. Shoehorning threading into C++ just seems like
>a misallocation of talent and effort--counterproductive even. Is it
>"ridicule" to point this out?

The only deduction I can make from this is that you believe C++ should
be dead and buried. C++ without threading will be tantamount to useless
by the end of this decade. Even mobile phones us multi-core processors
these days. And my point is that multi-threading is in the process of
becoming equivalent to concurrent programming and C++ needs to address
that issue.

--
Francis Glassborow      ACCU
Author of 'You Can Do It!' and "You Can Program in C++"
see http://www.spellen.org/youcandoit
For project ideas and contributions: http://www.spellen.org/youcandoit/projects

      [ See http://www.gotw.ca/resources/clcm.htm for info about ]
      [ comp.lang.c++.moderated.    First time posters: Do this! ]


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Mathias Gaunard  
View profile  
 More options Jan 4 2007, 4:34 pm
Newsgroups: comp.lang.c++.moderated
From: Mathias Gaunard <loufo...@remove.gmail.com>
Date: 4 Jan 2007 16:34:08 -0500
Local: Thurs, Jan 4 2007 4:34 pm
Subject: Re: C++ Threads, what's the status quo?

patrik.kah...@googlemail.com wrote:
> You could have threads that dont share any data
> but only communicate thru messages.
> I guess the down side would be that to share any data you would be
> sending a copy of it.

Unfortunetely, SMP architectures are more popular.
So sharing is more efficient.

--
      [ See http://www.gotw.ca/resources/clcm.htm for info about ]
      [ comp.lang.c++.moderated.    First time posters: Do this! ]


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Le Chaud Lapin  
View profile  
 More options Jan 5 2007, 3:02 pm
Newsgroups: comp.lang.c++.moderated
From: "Le Chaud Lapin" <jaibudu...@gmail.com>
Date: 5 Jan 2007 15:02:57 -0500
Local: Fri, Jan 5 2007 3:02 pm
Subject: Re: C++ Threads, what's the status quo?

Francis Glassborow wrote:
> The only deduction I can make from this is that you believe C++ should
> be dead and buried. C++ without threading will be tantamount to useless
> by the end of this decade. Even mobile phones us multi-core processors
> these days. And my point is that multi-threading is in the process of
> becoming equivalent to concurrent programming and C++ needs to address
> that issue.

I have a threading library in C++ that is portable to Windows & Linux,
and probably another other OS's where the kernel-mode people did their
part and provided the minimum set of synchronization primitives.  It is
not a full-featured library.  There are some questions that I did not
try to answer.  There are also some areas that could be cleaner. But
the key point is that the interface is mostly clean, the interface is
portable, the model does not leave you wrestling with your own brain as
you use it, something I would imagine other people who have tried to
make "thread objects" have discovered (I learned the hard way that it
is not good to regard a thread as an object).

The point is that C++ and threading are alive and well.  People use
them together.  Some people use the native API of their OS, which is
not always pleasant to use.  Some people wrap these API's.

But I do not think it is fair to say that we do not understand the
importance of multi-threading programming by C++ programmers.  We do.
What we are saying is that the fundamentals of multi-threading, barring
some massive break through in the state-of-the -art, are
well-understood, and it is our opinion that those who think that the
language itself is somehow deficient in this regard are mistaken.

Anything that the C++ community does with regard to "adding threading
to the language" is going to eventually lead right to the primitives
that actually implement synchronization, primitives that are 40 years
old.

After all, when we talk about "threading", we are talking about
synchronization.

-Le Chaud Lapin-

--
      [ See http://www.gotw.ca/resources/clcm.htm for info about ]
      [ comp.lang.c++.moderated.    First time posters: Do this! ]


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Thant Tessman  
View profile  
 More options Jan 5 2007, 3:05 pm
Newsgroups: comp.lang.c++.moderated
From: Thant Tessman <a...@standarddeviance.com>
Date: 5 Jan 2007 15:05:24 -0500
Local: Fri, Jan 5 2007 3:05 pm
Subject: Re: C++ Threads, what's the status quo?

Francis Glassborow wrote:
I (Thant Tessman) wrote:
>> [...] Shoehorning threading
>> into C++ just seems like a misallocation of talent and
>> effort--counterproductive even. [...]

Francis Glassborow replied:

> The only deduction I can make from this is that you believe C++ should
> be dead and buried.

Yes. And I say this as someone who's made an admittedly comfortable
living programming with C++ since cfront.

> C++ without threading will be tantamount to useless
> by the end of this decade. Even mobile phones us multi-core processors
> these days.

My first-hand experience is that mobile phones in practice are
programmed usually with C, and/or a six, no, seven-year-out-of-date C++
compiler, and/or--just shoot me now--Java.

My guess is that future phones will be running either Linux, in which
case one's options could go far beyond C++ for multi-threaded
programming, or something from Microsoft, in which case they'll be
pushing their CLR.

> And my point is that multi-threading is in the process of
> becoming equivalent to concurrent programming and C++ needs to address
> that issue.

Why? (Yes, that was rhetorical.)

-thant

--
      [ See http://www.gotw.ca/resources/clcm.htm for info about ]
      [ comp.lang.c++.moderated.    First time posters: Do this! ]


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
James Kanze  
View profile  
 More options Jan 6 2007, 5:42 pm
Newsgroups: comp.lang.c++.moderated
From: "James Kanze" <james.ka...@gmail.com>
Date: 6 Jan 2007 17:42:11 -0500
Local: Sat, Jan 6 2007 5:42 pm
Subject: Re: C++ Threads, what's the status quo?

The point is that you don't know that it works, and that it
works only by chance (and may actually fail once you start using
a multi-core processor).  The point is that you don't have any
guarantees with regards to what the language or the compiler
provides.

Maybe your happen with a definition of "working" as "it hasn't
crashed yet", but my customers generally aren't.

> But I do not think it is fair to say that we do not understand the
> importance of multi-threading programming by C++ programmers.  We do.
> What we are saying is that the fundamentals of multi-threading, barring
> some massive break through in the state-of-the -art, are
> well-understood,

Which explains why so many programmers get it wrong.  (The
people who implemented std::basic_string in g++ are not idiots;
they're some of the more gifted programmers I know.  Never the
less, there is a threading error in the code.)

> and it is our opinion that those who think that the language
> itself is somehow deficient in this regard are mistaken.

You can think what you like, but you can't argue with hard
facts.  It is impossible, today, to write a multi-threaded
program with defined behavior.

> Anything that the C++ community does with regard to "adding threading
> to the language" is going to eventually lead right to the primitives
> that actually implement synchronization, primitives that are 40 years
> old.

For the moment, I think the committee has only begun to scratch
the surface with regards to primitives.  Before defining the
primitives, it is necessary to define a basic memory model; what
it means to read or wite to memory.

> After all, when we talk about "threading", we are talking about
> synchronization.

Hardly.  There's a lot more to it than that.

--
James Kanze (Gabi Software)            email: james.ka...@gmail.com
Conseils en informatique orientée objet/
                   Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34

--
      [ See http://www.gotw.ca/resources/clcm.htm for info about ]
      [ comp.lang.c++.moderated.    First time posters: Do this! ]


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Le Chaud Lapin  
View profile  
 More options Jan 7 2007, 10:37 am
Newsgroups: comp.lang.c++.moderated
From: "Le Chaud Lapin" <jaibudu...@gmail.com>
Date: 7 Jan 2007 10:37:33 -0500
Local: Sun, Jan 7 2007 10:37 am
Subject: Re: C++ Threads, what's the status quo?

James Kanze wrote:
> Le Chaud Lapin wrote:
> > The point is that C++ and threading are alive and well.  People use
> > them together.  Some people use the native API of their OS, which is
> > not always pleasant to use.  Some people wrap these API's.

> The point is that you don't know that it works, and that it
> works only by chance (and may actually fail once you start using
> a multi-core processor).  The point is that you don't have any
> guarantees with regards to what the language or the compiler
> provides.

I never asked the compiler for any guarantees.  What did you study in
university?  I do not mean to attack you personally, but frankly, these
concepts are as old as multi-threading itself.  I am appalled that so
many people seem not to understand multi-threading.

> Maybe your happen with a definition of "working" as "it hasn't
> crashed yet", but my customers generally aren't.

One of my multi-threaded application has 11 threads in it at minimum,
rising to 35 if necessary.  This application will never crash "because
of threading."

> > But I do not think it is fair to say that we do not understand the
> > importance of multi-threading programming by C++ programmers.  We do.
> > What we are saying is that the fundamentals of multi-threading, barring
> > some massive break through in the state-of-the -art, are
> > well-understood,

> Which explains why so many programmers get it wrong.  (The
> people who implemented std::basic_string in g++ are not idiots;
> they're some of the more gifted programmers I know.  Never the
> less, there is a threading error in the code.)

There is no "threading" error in the code.  If I write

int x == 10;

int thread1 ();
int thread2 ();

...and let those two threads fiddle with x without the protection of
mutual-exclusion, there will be contention. Are you saying that the
people who designed std:basic_string designed it expecting there would
be no contention?

> > and it is our opinion that those who think that the language
> > itself is somehow deficient in this regard are mistaken.

> You can think what you like, but you can't argue with hard
> facts.  It is impossible, today, to write a multi-threaded
> program with defined behavior.

I do it every day.  I know how to write multi-threaded applications.
There are probably 10,000's of programmers who do.  One should not
assume that others are unable to do that which he cannot.

> For the moment, I think the committee has only begun to scratch
> the surface with regards to primitives.  Before defining the
> primitives, it is necessary to define a basic memory model; what
> it means to read or wite to memory.

I am going to give the committee the benefit of the doubt and assume
that at least some of them understand the basics of synchronization and
OS design.  But the more I read this thread (no pun intended), the more
I get the feeling is that real problem is simply that there
C++-is-lacking-thread support crowd is primarily composed of people who
have very little or no experience with multi-threading.

I wish someone who writes operating system books for a living were
reading this.  I cannot stop laughing as I am reading this post. The
examples presented so far, two threads modifying a global
variable....leaves me...speechless.

In all fairness, I know that there are probably a few lurking
16-year-olds who, though bright, having gotten around to mutual
exclusion, and are so not sure who has more insight, so I offer this
link to get you started so you can plainly see that this is a very old
concept:

http://en.wikipedia.org/wiki/Mutual_exclusion

I did not study computer sciencel, but if you are reading this, and you
studied computer science, and you do not understand the basics of
mutual exclusion, or equivalently,

if you are in anyway, even _one iota_, surprised that a global static
variable used by std::string cannot be accessed read/write by multiple
threads without a mutex, I am sorry, there is simply no excuse - you
should be ashamed of yourself!  ?????? What do you expect??!!

See the following link: http://bardavid.com/mead/

"The mutual exclusion problem was formally defined by Edsger Dijkstra
in 1965."

These concepts are more than 40 years old, and multi-threaded
applications are written all the time, not just in C/C++, but in *many*
languages.

I am so perplexed by this discussion, I am going to over to the threads
group to see what they have to say.

-Le Chaud Lapin-

--
      [ See http://www.gotw.ca/resources/clcm.htm for info about ]
      [ comp.lang.c++.moderated.    First time posters: Do this! ]


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Peter Dimov  
View profile  
 More options Jan 7 2007, 6:17 pm
Newsgroups: comp.lang.c++.moderated
From: "Peter Dimov" <pdi...@gmail.com>
Date: 7 Jan 2007 18:17:23 -0500
Local: Sun, Jan 7 2007 6:17 pm
Subject: Re: C++ Threads, what's the status quo?

Thant Tessman wrote:

[...]

> Shoehorning threading into C++ just seems like a
> misallocation of talent and effort--counterproductive even.

Threading (concurrency + shared address space) is already in C++, and
has been for years. The primary goal of the current standardization
effort is to provide a formal specification backing that, to describe
the behavior of the various library components under real-life MT
conditions, and to provide a portable and standard way to get to the
functionality that is already available, not to invent or to shoehorn.

--
      [ See http://www.gotw.ca/resources/clcm.htm for info about ]
      [ comp.lang.c++.moderated.    First time posters: Do this! ]


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Dilip  
View profile  
 More options Jan 7 2007, 6:32 pm
Newsgroups: comp.lang.c++.moderated
From: "Dilip" <rdil...@lycos.com>
Date: 7 Jan 2007 18:32:54 -0500
Local: Sun, Jan 7 2007 6:32 pm
Subject: Re: C++ Threads, what's the status quo?

Le Chaud Lapin wrote:
> James Kanze wrote:
> > You can think what you like, but you can't argue with hard
> > facts.  It is impossible, today, to write a multi-threaded
> > program with defined behavior.

> I do it every day.  I know how to write multi-threaded applications.
> There are probably 10,000's of programmers who do.  One should not
> assume that others are unable to do that which he cannot.

Ooh!  Bold assertion.  Exactly the opposite of my experience.  I am yet
to meet a guy who knows a synchronization primitive from his backside
and this is after he wrote an application that spawned 45 threads to do
some activity.

> > For the moment, I think the committee has only begun to scratch
> > the surface with regards to primitives.  Before defining the
> > primitives, it is necessary to define a basic memory model; what
> > it means to read or wite to memory.

> I am going to give the committee the benefit of the doubt and assume
> that at least some of them understand the basics of synchronization and
> OS design.  But the more I read this thread (no pun intended), the more
> I get the feeling is that real problem is simply that there
> C++-is-lacking-thread support crowd is primarily composed of people who
> have very little or no experience with multi-threading.

Good heavens!  How did a statement like that pass the moderators?  This
guy is giving the benefit of doubt to Hans Boehm?  This kind of dual
standards is very confusing.  In another thread (subject: "Threads -
When?") I tried to correct James Kanze's unfair (and uninformed)
characterization of Jeffrey Richter as someone who has "no clue what
multithreading is all about" and it never showed up even after 4 days
and some thing like the above breezes right past in?

Anyway, to the OP -- can you please read this:
http://www.artima.com/cppsource/threads_meeting.html
before adopting that elitist attitude.

--
      [ See http://www.gotw.ca/resources/clcm.htm for info about ]
      [ comp.lang.c++.moderated.    First time posters: Do this! ]


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Mirek Fidler  
View profile  
 More options Jan 7 2007, 6:35 pm
Newsgroups: comp.lang.c++.moderated
From: "Mirek Fidler" <c...@ntllib.org>
Date: 7 Jan 2007 18:35:07 -0500
Local: Sun, Jan 7 2007 6:35 pm
Subject: Re: C++ Threads, what's the status quo?

Ahh... I guess you should seriously reconsider the issue.

Recommended reading is e.g. google: "why double checked guard does not
work".

Just for starters, if you have

Shared y;
Mutex y_lock;

void fn() {
   y_lock.Lock();
   y = 10;
   y_lock.Unlock();

}

nothing in C++ standard prevents C++ compiler to generate machine code
equivalent to

void fn() {
   y = 10;
   y_lock.Lock();
   y_lock.Unlock();

}

(and now I recommend you to get some C++ reeducation before your
threads start to fail with new compiler version ;)

Mirek

--
      [ See http://www.gotw.ca/resources/clcm.htm for info about ]
      [ comp.lang.c++.moderated.    First time posters: Do this! ]


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Simon Farnsworth  
View profile  
 More options Jan 8 2007, 2:07 am
Newsgroups: comp.lang.c++.moderated
From: Simon Farnsworth <use...@farnz.org.uk>
Date: 8 Jan 2007 02:07:30 -0500
Local: Mon, Jan 8 2007 2:07 am
Subject: Re: C++ Threads, what's the status quo?

There are *important* threading related guarantees that the standard has
nothing to say about. For example, there's no way to ensure that cached
memory is consistent between two CPUs running two threads; you have no way
to tell if a particular operation represents a synchronisation operation.

Further, the standard is silent on whether you can assume strict
consistency, weak consistency, sequential consistency, causual consistency,
or another consistency model.

These are both important if you want to guarantee that an operation between
two threads working in parallel on the same block of memory does what you
expect. In a weak consistency model, it's impossible to implement a working
mutex without knowing which operations are synchronisation operations; your
environment typically handles this by arbitrarily declaring that some
library calls are synchronisation operations.

On top of this, in a weak consistency model, you need to know which
operations are synchronisation operations to be certain that two processors
have the same view of memory; without that knowledge, two different
processors reading from the same bit of memory are entitled to return
different values.
--
Simon Farnsworth

      [ See http://www.gotw.ca/resources/clcm.htm for info about ]
      [ comp.lang.c++.moderated.    First time posters: Do this! ]


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Chris Thomason  
View profile  
 More options Jan 8 2007, 2:49 am
Newsgroups: comp.lang.c++.moderated
From: "Chris Thomason" <cris...@comcast.net>
Date: 8 Jan 2007 02:49:46 -0500
Local: Mon, Jan 8 2007 2:49 am
Subject: Re: C++ Threads, what's the status quo?
"Mirek Fidler" <c...@ntllib.org> wrote in message

news:1168188975.880690.14790@38g2000cwa.googlegroups.com...

> Le Chaud Lapin wrote:
>> James Kanze wrote:
[...]
>> I never asked the compiler for any guarantees.  What did you study in
>> university?  I do not mean to attack you personally, but frankly, these
>> concepts are as old as multi-threading itself.  I am appalled that so
>> many people seem not to understand multi-threading.

> Ahh... I guess you should seriously reconsider the issue.

> Recommended reading is e.g. google: "why double checked guard does not
> work".

DCL works perfectly fine:

--
      [ See http://www.gotw.ca/resources/clcm.htm for info about ]
      [ comp.lang.c++.moderated.    First time posters: Do this! ]


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Le Chaud Lapin  
View profile  
 More options Jan 8 2007, 2:48 am
Newsgroups: comp.lang.c++.moderated
From: "Le Chaud Lapin" <jaibudu...@gmail.com>
Date: 8 Jan 2007 02:48:24 -0500
Local: Mon, Jan 8 2007 2:48 am
Subject: Re: C++ Threads, what's the status quo?

Dilip wrote:
> Le Chaud Lapin wrote:
> > I do it every day.  I know how to write multi-threaded applications.
> > There are probably 10,000's of programmers who do.  One should not
> > assume that others are unable to do that which he cannot.

> Ooh!  Bold assertion.  Exactly the opposite of my experience.  I am yet
> to meet a guy who knows a synchronization primitive from his backside
> and this is after he wrote an application that spawned 45 threads to do
> some activity.

That's why I wrote ten's of thousands instead of millions. I could take
the computer science students from the top computer science schools
around the world.  I think I would be able to find 10,000's of people
in that group who understand the basics of synchronization.

> > I am going to give the committee the benefit of the doubt and assume
> > that at least some of them understand the basics of synchronization and
> > OS design.  But the more I read this thread (no pun intended), the more
> > I get the feeling is that real problem is simply that there
> > C++-is-lacking-thread support crowd is primarily composed of people who
> > have very little or no experience with multi-threading.

> Good heavens!  How did a statement like that pass the moderators?  This
> guy is giving the benefit of doubt to Hans Boehm?  This kind of dual
> standards is very confusing.  In another thread (subject: "Threads -
> When?") I tried to correct James Kanze's unfair (and uninformed)
> characterization of Jeffrey Richter as someone who has "no clue what
> multithreading is all about" and it never showed up even after 4 days
> and some thing like the above breezes right past in?

It is not a dual standard.  The moderators let it pass probably because
I was not the one who originally hinted that.  And let's face it -
there are lurkers in this group (trust me) reading this thread, and
there is a strong polarization going on here.  I can assure you that I
am not the only one who feels that there is a disconnect regarding the
difficulty to which multi-threading is done.

> Anyway, to the OP -- can you please read this:
> http://www.artima.com/cppsource/threads_meeting.html
> before adopting that elitist attitude.

Hmm....reading this link gave me the same feeling I get when we were
talking about whether C++ should be "migrated" to CLI, whether we
should add GC to the language, whether the type system of C++ was
fundamental or should be integrated with Microsoft's .NET CTS...

...basically, everything that involved changing C++ in such a way that
it would be more like languages that are not like C++.

There is a pattern that seems to be going on.  I will post more in a
separate when I think I have figured out what that pattern is.

-Le Chaud Lapin-

--
      [ See http://www.gotw.ca/resources/clcm.htm for info about ]
      [ comp.lang.c++.moderated.    First time posters: Do this! ]


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Le Chaud Lapin  
View profile  
 More options Jan 8 2007, 2:57 am
Newsgroups: comp.lang.c++.moderated
From: "Le Chaud Lapin" <jaibudu...@gmail.com>
Date: 8 Jan 2007 02:57:47 -0500
Local: Mon, Jan 8 2007 2:57 am
Subject: Re: C++ Threads, what's the status quo?

Are you saying that the C++ standard does not prescribe sequential
execution of statements in a single-threaded program?

If that is the case, then I could write a single-threaded application
that would not behave as a programmer would expect using an example
very similar to the one you gave.

Also, do you have a link regarding the quote above for Google? I
looked, and did not find what I think you were suggesting.

-Le Chaud Lapin-

--
      [ See http://www.gotw.ca/resources/clcm.htm for info about ]
      [ comp.lang.c++.moderated.    First time posters: Do this! ]


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Chris Thomason  
View profile  
 More options Jan 8 2007, 2:56 am
Newsgroups: comp.lang.c++.moderated
From: "Chris Thomason" <cris...@comcast.net>
Date: 8 Jan 2007 02:56:01 -0500
Local: Mon, Jan 8 2007 2:56 am
Subject: Re: C++ Threads, what's the status quo?
ACK! I forgot the darn link:

http://groups.google.com/group/comp.lang.c++.moderated/msg/e161a53de7...

Sorry for any confusion!

;^(...

--
      [ See http://www.gotw.ca/resources/clcm.htm for info about ]
      [ comp.lang.c++.moderated.    First time posters: Do this! ]


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Messages 1 - 25 of 202   Newer >
« Back to Discussions « Newer topic     Older topic »