Week 10
Week 10
2
3
Introduction
4
Cont.
• Atomic actions are a fundamental building block that is widely applicable in
computer system design and more generally in software engineering.
5
Atomicity Concepts
1. All-or-nothing atomicity: This concept is used in the context of database design
transactions.
• It refers to the idea that a transaction is treated as a single, indivisible unit of work.
• Either all the operations within the transaction are completed successfully, or none
of them are.
• If any part of the transaction fails, the entire transaction is rolled back, and the
system is left in its original state.
6
Cont.
2. Before-or-after atomicity: This concept deals with the ordering of operations in a
concurrent or distributed system.
7
Locking Mechanism in Atomicity
1. Simple Locking: Simple locking contributes to achieving atomicity by ensuring
that a transaction can complete its operations on a resource without interference
from other transactions.
8
Cont.
2. Two-Phase Locking: provides a higher level of atomicity by ensuring that a
transaction acquires all the necessary locks before it begins to release any.
• This "two-phase" nature helps prevent certain types of conflicts and ensures a more
consistent state during the execution of transactions.
• The protocol is designed to avoid the possibility of a transaction releasing locks and
then later needing to acquire additional locks, which could lead to issues with
consistency.
9
Atomicity in Nested Transactions
• Each of these inner transactions operates as a separate unit of work within the
scope of the outer transaction.
10
Challenges Associated with Nested
Transactions
1. Complexity:
• Ensuring proper isolation and consistency across nested transactions can be challenging.
• Intermediate states of nested transactions may need to be hidden from the rest of the
system until the outer transaction commits.
11
Cont.
3. Rollback Handling:
• If an inner transaction fails, the system needs to determine whether to roll back only that
transaction or the entire nested structure.
4. Concurrency Control:
12
Cont.
• Dependencies between inner and outer transactions can complicate the commit process.
• Deciding when to commit an inner transaction and whether the outer transaction should
wait for all inner transactions to complete introduces coordination challenges.
13
Failure and Recovery in Atomicity
• In computer systems, failure and recovery mechanisms are crucial for maintaining
the integrity and consistency of data.
• In the event of a system failure (e.g., hardware failure, software crash, power
outage), atomicity ensures that the system can recover to a consistent state.
14
Consistency and Atomicity
• Consistency and atomicity are closely related and often work together to ensure the
integrity of data in a system.
• Transaction Auditing and Security Assurance: The auditing process associated with
atomicity contributes to security assurance.
• Consistency and Validation for Security Policies: enforcing security policies and
validation rules.
16
Any Questions
17