
















Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!

















Rajeev Balasubramonian School of Computing, University of Utah http://www.cs.utah.edu/~rajeev
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
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
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
- 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 -- $ 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
Performance inefficiencies! lock(L1); if (condt1) traverse linked list till you find the entry if (condt2) sell the ticket unlock(L1);
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)
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
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
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
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 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
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
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