Process in the World as a Transaction Nick Rossiter, Michael Heather Northumbria University nick.rossiter@unn.ac.uk http://computing.unn.ac.uk/staff/cgnr1/
Classical (Database) Transactions Properties of ACID: Atomicity collection of operations viewed as single process Consistency rules of organisation obeyed Isolation no results released until end Durability results are guaranteed to persist
Closure is Difficult For instance in ATM withdrawal: mixture of physical and logical tasks once cash given to customer, cannot undo bank at risk unless results are immediately durable Notion of Transaction Log: save results to a number of different targets (disks) only complete when successfully write to last target disk
Recovery If bank information system crashes; transaction log can be run through from last known position (savepoint) to most recent successful transaction partial transactions are discarded So if disk crashes after customer paid £1,000,000 in a suitcase of notes system will re-run the transaction and customer will have account debited
But some risk remains Strategy A to favour bank: If ATM crashes before money paid out and after last transaction log entry made: customer’s account is debited but customer has no cash Strategy B to favour customer: If transaction log entry fails after cash paid to customer: customer has the cash and no debit to account
In practice A bank would probably not adopt strategy B as it could lose money Strategy A is workable if: ATM downtimes are accurately recorded Enables customer accounts to be corrected Corrections could be made semi-automatically with supervisory control Recourse to higher level
Problem of Physical/Logical Mix Example of the principle of Landauer Information cannot exist except in the physical form All transactions ultimately involve physical objects need to handle together physical entities logic of the information system
Parallel processing Transactions involve a sequence of operations But often the operations should be in parallel Sequence is used because of: von Neumann architecture locality of view sequence of operations between fixed cells
Theory of Transactions Need constructions to: represent changes between states as dynamic relationships indicate desired change in state indicate rules controlling change in state measure changes in state that occur
Satisfying Theory - Category Theory Need constructions to: represent changes between states as dynamic relationships adjunctions indicate desired change in state free functor (F) indicate rules controlling change in state underlying functor (G) measure changes in state that occur unit and counit of adjunction (, ) from left-adjoint perspective from right-adjoint perspective
Adjunction Example: Mapping Universe to Information System
Initial State Blue = category/object; red = functor; green = natural transformation
One cycle -- to right (F) and left (G) -- no change
One cycle -- to right (GF) and left (FG) -- change by in S and in A Adjoint if triangles commute If is or is , then equivalence relation
Two cycles -- to right (GFGF) and left (FGFG) -- change by in S and in A Gives symmetry in treatment of S and A Dynamical relationship Perhaps one cycle enforces rules, second cycle commits
Abstract View of Effect of GF
Textbook representation of adjunction -- triangle only
Transactions are Non-local This banking transaction is typical of any transaction as a non-local process. The log provides a parallel information system: looking forward to the sequence looking back to check that what was expected was achieved.
Possible Approaches to Banking ATM Transaction Security Bank Customer Funds-check Grant Cash Simple commutative requirement Grant = Funds-check o Security Does not show state changes or rules
-| f* -| Adjointness between Customer and Bank Bank Customer Pin number String match f* Customer Bank Access -| f* -| Better, shows relationships as adjunctions Does not show state changes
One cycle -- to right (FG) and left (GF) -- change by in S (Customer) and in A (Bank) F Funds request (free functor), G Status check (underlying functor applying rules) If is or is ,then no change to categories so back to initial state - transaction is aborted
Two cycles -- to right (GFGF) and left (FGFG) -- change by in S and in A Second cycle acts from banking perspective Introduces g in bank category Commits and releases cash Should be brief in execution for safety
Achievement of ACID A, I are natural, achieved through closure in adjointness C is natural, achieved through underlying functor in adjointness D is natural, represented by back and forward components log file is not represented directly but such a file is an artefact needed in a sequential system
Universe Transactions The universe carries out transactions all the time non-locally mediating between objects in time and space. nevertheless still has the forward and back components except that they are non-local.