Elmasri 6e Ch21 Transaction Processing
Elmasri 6e Ch21 Transaction Processing
Introduction to
Transaction
Processing
Concepts and
Theory
1 Introduction to Transaction Processing
Single-User System:
At most one user at a time can use the system.
Multiuser System:
Many users can access the system concurrently.
Concurrency
Interleaved processing:
Concurrent execution of processes is interleaved in
a single CPU
Parallel processing:
Processes are concurrently executed in multiple
CPUs.
A Transaction:
Logical unit of database processing that includes one or more
access operations (read -retrieval, write - insert or update,
delete).
block that contains
Copy that disk block into a buffer in main memory (if that disk
block is not already in some main memory buffer).
Copy item X from the buffer to the program variable named X.
record X?
Extended & Improved
by
KMK
Introduction to Transaction Processing (5)
READ AND WRITE OPERATIONS (cont.):
write_item(X) command includes the following steps:
Find the address of the disk block that contains item X.
Copy that disk block into a buffer in main memory (if that disk
block is not already in some main memory buffer).
Copy item X from the program variable named X into its correct
location in the buffer.
Store the updated block from the buffer back to disk (either
immediately or at some later point in time).
Committed state
Failed state
Terminated State
Committed state
Failed state
Terminated State
(Notice that the log file must be kept on disk. At the time of a
system crash, only the log entries that have been written back to
disk are considered in the recovery process because the contents
of main memory may be lost.)
ACID properties:
Atomicity: A transaction is an atomic unit of processing; it is either
performed in its entirety or not performed at all.
Consistency preservation: A correct execution of the transaction
must take the database from one consistent state to another.
Isolation: A transaction should not make its updates visible to other
transactions until it is committed; this property, when enforced strictly,
solves the temporary update problem and makes cascading rollbacks
of transactions unnecessary (see Chapter 21).
Durability or permanency: Once a transaction changes the
database and the changes are committed, these changes must never
be lost because of subsequent failure.
Serial schedule:
A schedule S is serial if, for every transaction T
participating in the schedule, all the operations of
T are executed consecutively in the schedule.
Otherwise, the schedule is called nonserial
schedule.
S1 S2
S3 S4
Serializable schedule:
A schedule S is serializable if it is equivalent to
some serial schedule of the same n transactions.
Example: Consider following Serial Schedules S1
and S2
S1 S2
S3
Serializable schedule:
S is serializable if there is a serial
schedule S' such that for every initial database
state, the effects of S and S‘ are the same.
Result equivalent:
Two schedules are called result equivalent if they
produce the same final state of the database.
Conflict equivalent:
Two schedules are said to be conflict equivalent if
the order of any two conflicting operations is the
same in both schedules.
Result equivalent:
Two schedules are called result equivalent if they
produce the same final state of the database.
Conflict equivalent:
Two schedules are said to be conflict equivalent if
the order of any two conflicting operations is the
same in both schedules.
What are the “conflicting operations”?
Conflict serializable:
A schedule S is said to be conflict serializable if
it is conflict equivalent to some serial schedule S’.
View serializability:
Definition of serializability based on view
equivalence.
A schedule is view serializable if it is view
equivalent to a serial schedule.
Is Sa view serializable?
Is Sa conflict serializable?