On Wed, 2017-06-14 at 10:40 +0000, gzp via Digitalmars-d wrote:
> After digging into it the source for me it seems as D is lacking 
> a "standardized" atomic library. It has some basic concepts, but 
> far behind the c++ standards.
> I don't know if there are any RFC-s in this topic but it requires 
> a lot of work. Just to mention some by my first experience:
> 
> cas
> in all api I've seen on a failed swap, the current value is 
> retrieved
> (in c/c++ there are intrinsic for them)

This appears to be in core.atomic.

> exchange
> no api for it and not implementable without spinning
> (in c/c++ there are intrinsic for them)


> atomicFence
> No memory ordering is considered in the API
> Even tough it falls back to the strongest/slowest one for the 
> current implementation it should be part of the API.

Appears to be in core.atomic.

> If D wants be be a real system programming language (ex a 
> replacement for c++) please address these issues. I'm not an 
> expert on the subject, but D seems to be in a c++11 stage where 
> compiler/memory barriers and atomic had to be implemented 
> differently for each platform and the programmer could only hope 
> that compiler won't f*ck up everything during optimization.
> 
> I don't know if D compiler is aware of the fences and won't move 
> out/in instructions from guarded areas.

I am fairly sure it isn't, but why is this needed if you use a
parallelism oriented approach to the architecture and design? Sorry to
repeat but whilst there are circumstances where this stuff is needed
(operating systems), most other applications should be written without
the need for locks, mutexes, fences, memory model, etc. any need for
that stuff should be covered in the frameworks used.

We need to be careful not to bring 1960s views of threads into 2010
programming. Sometimes they are needed, usually they are not. 

-- 
Russel.
=============================================================================
Dr Russel Winder      t: +44 20 7585 2200   voip: sip:russel.win...@ekiga.net
41 Buckmaster Road    m: +44 7770 465 077   xmpp: rus...@winder.org.uk
London SW11 1EN, UK   w: www.russel.org.uk  skype: russel_winder

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to