Synchronized Add and Fetch (SYNCADDF)

Instruction Syntax

Bound Program Access
Built-in number for SYNCADDF4 is 730.
SYNCADDF4 (                                                                      
          op1   : address of a signed binary(4) value  (has                      
                   alignment restrictions                                       
                   - see description below)                                     
          op2   : signed binary(4) value                                          
) : signed binary(4)                                                              
                                                                                
Built-in number for SYNCADDF8 is 731.
SYNCADDF8 (                                                                      
          op1   : address of a signed binary(8) value  (has                      
                   alignment restrictions                                       
                   - see description below)                                     
          op2   : signed binary(8) value                                          
) : signed binary(8)                                                              

Description:

Synchronizes storage then atomically increments the value pointed to by op1 by the value op2. Returns the new value pointed to by op1.

The value pointed to by op1 and the op2 value must have the same length. Failure to have the operands the same length will not be detected and the results of the instruction are undefined when this occurs. The first operand must be aligned based on its length:

  • four byte length - 4-byte aligned
  • eight byte length - 8-byte aligned
Failure to have the first operand aligned properly will not be detected, but the results of the instruction are undefined when this occurs.

The arithmetic performed by this instruction will not signal any exceptions.

This operation is useful when a variable is shared between two or more threads. When updating such a variable, it is important to make sure that the entire operation is performed atomically (not interruptible). See Atomicity for additional information.

The primary purpose of this instruction is to manipulate a variable which is shared by two or more threads. When sharing more than one variable between multiple threads or processes, be aware of storage synchronization issues. See Storage Synchronization Concepts for additional information.

Usage note:This usage note applies when the address passed as the first argument refers to a memory location in the first (partial) page of a space for which the "Machine chooses space alignment" option was not specified when it was created. On all current and foreseen implementations of the machine, under these conditions, this MI Instruction will generate a space addressing violation (hex 0601) exception.

Authorization Required

  • None

Lock Enforcement

  • None

Exceptions

  • 06 Addressing
    • 0601 Space Addressing Violation
    • 0602 Boundary Alignment
    • 0603 Range
  • 08 Argument/Parameter
    • 0801 Parameter Reference Violation
  • 10 Damage Encountered
    • 1004 System Object Damage State
    • 1044 Partial System Object Damage
  • 1C Machine-Dependent
    • 1C03 Machine Storage Limit Exceeded
  • 20 Machine Support
    • 2002 Machine Check
    • 2003 Function Check
  • 22 Object Access
    • 2201 Object Not Found
    • 2202 Object Destroyed
    • 2203 Object Suspended
    • 2208 Object Compressed
    • 220B Object Not Available
  • 24 Pointer Specification
    • 2401 Pointer Does Not Exist
    • 2402 Pointer Type Invalid
  • 2C Program Execution
    • 2C04 Branch Target Invalid
  • 36 Space Management
    • 3601 Space Extension/Truncation
  • 44 Protection Violation
    • 4401 Object Domain or Hardware Storage Protection Violation
    • 4402 Literal Values Cannot Be Changed