sync(3I)

LOCK_RELEASE, SYNCHRONIZE, AND_AND_FETCH, ADD_AND_FETCH, COMPARE_AND_SWAP, FETCH_AND_ADD, FETCH_AND_AND, FETCH_AND_NAND, FETCH_AND_OR, FETCH_AND_SUB, FETCH_AND_XOR, LOCK_TEST_AND_SET, NAND_AND_FETCH, OR_AND_FETCH, SUB_AND_FETCH, XOR_AND_FETCH, - Fortran synchronization intrinsics for multiprocessing

As shipped in IRIX 6.5.5. Added in IRIX 6.5.5.

NAME
     LOCK_RELEASE, SYNCHRONIZE, AND_AND_FETCH, ADD_AND_FETCH,
     COMPARE_AND_SWAP, FETCH_AND_ADD, FETCH_AND_AND, FETCH_AND_NAND,
     FETCH_AND_OR, FETCH_AND_SUB, FETCH_AND_XOR, LOCK_TEST_AND_SET,
     NAND_AND_FETCH, OR_AND_FETCH, SUB_AND_FETCH, XOR_AND_FETCH, - Fortran
     synchronization intrinsics for multiprocessing

SYNOPSIS
     CALL LOCK_RELEASE ([I=]i)
     CALL SYNCHRONIZE
     ADD_AND_FETCH ([I=]i, [J=]j)
     AND_AND_FETCH ([I=]i, [J=]j)
     COMPARE_AND_SWAP ([I=]i, [J=]j, [K=]k)
     FETCH_AND_ADD ([I=]i, [J=]j)
     FETCH_AND_AND ([I=]i, [J=]j)
     FETCH_AND_NAND ([I=]i, [J=]j)
     FETCH_AND_OR ([I=]i, [J=]j)
     FETCH_AND_SUB ([I=]i, [J=]j)
     FETCH_AND_XOR ([I=]i, [J=]j)
     LOCK_TEST_AND_SET ([I=]i, [J=]j)
     NAND_AND_FETCH ([I=]i, [J=]j)
     OR_AND_FETCH ([I=]i, [J=]j)
     SUB_AND_FETCH ([I=]i, [J=]j)
     XOR_AND_FETCH ([I=i, [J=]j)

IMPLEMENTATION
     IRIX systems

     MIPSpro 7 Fortran 90

STANDARDS
     Fortran extension

DESCRIPTION
     The synchronization intrinsics provide a variety of synchronization
     operations.  LOCK_RELEASE and SYNCHRONIZE are intrinsic subroutines;
     all the others are elemental intrinsic functions.  These intrinsics
     accept the following arguments:

     i         An integer.  i must be KIND=4 or KIND=8.

     j         An integer.  j must be the same kind type as i.

     k         An integer.  k must be the same kind type as i and j.

     The memory barrier intrinsics perform either an acquire barrier,
     release barrier, or full barrier operation.  The operation type and
     the intrinsics that accomplish that type of task are as follows:

     Type                Description

     Acquire barrier     Prevents the movement of memory references to
                         visible data from after the intrinsic (in program
                         order) to before the intrinsic.  This behavior is
                         desirable for lock-acquire operations.

                         Acquire barrier operations can be accomplished by
                         using the LOCK_TEST_AND_SET intrinsic subroutine.
                         This subroutine atomically stores the value of the
                         second argument into the first argument.  It
                         returns the old value of the first argument.

     Release barrier     Prevents the movement of memory references to
                         visible data from before the intrinsic (in program
                         order) to after the intrinsic.  This behavior is
                         desirable for lock-release operations.

                         Release barrier operations can be accomplished by
                         using the LOCK_RELEASE intrinsic subroutine.  This
                         subroutine sets its argument to zero.

     Full barrier        Prevents the movement of memory references to
                         visible data past the intrinsic in either
                         direction.  These act as both an acquire and a
                         release barrier.  A barrier only restricts the
                         movement of memory references to visible data
                         across the intrinsic operation.  Between
                         synchronization operations (or in their absence),
                         memory references to visible data can be freely
                         reordered, subject to the usual data-dependence
                         constraints.

                         Full barrier operations are divided into the
                         following groups:

                         * Atomic FETCH_AND_op operations.  The
                           FETCH_AND_ADD, FETCH_AND_AND, FETCH_AND_NAND,
                           FETCH_AND_OR, FETCH_AND_SUB, and FETCH_AND_XOR
                           intrinsic functions perform the operation with
                           the second argument on the first argument.  They
                           return the old value of the first argument.

                         * Atomic op_AND_FETCH operations.  The
                           ADD_AND_FETCH, AND_AND_FETCH, NAND_AND_FETCH,
                           OR_AND_FETCH, SUB_AND_FETCH, and XOR_AND_FETCH
                           intrinsic functions perform the operation with
                           the second argument on the first argument.  They
                           return the new value of the second argument.

                         * Atomic COMPARE_AND_SWAP operation.  The
                           COMPARE_AND_SWAP intrinsic function compares the
                           value of the first argument to the value of the
                           second.  If they are equal, the value of the
                           third argument is stored into the first and the
                           return value is TRUE.  Otherwise, the return
                           value is FALSE.

                         * Atomic SYNCHRONIZE operation.  This is performed
                           with the SYNCHRONIZE intrinsic subroutine.

RETURN VALUES
     The COMPARE_AND_SWAP intrinsic function returns TRUE or FALSE.  All
     other intrinsic functions return a value of type integer.  The integer
     values returned are of the same kind type as the arguments provided.

NOTES
     Each intrinsic possesses two key properties:

     * The operation performed is guaranteed to be atomic.  This is
       typically achieved by implementing the operation using a sequence of
       load-linked/store-conditional instructions in a loop.

     * Associated with each intrinsic are certain memory barrier properties
       that restrict the movement of memory references to visible data
       across the intrinsic operation (by either the compiler or the
       processor).

     A visible memory reference is a reference to a data object potentially
     accessible by another thread executing in the same shared address
     space. A visible data object can be one of the following:

     * C/C++ global data

     * Fortran COMMON data

     * VOLATILE data

     * Static data (either file-scope or function-scope)

     * Data accessible through function parameters

     * AUTOMATIC data (local-scope) that has had its address taken and
       assigned to some object that is visible (recursively).

CAUTIONS
     Conditional execution of a synchronization intrinsic, such as within
     an IF or WHILE block, does not prevent the movement of memory
     references to visible data past the overall IF or WHILE construct.

SEE ALSO
     This man page is available only online.