ScholarQuill logoScholarQuillUniversity Notes
My Semester
Explore Notes
Past Papers12 New
Video CoursesNew
Search
Settings
Study Tools
GPA/CGPA Calculator
Schedule & To-Do
Student Portal
Contact
Contact
ScholarQuill logo
My Semester
Explore Notes
Past Papers12 New
Video CoursesNew
Search
Settings
GPA/CGPA Calculator
Schedule & To-Do
Student Portal
Contact
ScholarQuill logoScholarQuillUniversity Notes
Study PortalCOMP3147Transactional Memory
Ctrl + K
Login
Explore
Search
Semester
Papers
CGPA
    COMP3147

    Computer Architecture

    Progress0 / 24 done
    Topics24
    1Transistors and Digital logic2Hardware description languages (Verilog)
    3Instruction types and mixes4Addressing modes5RISC vs. CISC architectures6Exceptions in instruction sets
    7Data dependencies8Static scheduling9Pipeline performance analysis
    10Local scheduling11Loop unrolling and Software pipelining12Trace scheduling13Deferred exceptions and Predicated execution14IA64 architecture
    15Dynamical scheduling16Register renaming17Speculative execution18Trace cache
    19Cache coherency20Sequential consistency21Multithreading22Symmetric multiprocessing23Transactional memory
    24GPU programming
    3 min read
    Topic 23 of 24
    Topic Study Note Illustration
    23

    Transactional memory

    Transactional Memory (TM) is a concurrency control mechanism that allows multiple threads to execute memory operations in atomic blocks called transactions , simplifying synchronization in parallel programming.

    ⭐ Transactional Memory (TM)

    1. Definition

    Transactional Memory (TM) is a concurrency control mechanism that allows multiple threads to execute memory operations in atomic blocks called transactions, simplifying synchronization in parallel programming.

    A transaction is a sequence of read/write operations on shared memory that either commits completely (all operations succeed) or aborts entirely (none of the operations take effect), ensuring atomicity.


    2. Purpose

    1. Simplify parallel programming: Avoid explicit locks or semaphores.
    2. Reduce deadlocks and race conditions: Transactions automatically handle conflicts.
    3. Increase parallelism: Multiple threads can speculatively execute transactions concurrently.

    3. Key Concepts

    a) Atomicity

    • A transaction appears as a single, indivisible operation.
    • Either all memory updates occur or none occur.

    b) Isolation

    • Changes made by a transaction are not visible to other threads until the transaction commits.

    c) Consistency

    • Memory remains in a valid state before and after a transaction.

    d) Conflict Detection

    • Hardware or software tracks read/write sets of transactions.
    • Conflicts occur if two transactions access the same memory location with at least one write.

    e) Commit or Abort

    • Commit: Transaction completes successfully; updates are made visible.
    • Abort: Transaction fails due to conflicts; memory is restored to its previous state.

    4. Types of Transactional Memory

    A) Hardware Transactional Memory (HTM)

    • Transaction management is handled by CPU hardware.
    • Very fast, minimal software overhead.
    • Example: Intel TSX (Transactional Synchronization Extensions).

    B) Software Transactional Memory (STM)

    • Transactions are managed by software libraries or runtime.
    • Slower than HTM but more flexible and portable.

    C) Hybrid Transactional Memory (HyTM)

    • Combines hardware and software approaches for better performance and flexibility.

    5. Example Scenario

    Suppose two threads T1 and T2 access a shared variable X:

    Without TM (lock-based):

    lock(L)
    X = X + 1
    unlock(L)
    

    With TM:

    transaction {
        X = X + 1
    }
    
    • If T1 and T2 conflict (both modify X at the same time), one transaction aborts and retries.
    • No explicit locks are needed.

    6. Advantages of Transactional Memory

    1. Simplifies parallel programming by avoiding explicit locks.
    2. Reduces deadlocks and priority inversion.
    3. Allows higher concurrency than coarse-grained locks.
    4. Optimistic execution: Threads execute in parallel assuming conflicts are rare.

    7. Limitations

    1. Conflict overhead: Aborted transactions waste computation.
    2. Limited hardware resources in HTM (e.g., cache size limits).
    3. Not suitable for I/O operations inside transactions.
    4. Complexity in nested transactions and long-running transactions.

    8. Relation to Other Concepts

    Concept Relation to TM
    Locks / Mutexes TM is a lock-free alternative for synchronization.
    Multithreading / TLP TM enables safe concurrent access to shared memory by multiple threads.
    Speculative Execution TM relies on speculatively executing transactions, rolling back if conflicts occur.
    Cache Coherency Necessary to detect conflicts between transactions in hardware TM.

    9. Exam-Friendly Summary

    • Transactional Memory: Allows concurrent threads to execute memory operations atomically without explicit locks.
    • Key Features: Atomicity, Isolation, Consistency.
    • Types: Hardware TM (HTM), Software TM (STM), Hybrid TM (HyTM).
    • Advantages: Simplifies synchronization, reduces deadlocks, increases concurrency.
    • Limitations: Abort overhead, hardware limits, not ideal for I/O-heavy operations.
    ← Previous topic 22
    Symmetric multiprocessing
    Next topic 24 →
    Data-Level Parallelism: GPU programming

    Past Papers

    Open this section to view and download past papers

    Click on Show Past Papers to load available exam papers.

    Reading Progress
    0%
    3mremaining
    490words
    Beginnerlevel
    On This Page

    No headings found

    Study Toolkit

    Subject Portal

    Computer Architecture