(j3.2006) Fwd: Lock variables

Aleksandar Donev donev1
Sat Mar 14 12:16:25 EDT 2009


Hi,

I have been incognito for a while, so a few belated comments:
> ---------- Forwarded message ----------
> From: *Andy Vaught* <andyv at firstinter.net <mailto:andyv at firstinter.net>>
>  A compare and swap works for single threads, multiple threads, coarrays
> implemented as shared memory and coarrays implemented as messages over
> networks.
These options were discussed in subgroup. Ultimately, it should be noted 
that locks were adopted for two main reasons:
1) They were proposed by a group working on a CAF implementation (lead 
by Dr. Mallor-Crummey)
2) They are common in many languages/libraries
Everyone had/has their own preference, and this was by far the safest 
option. I for one much prefer an ATOMIC block construct...

>  Instead of a two new statments, a new intrinsic derived type and half a
> dozen new intrinsic procedures, all that is needed is a single intrinsic
> procedure:


In theory. But then you come to your actual example of
> subroutine atomic_increment(count)
and you see code like:
>    n = min(n+1, 10)    ! Exponential backoff on failure
>    call usleep(2**n)
that is in fact:
-Machine specific
-Not optimal on all architectures
-Hard for a typical programmer to write well
-Not belonging to a high level language like Fortran

Locks are abstractions, at least.

Best,
Aleks

-- 
Aleksandar Donev, Ph.D.
Lawrence Postdoctoral Fellow @ LLNL
High Performance Computational Materials Science and Chemistry
E-mail: donev1 at llnl.gov
Phone: (925) 424-6816  Fax: (925) 423-0785
Address: P.O.Box 808, L-367, Livermore, CA 94551-9900
Web: http://cherrypit.princeton.edu/donev




More information about the J3 mailing list