Title: Process in the World as a Transaction
1Process in the World as a Transaction
- Nick Rossiter, Michael Heather
- Northumbria University
- nick.rossiter_at_unn.ac.uk
- http//computing.unn.ac.uk/staff/cgnr1/
2Classical (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
3Closure 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
4Recovery
- 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
5But some risk remains
- Strategy A to favour bank
- If ATM crashes before money paid out and after
last transaction log entry made - customers 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
6In 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
7Problem 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
8Parallel 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
9Theory 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
10Satisfying 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
11Adjunction Example Mapping Universe to
Information System
A
12Initial State
Blue category/object red functor green
natural transformation
13One cycle -- to right (F) and left (G) -- no
change
14One 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
15Two 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
16Abstract View of Effect of GF
17Textbook representation of adjunction --
triangle only
18Transactions 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.
19Possible 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
20Adjointness between Customer and Bank
Pin number ?
String match f
Bank
Customer
Access ?
? - f - ?
Better, shows relationships as adjunctions Does
not show state changes
21One 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
22Two 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
23Achievement 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
24Universe 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.