Indeterminate software is characterized by accepting inputs, processing that input, and generating output in an order that cannot be accurately predicted. Examples include multi-user applications, applications that accept dynamic user input, or even applications traditionally regarded as determinate that are highly parallelized.
Indeterminate applications require a greater level of consideration for the interleaving of data to prevent illegal operations. For example, an online trading application may have two threads: one for buying shares of a security and one for selling. If a user initiates a buy and partial sell of a security simultaneously there could be conflicting operations.
More specifically, a position held by that user at the newly-purchased price could be sold rather than a position held at a previously-purchased price (higher or lower.) The trading application would process the user actions in two threads. To avoid such conflicting situations, data access applications, such as database management systems (DBMS) rely on principles of atomicity. These principles of synchronous actions can be broken into two categories:
Compare and Swap
Compare and Swap (CAS) operations require three primary arguments to complete: memory location (network or local), expected value, and updated value. In such cases where expected values aren’t matching actual values, a CAS operation fails.
Load-Links & Store-Conditional
This approach uses two interlinked operations: load linked and store conditional. The LL operation reads from a memory address (local or remote) and the SC operation stores the updated value. Similar to CAS, if the SC finds the expected value mismatched to the actual value the operation will fail.