Вы находитесь на странице: 1из 1

What is a Transaction?

Transactions are mainly studied in the context of [distributed] data bases, but the concept is a
model on how to implement reliable [distributed] applications. Often people refer to the
desired properties of transactions using the ACID acronym:
Atomicity: All or none behaviour.
Consistency: Each transaction is correct, that is, it preserves the invariants of the
system (things like "the sum of all credits and debits is zero"); the concurrent
execution of transactions also preserves the invariants of the system.
Isolation: Intermediate results during execution are invisible. This is like saying that
the effect of the concurrent execution of transactions is equivalent to their serial
execution (thus, also called Serializability).
Durability: the effect of a transaction that completes successfully is persistent.
Isolation is achieved by using serializable schedules (usually, two-phase locking); durability
is achieved by saving results in persistent store; consistency is required of the people that
develop the transactions, at the application, not at the tool level [a money transfer transaction
should worry about preserving accounting rules, not the system - however, if the invariant is
formally specified, the system will fail transactions that violate the invariant]; and atomicity
is achieved in two steps, first in single systems (usually with logs), then in distributed
systems (usually with the two-phase commit protocol).
Transactions are easy to use. A Transaction Server will support operations to Start a
Transaction and to End a Transaction. The termination of a transaction can take two forms:
success, called commit, and failure, called abort. Abort gives up on the current transaction.
Many are the reasons for aborting a transaction. They range from the internal logic of the
transaction (like making reservations for a multi leg trip and then giving up in the middle
when a particular leg cannot be scheduled) to crashes occurring in one of the systems taking
part in a distributed transaction. When a transaction commits or aborts, many house-keeping
action will be required to complete ("close the books" on) the transaction. The Transaction
Server will worry about how to guaranty transactionality for the actions performed between
the Start and End delimiters. It is a "service" provided to us without need for us to program
anything: it is both valuable and free.
The concept "transaction" is fundamental in our discipline. It takes a number of operations
and executes them atomically, without any worry about potential concurrent activities. As the
systems of the future will have a multitude of processors and people confront the fact that
concurrent programming with threads and locks is hard and error prone, alternatives are
sought. Transactions offer an alternative way of dealing with concurrency. Already people
have been working on Software Transactional Memory [STM]. It is likely to be influential in
the future.

Вам также может понравиться