Docsity

Computer architecture research overview: Transactional Memory | ECE 3991, Study notes of Electrical and Electronics Engineering

Partial preview of the text

Download Computer architecture research overview: Transactional Memory | ECE 3991 and more Study notes Electrical and Electronics Engineering in PDF only on Docsity!

Computer Architecture Research Overview

Focus on: Transactional Memory

Rajeev Balasubramonian School of Computing, University of Utah http://www.cs.utah.edu/~rajeev

What is Computer Architecture?

To a large extent, computer architecture determines: • the number of instructions used to execute a program

the time each instruction takes to execute - the idle cycles when no work gets done - the number of instructions that can execute in parallel

The Advent of Multi-Core Chips

In the past, performance magically increased by 50% every year - In the future, this improvement will be only ~20% every year … unless … the application is multi-threaded! Core Cache bank

Upcoming Architecture Challenges

Improving single core performance

Functionalities in multi-core chips - Simplifying the programmer’s task - Efficient interconnects and on-chip communication - Power and temperature-efficient designs - Designs tolerant of errors For publications, see http://www.cs.utah.edu/~rajeev/research.html

Multi-Threaded Applications

 - Alice & Bob’s joint account: $ Banking Database - ATM - Alice: Deposit $ - ATM - Bob: Deposit $ - Rd balance -- $ - Rd balance -- $ - Update balance -- $ - Update balance -- $ - Write balance -- $ - Write balance -- $ 
  • $ - $ - $ - $ - $
  • $
  • $

Synchronization with Locks

Bank: lock(L1); read balance; calculate interest; update balance; unlock(L1); ATM-withdraw: lock(L1); read balance; decrement; update balance; unlock(L1); ATM-deposit: lock(L1); read balance; increment; update balance; unlock(L1); Each snippet executes atomically, as if it is the only process in the system

Problems with Locks

Performance inefficiencies! lock(L1); if (condt1) traverse linked list till you find the entry if (condt2) sell the ticket unlock(L1);

Transactions

New paradigm to simplify programming

instead of lock-unlock, use transaction begin-end

Can yield better performance; Eliminates deadlocks - Programmer can freely encapsulate code sections within^ transactions and not worry about the impact on^ performance and correctness - Programmer specifies the code sections they’d like to see execute atomically – the hardware takes care of the rest (provides illusion of atomicity)

Applications

A transaction executes speculatively in the hope that there will be no conflicts

Can replace a lock-unlock pair with a transaction begin-end

the lock is blocking, the transaction is not ¾ programmers can conservatively introduce transactions without worsening performance lock (lock1) transaction begin read A read A operations operations write A write A unlock (lock1) transaction end

Example

Producer-consumer relationships – producers place tasks at the tail of^ a work-queue and consumers pull tasks out of the head Enqueue Dequeue transaction begin transaction begin if (tail == NULL) if (head->next == NULL) update head and tail update head and tail else else update tail update head transaction end transaction end With locks, neither thread can proceed in parallel since head/tail may be^ updated – with transactions, enqueue and dequeue can proceed in^ parallel – transactions will be aborted only if the queue is nearly empty

Key Problem

At the end of the transaction, the transaction’s writes are broadcast – the commit does not happen until everyone that needs to see the writes has seen them

Broadcasts are not scalable! In a multi-core with 64 processors, 63 other transactions may have to wait while one transaction is busy broadcasting its writes - Need efficient algorithms to handle a commit and need clever design of on-chip networks to improve speed/power

Algorithm 1 – Sequential

Distribute memory into N nodes – each transaction keeps track of^ the nodes that are read and written P1 – T P2 – T PN – TN M M MN

If two transactions touch different nodes, they can commit in parallel

If two transactions happen to touch the same node, they must be aware of each other in case one has to abort Algorithm designed by Seth Pugsley, Junior in the CS program Paper accepted to PACT’08 conference

Algorithm 1 – Sequential

Cannot have hardware deadlocks: since nodes are^ occupied in increasing order, a transaction is always^ waiting for a transaction that is further ahead – cannot^ have a cycle of dependences

If transactions usually do not pose conflicts for nodes, multiple transactions can commit in parallel - Disadvantages: must occupy nodes sequentially, conflicts^ lead to long delays

Algorithm 2 – Speculative

Attempt to occupy every node in the commit set in parallel – if any node is already occupied, revert back to the sequential algorithm (else, can lead to deadlocks)

Should typically perform no worse than the sequential algorithm