0% found this document useful (0 votes)
9 views18 pages

PDC Lecture 3-4 Transactions

The document outlines a lecture on Parallel and Distributed Computing, focusing on transactions and their models, including A.C.I.D characteristics, types of transactions, and concurrency control. It discusses the importance of transactions in managing shared data and ensuring system reliability through mechanisms like write-ahead logs. The lesson also previews upcoming topics on fault tolerance and dependability in distributed systems.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views18 pages

PDC Lecture 3-4 Transactions

The document outlines a lecture on Parallel and Distributed Computing, focusing on transactions and their models, including A.C.I.D characteristics, types of transactions, and concurrency control. It discusses the importance of transactions in managing shared data and ensuring system reliability through mechanisms like write-ahead logs. The lesson also previews upcoming topics on fault tolerance and dependability in distributed systems.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 18

1

Parallel and Distributed

Lahore Garrison University


Computing
Session Fall 2024

Lecture – 03 Week – 02
INSTRUCTOR: MUHAMMAD ARSALAN RAZA
2
Preamble

 Distributed Systems

 Parallel Computing

 Synchronous and Asynchronous Communication

 Persistent vs. Transientcommunication

Lahore Garrison University


3
Lesson Plan

 Introduction to transactions
 The Transaction Model
 A.C.I.D
 Types of Transactions
 Nested Transactions vs. Distributed Transactions
 Write-ahead Log
 Concurrency Control
 Serializability

Lahore Garrison University


4
Introduction to Transactions

 Related to Mutual Exclusion, which protects a “shared resource”.


 Transactions protect “shared data”.
 Often, a single transaction contains a collection of
data accesses/modifications.
 The collection is treated as an “atomic operation” – either all the collection
complete, or none of them do.
 Mechanisms exist for the system to revert to a previously “good state”
whenever a transaction prematurely aborts.

Lahore Garrison University


5
The Transaction Model


Lahore Garrison University Updating a master tape is fault tolerant.
6
The Transaction Model (Cont.)

Primitive Description

BEGIN_TRANSACTION Make the start of a transaction

END_TRANSACTION Terminate the transaction and try to commit

ABORT_TRANSACTION Kill the transaction and restore the old values

READ Read data from a file, a table, or otherwise

WRITE Write data to a file, a table, or otherwise

 Examples of primitives for transactions.


Lahore Garrison University
7
The Transaction Model (Cont.)

BEGIN_TRANSACTION BEGIN_TRANSACTION
reserve WP -> JFK; reserve WP -> JFK;
reserve JFK -> Nairobi; reserve JFK -> Nairobi;
reserve Nairobi -> Malindi; reserve Nairobi -> Malindi full =>
END_TRANSACTION ABORT_TRANSACTION
(a) (b)

a) Transaction to reserve three flights “commits”.


b) Transaction “aborts” when third flight is unavailable.

Lahore Garrison University


8
A.C.I.D

 Four key transaction characteristics:


 Atomic: the transaction is considered to be one thing, even though it may be made
up of many different parts.
 Consistent: “invariants” that held before the transaction must also hold after its
successful execution.
 Isolated: if multiple transactions run at the same time, they must not interfere with
each other. To the system, it should look like the two (or more) transactions are
executed sequentially (i.e., that they are serializable).
 Durable: Once a transaction commits, any changes are permanent.

Lahore Garrison University


9
Types of Transactions

 Flat Transaction: this is the model that we have looked at so far. Disadvantage:
too rigid. Partial results cannot be committed. That is, the “atomic” nature of Flat
Transactions can be a downside.
 Nested Transaction: a main, parent transaction spawns child sub-transactions to
do the real work. Disadvantage: problems result when a sub-transaction commits
and then the parent aborts the main transaction. Things get messy.
 Distributed Transaction: this is sub-transactions operating on distributed data
stores. Disadvantage: complex mechanisms required to lock the distributed data,
as well as commit the entire transaction.

Lahore Garrison University


10
Nested Transaction

Lahore Garrison University


11
Nested vs. Distributed Transactions

 A distributed transaction – logically a flat, indivisible transaction that


operates on distributed data.
Lahore Garrison University
13
Write-ahead Log

x = 0; Log Log Log


y = 0;
BEGIN_TRANSACTION;
x = x + 1; [x = 0 / 1] [x = 0 / 1] [x = 0 / 1]
y=y+2 [y = 0/2] [y = 0/2]
x = y * y; [x = 1/4]
END_TRANSACTION;
(a) (b) (c) (d)

a) A transaction
b) – d) The log before each statement is executed
Lahore Garrison University
14
Concurrency Control

General organization of managers for


handling transactions.

Lahore Garrison University


15
Concurrency Control (Cont.)

General organization of managers for


handling distributed transactions.

Lahore Garrison University


16
Serializability

BEGIN_TRANSACTION BEGIN_TRANSACTION BEGIN_TRANSACTION


x = 0; x = 0; x = 0;
x = x + 1; x = x + 2; x = x + 3;
END_TRANSACTION END_TRANSACTION END_TRANSACTION

(a) (b) (c)

Schedule 1 x = 0; x = x + 1; x = 0; x = x + 2; x = 0; x = x + 3 Legal
Schedule 2 x = 0; x = 0; x = x + 1; x = x + 2; x = 0; x = x + 3; Illegal
Schedule 3 x = 0; x = 0; x = x + 1; x = 0; x = x + 2; x = x + 3; Illegal
(d)

a) – c) Three transactions T1, T2, and T3


d) Possible schedules
Lahore Garrison University
17
Lesson Review

 Introduction to transactions
 The Transaction Model
 A.C.I.D
 Types of Transactions
 Nested Transactions vs. Distributed Transactions
 Private Workspace
 Writeahead Log
 Concurrency Control
 Serializability

Lahore Garrison University


18
Next Lesson Preview

 Fault Tolerance Basic Concepts


 Dependability Basic Concepts
 Fault and Types of fault
 Failure Models
 Failure Masking by Redundancy
 Triple Modular Redundancy
 Fault Tolerance Topics
 Agreement in Faulty Systems

Lahore Garrison University


19
References

 To cover this topic, different reference material has been used for
consultation.

 Textbook:

Distributed Systems: Principles and Paradigms, A. S. Tanenbaum and M.


V. Steen, Prentice Hall, 2nd Edition, 2007.

Distributed and Cloud Computing: Clusters, Grids, Clouds, and the


Future Internet, K. Hwang, J. Dongarra and GC. C. Fox, Elsevier, 1st Ed.

 Google Search Engine


Lahore Garrison University

You might also like