[cpp-threads] Presenting threading to users

Lawrence Crowl Lawrence at Crowl.org
Sun May 6 22:39:16 BST 2007


On 5/6/07, Nick Maclaren <nmm1 at cus.cam.ac.uk> wrote:
> This is roughly how I see the presentation, using the broadest of
> brushes.  Herb may correct me, but I think that it's what he is
> looking for, too.
>
> Level 1 (90% of users):  they should use library X, preprocessor Y,
> development environment, all of which will present a high-level
> interface to them and hide all of the detailed threading control.
> Fortran OpenMP can be used in this mode, but C++ OpenMP can't; C++
> could provide threaded classes, in theory, but that is for the
> future.  Anyway, all of this is outside the standard.

I think initially there will be less than 90% due to lack of solutions.
In the long run, I would hope it would be even higher.

> Level 2 (9% of users):  they should use the locking and high-level
> atomics in SIMPLE ways, and call in an expert as soon as they start
> doing anything in the slightest bit complicated.  Who will almost
> always say "don't" :-)

I would split this into two levels, those that use locks and prepared
atomic facilities, and those that use the ordered atomics.  By prepared
facilities, I mean things like lazy initialization, fast counters, etc.  For
this we need a library.

> Level 3 (1% of users):  these are developing the tools mentioned in
> level 1, need access to the low-level primitives, and may need to
> be subtle.  If they can't handle that, they are the wrong people
> for the job
>
> I would categorise myself as a level 2.5 person - I know enough
> about the low level to use it, but only with a decent reference
> in front of me, a lot of paper and extended peace and quiet to
> work it out.  And even then, I will get it wrong a lot of the
> time :-)
>
> Because of the problems, the standard should make it clear when a
> programmer is using a purely level 3 primitive, and provide a way
> for an expert to check that in a user's program when the user
> denies that he has done so!  grep is fine for the latter; anyone
> who uses the preprocessor to build names is already beyond hope.

And any use of those facilities should result in a very careful code
review.  I don't know how we could say such things in the standard,
but we can make our approach known informally.

-- 
Lawrence Crowl



More information about the cpp-threads mailing list