Re: Threading in new C++ standard
On Apr 21, 1:14 am, Szabolcs Ferenczi <szabolcs.feren...@gmail.com>
wrote:
On Apr 20, 6:36 pm, James Kanze <james.ka...@gmail.com> wrote:
On 20 avr, 13:42, Szabolcs Ferenczi <szabolcs.feren...@gmail.com>
wrote:
...
Any decent concurrent programming language must provide some
language means to:
(1) mark the shared resources
(2) mark the associated Critical Regions
This way the compiler can and must check whether the shared
resource is accessed inside Critical Regions only.
From what I understand, that's more or less the way Ada works.
From what you understand, maybe yes. I must tell you that
there was life before Ada in the area of concurrent
programming and there are other genuine concurrent programming
languages than Ada. But Ada was certainly the state of the art
concurrent programming language at a time.
I'm aware of that. Since then, the state of the art has moved
on, and the Ada model is really considered a bit too
constricting.
However, the multi-core boom was not there yet.
Maybe not in your world. I had to deal with parallel processors
in some of my work in the late 1970's. During the eighties, the
automation of parallel processing was the rage in compilers.
It's only recently that such parallelism has descended to the
PC's, but it's hardly new.
In an object-oriented language the two issues (i.e. the
shared resource and the associated Critical Region) are
naturally combined in the concept of the shared class (see
also Monitor). The checking function of the compiler can
prevent a good deal of concurrent programming errors
Funny. Concurrent programs in Ada have exactly the same
problems as those in C++.
Funny indeed. C++ is a pure sequential programming language
but Ada is a high level concurrent programming language
tackling concurrency at the language level. How can you
compare them from the concurrency point of view?
Why not? You have exactly the same problems writing correct
multithreaded code in Ada as you do in C or C++ under Posix.
Concurrent programs has nothing to do with C++ so far since
you are just working on the enhancement of C++.
Consequently, concurrent programs in Ada CANNOT have exactly
the same problems as those in C++. It would be funny, indeed.
Except that they do. The suffer from deadlocks, and race
conditions, and all of the same problems C and C++ programs
suffer from.
Welcome to the real world.
--
James Kanze (GABI Software) email:james.kanze@gmail.com
Conseils en informatique orient=E9e objet/
Beratung in objektorientierter Datenverarbeitung
9 place S=E9mard, 78210 St.-Cyr-l'=C9cole, France, +33 (0)1 30 23 00 34