Sequen&al Consistency and Linearizability

Size: px
Start display at page:

Download "Sequen&al Consistency and Linearizability"

Transcription

1 Sequen&al Consistency and Linearizability (Or, Reasoning About Concurrent Objects) Acknowledgement: Slides par&ally adopted from the companion slides for the book "The Art of Mul&processor Programming" by Maurice Herlihy and Nir Shavit

2 What We'll Cover Today Chapter 3 of: Digital copy can be obtained via WUSTL library: hqp://catalog.wustl.edu/search/

3 Concurrent Computa&on memory object object

4 Objec&vism What does it mean for a concurrent object to be correct? How do we specify its behavior? How do we implement one? How do we tell if the implementa/on is correct? Both sequen&al consistency and linearizability are correctness condi/ons for concurrent objects.

5 Sequen&al Consistency [1] Typically used as a memory consistency model, which specifies in what order the memory opera&ons may appear to execute. You can think of a memory loca&on as a concurrent object.

6 Sequen&al Consistency [1] [T]he result of any execution is the same as if the operations of all the processors* were executed in some sequential order, and the operations of each individual processor appear in this sequence in the order specified by its program. Leslie Lamport, 1979 The sequence of instruc&ons from threads execu&ng concurrently are interleaved to form a global linear order of all instruc&ons. The sequence of instruc&ons from a given thread is defined by the thread s program. Implicit: each memory loca&on is coherent according to the global linear order. * I will be using processor vs thread interchangeably.

7 What SC Buys Us r1, r2: registers. 1 x 0 y x 1 y 1 Rela&ng to the dag: Under SC, the final result we get from execu&ng this dag is as if the execu&on followed some topological sort of the dag. r1 y 3 5 r2 x 6 r1 r r1 =?? r2 =?? possible? (example) yes (2,4,3,5) yes (2,3,4,5) yes (4,5,2,3) Not under SC SC precludes execu&ons that don't conform to program order.

8 Peterson's Algorithm public void lock() { flag[i] = true; victim = i; while (flag[j] && victim == i) {}; } public void unlock() { flag[i] = false; }

9 Crux of Peterson Proof Needs SC (1) write B (flag[b]=true) è write B (vic&m=b) (3) write B (vic&m=b) è write A (vic&m=a) (2) write A (vic&m=a) è read A (flag[b]) è read A (vic&m) A read flag[b] == true and vic&m == A, so it could not have entered the CS (QED) The proof assumes execu&on follows program order, and that each memory loca&on is coherent.

10 Linearizability [2] Originally developed to reason about behaviors of concurrent objects. Stronger than sequen&al consistency (we will say more about that later).

11 Example: Circular FIFO Queue public class FIFOQueue { int head = 0, tail = 0; items = (T[]) new Object[capacity]; public void enq(t x) { if (tail-head == capacity) throw new FullException(); items[tail % capacity] = x; tail++; } public T deq() { if (tail == head) throw new EmptyException(); Item item = items[head % capacity]; head++; return item; }} head capacity y z 2 tail

12 Now Consider the Following Scenario The FIFO queue is accessed by two threads concurrently. But, One thread enq only The other deq only

13 Wait- free 2- Thread Queue head 0 1 tail deq() 7 x y 2 enq(z) z

14 Wait- free 2- Thread Queue head 0 1 tail result = x 7 x y 2 queue[tail] = z z

15 Wait- free 2- Thread Queue head 0 1 tail head++ 7 y z 2 tail x 5 4

16 Wait- Free Concurrent 2- Thread Queue public class FIFOQueue { int head = 0, tail = 0; items = (T[]) new Object[capacity]; }} public void enq(t x) { if (tail-head == capacity) throw new FullException(); items[tail % capacity] = x; tail++; } public T deq() { if (tail == head) throw new EmptyException(); Item item = items[head % capacity]; head++; return item; head capacity y z Claim: the same implementa/on can be used as a wait- free two- thread queue, and the queue will behave correctly. 2 tail

17 What is a Concurrent Queue? Need a way to specify a concurrent queue object Need a way to prove that an algorithm implements the object s specifica&on Lets talk about object specifica&ons

18 Sequen&al Objects Each object has a state Usually given by a set of fields Queue example: sequence of items Each object has a set of methods Only way to manipulate state Queue example: enq and deq methods

19 Sequen&al Specifica&ons If (precondi&on) the object is in such- and- such a state before you call the method, Then (postcondi&on) the method will return a par&cular value or throw a par&cular excep&on. and (postcondi&on, con t) the object will be in some other state when the method returns,

20 Pre and PostCondi&ons for Deq Precondi&on: Queue is non- empty Postcondi&on: Returns first item in queue Postcondi&on: Removes first item in queue

21 Pre and PostCondi&ons for Deq Precondi&on: Queue is empty Postcondi&on: Throws Empty excep&on Postcondi&on: Queue state unchanged

22 Why Sequen&al Specifica&ons Totally Rock Interac&ons among methods captured by side- effects on object state State meaningful between method calls Documenta&on size linear in number of methods Each method described in isola&on Can add new methods Without changing descrip&ons of old methods

23 Sequen&al vs Concurrent Sequen&al Methods take &me? Who knew? Objects need meaningful states only between method calls. Concurrent Method call is not an event Method call is an interval. Because method calls overlap, object might never be between method calls.

24 Sequen&al vs Concurrent Sequen&al: Each method can be described in isola&on. Can add new methods without affec&ng older methods Concurrent: Must characterize all possible interac&ons with concurrent calls What if two enq() calls overlap? Two deq() calls? enq() and deq()? Everything can poten&ally interact with everything else

25 The Big Ques&on What does it mean for a concurrent object to be correct? What is a concurrent FIFO queue? FIFO means strict temporal order Concurrent means ambiguous temporal order

26 Intui&vely public T deq() throws EmptyException { lock.lock(); try { if (tail == head) throw new EmptyException(); T x = items[head % items.length]; head++; } return x; } finally { lock.unlock(); } All queue modifica&ons are mutually exclusive

27 Intui&vely Lets capture the idea of describing the concurrent via the sequential lock() q.deq unlock() q.enq deq lock() enq unlock() Behavior is Sequential time enq deq

28 Linearizability [2] Each method should take effect instantaneously (lineariza&on point) between invoca&on (making a method call) and response (returning from a method call) events If we can look at the trace from parallel execu&on, and pick a lineariza&on point for all method invoca&ons such that the history "make sense" (i.e., matches sequen&al behavior), then the history is linearizable. A linearizable object: one all of whose possible execu&ons are linearizable.

29 Example q.enq(x) q.deq(y) q.enq(y) q.deq(x) time

30 Example q.enq(x) q.deq(y) q.enq(y) q.deq(x) time

31 Example q.enq(x) q.deq(y) q.enq(y) q.deq(x) time

32 Example q.enq(x) q.deq(y) q.enq(y) time

33 Example q.enq(x) q.deq(y) q.enq(y) q.deq(x) time

34 Example q.enq(x) q.deq(y) q.enq(y) q.deq(x) time

35 Read/Write Register Example write(0) read(1) write(2) write(1) already happened write(1) time read(0)

36 Read/Write Register Example write(0) read(1) write(2) write(1) already happened write(1) time read(0)

37 Read/Write Register Example write(0) read(1) write(2) write(1) already happened write(1) time read(1)

38 Read/Write Register Example write(0) read(1) write(2) write(1) already happened write(1) time read(1)

39 Read/Write Register Example write(0) write(2) write(1) read(1) time

40 Read/Write Register Example write(0) write(2) write(1) read(1) time

41 Talking About Execu&ons Why? Can t we specify the lineariza&on point of each opera&on without describing an execu&on? Not Always In some cases, lineariza&on point depends on the execu&on

42 Linearizability, Formally Split Method Calls into Two Events: Invoca&on method name & args q.enq(x) Response result or excep&on q.enq(x) returns void q.deq() returns x q.deq() throws empty

43 Invoca&on Nota&on A q.enq (x) thread method object arguments

44 Response Nota&on A q: void thread result object

45 Response Nota&on A q: empty() thread exception object

46 Defini&on Invoca&on & response match if Thread names agree A q.enq(3) A q:void Object names agree Method call

47 History: Describing an Execu&on H = A q.enq(3) A q:void A q.enq(5) B p.enq(4) B p:void B q.deq() B q:3 Sequence of invocations and responses

48 Object Projec&on H q = A q.enq(3) A q:void A q.enq(5) B p.enq(4) B p:void B q.deq() B q:3 Picking out entries performed on the target object.

49 Thread Projec&on H B = A q.enq(3) A q:void A q.enq(5) B p.enq(4) B p:void B q.deq() B q:3 Picking out entries performed by a given thread.

50 History: Describing an Execu&on H = A q.enq(3) A q:void A q.enq(5) B p.enq(4) B p:void B q.deq() B q:3 An invocation is pending if it has no matching response.

51 Well- Formed Histories H = A q.enq(3) A q:void B p.enq(4) A q.enq(5) B p:void B q.deq() B q:3 H A = A q.enq(3) A q:void A q.enq(5) B p.enq(4) B p:void H B = B q.deq() B q:3 Each per-thread projection contains matching invocation and responses, except for the last pending invocation.

52 Equivalent Histories H = A q.enq(3) A q:void A q.enq(5) B p.enq(4) B p:void B q.deq() B q:3 G = A q.enq(3) B p.enq(4) A q:void B p:void B q.deq() B q:3 A q.enq(5) Threads see the same thing in both H A = G A H B = G B

53 Sequen&al Specifica&ons A sequen&al specifica&on is some way of telling whether a single- thread, single- object history is legal For example: Pre and post- condi&ons But plenty of other techniques exist

54 Legal Histories A sequen&al (mul&- object) history H is legal if For every object x H x follows the sequen&al specifica&on for x

55 Precedence Ordering A q.enq(3) B p.enq(4) B p.void A q:void B q.deq() B q:3 A q.enq(3) B p.enq(4) B p.void B q.deq() A q:void B q:3 A method call precedes another if response event precedes invoca&on event Otherwise they overlap

56 Nota&on Given History H method execu&ons m 0 and m 1 in H We say m 0 è H m 1, if m 0 precedes m 1 in H Rela&on m 0 è H m 1 is a Par&al order Total order if H is sequen&al m 0 m 1

57 Linearizability [2] History H is linearizable if it can be extended to G by Appending zero or more responses to pending invoca&ons Discarding other pending invoca&ons So that G is equivalent to a legal sequen&al history S where è G è S Fix the invoca&ons that already took effect and discard the rest that haven't.

58 Linearizability [2] History H is linearizable if it can be extended to G by Appending zero or more responses to pending invoca&ons Discarding other pending invoca&ons So that G is equivalent to a legal sequen&al history S where è G è S Equivalent to S captures the fact that input/output of the methods must be the same as in sequen&al execu&on.

59 Linearizability [2] History H is linearizable if it can be extended to G by Appending zero or more responses to pending invoca&ons Discarding other pending invoca&ons So that G is equivalent to a legal sequen&al history S where è G è S The total order in S must respect the par&al order ("real- &me" ordering) in the original history.

60 Ensuring è G è S è G = {aà c,bà c} è S = {aà b,aà c,bà c} a b è G c time è S

61 Example A q.enq(3) B q.enq(4) B q:void B q.deq() B q:4 B q:enq(6) Complete this pending invoca/on A q.enq(3) B q.enq(4) B q.deq(4) B q.enq(6) time

62 Example A q.enq(3) B q.enq(4) B q:void B q.deq() B q:4 B q:enq(6) A q:void Complete this pending invoca/on A q.enq(3) B q.enq(4) B q.deq(4) B q.enq(6) time

63 Example A q.enq(3) B q.enq(4) B q:void B q.deq() B q:4 B q:enq(6) A q:void Discard this pending invoca/on A q.enq(3) B q.enq(4) B q.deq(4) B q.enq(6) time

64 Example Equivalent sequen/al history A q.enq(3) B q.enq(4) B q:void B q.deq() B q:4 A q:void B q.enq(4) B q:void A q.enq(3) A q:void B q.deq() B q:4 A q.enq(3) B q.enq(4) B q.deq(4) time

65 Composability Theorem History H is linearizable if and only if For every object x H x is linearizable Why Does Composability MaQer? Modularity Can prove linearizability of objects in isola&on Can compose independently- implemented objects

66 public class FIFOQueue { int head = 0, tail = 0; items = (T[]) new Object[capacity]; }} Reasoning About Linearizability: Wait- Free Concurrent 2- Thread Queue public void enq(t x) { if (tail-head == capacity) throw new FullException(); items[tail % capacity] = x; tail++; } public T deq() { if (tail == head) throw new EmptyException(); Item item = items[head % capacity]; head++; return item; Lineariza/on point

67 General Strategy Iden&fy one atomic step where method happens Cri&cal sec&on Machine instruc&on Not necessarily a single lineariza&on point Might need to define several different ones for a given method

68 Linearizability: Summary Powerful specifica&on tool for shared objects Allows us to capture the no&on of objects being atomic Don t leave home without it

69 Alterna&ve: Sequen&al Consistency History H is sequen&ally consistent if it can be extended to G by Appending zero or more responses to pending invoca&ons Discarding other pending invoca&ons So that G is equivalent to a legal sequen&al history S where è G è S Allows reordering opera&ons by different threads to establish a global sequen&al order. G is equivalent to S, which implies that S preserves program order within a thread.

70 SC is Weaker than Linearizability q.enq(x) q.deq(y) q.enq(y) time

71 SC is Weaker than Linearizability q.enq(x) q.deq(y) q.enq(y) time

72 Theorem Sequen&al Consistency is not composable

73 FIFO Queue Example p.enq(x) q.enq(x) p.deq(y) q.enq(y) p.enq(y) q.deq(x) time

74 H p Sequen&ally Consistent p.enq(x) q.enq(x) p.deq(y) q.enq(y) p.enq(y) q.deq(x) time

75 H q Sequen&ally Consistent p.enq(x) q.enq(x) p.deq(y) q.enq(y) p.enq(y) q.deq(x) time

76 Ordering imposed by p p.enq(x) q.enq(x) p.deq(y) q.enq(y) p.enq(y) q.deq(x) time

77 Ordering imposed by q p.enq(x) q.enq(x) p.deq(y) q.enq(y) p.enq(y) q.deq(x) time

78 Ordering imposed by both p.enq(x) q.enq(x) p.deq(y) q.enq(y) p.enq(y) q.deq(x) time

79 Combining orders p.enq(x) q.enq(x) p.deq(y) q.enq(y) p.enq(y) q.deq(x) time

80 Hardware Memory Consistency No modern- day processor implements sequen&al consistency. Hardware ac&vely reorders instruc&ons. Compilers may reorder instruc&ons, too. Why? Because most of performance is derived from a single thread s unsynchronized execu&on of code.

81 Memory Barriers (Fences) A memory barrier (or memory fence) is a hardware ac&on that enforces an ordering constraint between the instruc&ons before and aqer the fence. A memory barrier can be issued explicitly as an instruc&on (e.g., in x86: mfence) The typical cost of a memory fence is comparable to that of an L2- cache access.

82 Memory Consistency in High- Level Language In Java, can ask compiler to keep a variable up- to- date by declaring it vola&le: Adds a memory barrier aqer each store Inhibits reordering, removing from loops, & other compiler op&miza&ons C++11 standard offers atomic variables that come with a set of different memory ordering constraints.

83 Summary: Real- World Hardware weaker than sequen&al consistency Can get sequen&al consistency at a price Linearizability beqer fit for high- level soqware

84 References [1] L. Lamport. How to make a mul&processor computer that correctly executes mul&process programs. IEEE Transac&ons on Computers. September 1979;C- 28(9):690. [2] M. Herlihy, J. M. Wing. Linearizability: a correctness condi&on for concurrent objects. ACM Transac&ons on Programming Languages and Systems (TOPLAS). 1990;12(3):

85 This work is licensed under a Creative Commons Attribution-ShareAlike 2.5 License. You are free: to Share to copy, distribute and transmit the work to Remix to adapt the work Under the following conditions: Attribution. You must attribute the work to The Art of Multiprocessor Programming (but not in any way that suggests that the authors endorse you or your use of the work). Share Alike. If you alter, transform, or build upon this work, you may distribute the resulting work only under the same, similar or a compatible license. For any reuse or distribution, you must make clear to others the license terms of this work. The best way to do this is with a link to Any of the above conditions can be waived if you get permission from the copyright holder. Nothing in this license impairs or restricts the author's moral rights. Art of Multiprocessor Programming 94

DD2451 Parallel and Distributed Computing --- FDD3008 Distributed Algorithms

DD2451 Parallel and Distributed Computing --- FDD3008 Distributed Algorithms DD2451 Parallel and Distributed Computing --- FDD3008 Distributed Algorithms Lecture 2 Concurrent Objects Mads Dam Autumn/Winter 2011 Concurrent Computaton memory object object Art of Mul*processor 2 Objects

More information

Programming Paradigms for Concurrency Lecture 3 Concurrent Objects

Programming Paradigms for Concurrency Lecture 3 Concurrent Objects Programming Paradigms for Concurrency Lecture 3 Concurrent Objects Based on companion slides for The Art of Multiprocessor Programming by Maurice Herlihy & Nir Shavit Modified by Thomas Wies New York University

More information

Concurrent Objects. Companion slides for The Art of Multiprocessor Programming by Maurice Herlihy & Nir Shavit

Concurrent Objects. Companion slides for The Art of Multiprocessor Programming by Maurice Herlihy & Nir Shavit Concurrent Objects Companion slides for The by Maurice Herlihy & Nir Shavit Concurrent Computation memory object object 2 Objectivism What is a concurrent object? How do we describe one? How do we implement

More information

10/27/11. Is The Queue Correct? Concurrent Computaton. Objects. A Concurrent FIFO Queue head. A Concurrent FIFO Queue head

10/27/11. Is The Queue Correct? Concurrent Computaton. Objects. A Concurrent FIFO Queue head. A Concurrent FIFO Queue head DD2451 Parallel and Distributed Computing --- FDD3008 Distributed Algorithms Lecture 2 Concurrent Objects memory Concurrent Computaton Mads Dam Autumn/Winter 2011 object object Art of Mul/processor 2 Objects

More information

Introduction. Companion slides for The Art of Multiprocessor Programming by Maurice Herlihy & Nir Shavit

Introduction. Companion slides for The Art of Multiprocessor Programming by Maurice Herlihy & Nir Shavit Introduction Companion slides for The by Maurice Herlihy & Nir Shavit Moore s Law Transistor count still rising Clock speed flattening sharply 2 Moore s Law (in practice) 3 Nearly Extinct: the Uniprocesor

More information

Review of last lecture. Goals of this lecture. DPHPC Overview. Lock-based queue. Lock-based queue

Review of last lecture. Goals of this lecture. DPHPC Overview. Lock-based queue. Lock-based queue Review of last lecture Design of Parallel and High-Performance Computing Fall 2013 Lecture: Linearizability Instructor: Torsten Hoefler & Markus Püschel TA: Timo Schneider Cache-coherence is not enough!

More information

What We'll Cover Today

What We'll Cover Today Mutual Exclusion Acknowledgement: Slides adopted from the companion slides for the book "The Art of Mul>processor Programming" by Maurice Herlihy and Nir Shavit What We'll Cover Today Chapter 2 of: Digital

More information

Introduction to Concurrency and Multicore Programming. Slides adapted from Art of Multicore Programming by Herlihy and Shavit

Introduction to Concurrency and Multicore Programming. Slides adapted from Art of Multicore Programming by Herlihy and Shavit Introduction to Concurrency and Multicore Programming Slides adapted from Art of Multicore Programming by Herlihy and Shavit Overview Introduction Mutual Exclusion Linearizability Concurrent Data Structure

More information

Solution: a lock (a/k/a mutex) public: virtual void unlock() =0;

Solution: a lock (a/k/a mutex) public: virtual void unlock() =0; 1 Solution: a lock (a/k/a mutex) class BasicLock { public: virtual void lock() =0; virtual void unlock() =0; ; 2 Using a lock class Counter { public: int get_and_inc() { lock_.lock(); int old = count_;

More information

Review of last lecture. Peer Quiz. DPHPC Overview. Goals of this lecture. Lock-based queue

Review of last lecture. Peer Quiz. DPHPC Overview. Goals of this lecture. Lock-based queue Review of last lecture Design of Parallel and High-Performance Computing Fall 2016 Lecture: Linearizability Motivational video: https://www.youtube.com/watch?v=qx2driqxnbs Instructor: Torsten Hoefler &

More information

Lecture 7: Mutual Exclusion 2/16/12. slides adapted from The Art of Multiprocessor Programming, Herlihy and Shavit

Lecture 7: Mutual Exclusion 2/16/12. slides adapted from The Art of Multiprocessor Programming, Herlihy and Shavit Principles of Concurrency and Parallelism Lecture 7: Mutual Exclusion 2/16/12 slides adapted from The Art of Multiprocessor Programming, Herlihy and Shavit Time Absolute, true and mathematical time, of

More information

Concurrent Objects and Linearizability

Concurrent Objects and Linearizability Chapter 3 Concurrent Objects and Linearizability 3.1 Specifying Objects An object in languages such as Java and C++ is a container for data. Each object provides a set of methods that are the only way

More information

Mutual Exclusion. Companion slides for The Art of Multiprocessor Programming by Maurice Herlihy & Nir Shavit

Mutual Exclusion. Companion slides for The Art of Multiprocessor Programming by Maurice Herlihy & Nir Shavit Mutual Exclusion Companion slides for The by Maurice Herlihy & Nir Shavit Mutual Exclusion Today we will try to formalize our understanding of mutual exclusion We will also use the opportunity to show

More information

Overview of Lecture 4. Memory Models, Atomicity & Performance. Ben-Ari Concurrency Model. Dekker s Algorithm 4

Overview of Lecture 4. Memory Models, Atomicity & Performance. Ben-Ari Concurrency Model. Dekker s Algorithm 4 Concurrent and Distributed Programming http://fmt.cs.utwente.nl/courses/cdp/ Overview of Lecture 4 2 Memory Models, tomicity & Performance HC 4 - Tuesday, 6 December 2011 http://fmt.cs.utwente.nl/~marieke/

More information

Programming Paradigms for Concurrency Lecture 2 - Mutual Exclusion

Programming Paradigms for Concurrency Lecture 2 - Mutual Exclusion Programming Paradigms for Concurrency Lecture 2 - Mutual Exclusion Based on companion slides for The Art of Multiprocessor Programming by Maurice Herlihy & Nir Shavit Modified by Thomas Wies New York University

More information

Concurrent Skip Lists. Companion slides for The Art of Multiprocessor Programming by Maurice Herlihy & Nir Shavit

Concurrent Skip Lists. Companion slides for The Art of Multiprocessor Programming by Maurice Herlihy & Nir Shavit Concurrent Skip Lists Companion slides for The by Maurice Herlihy & Nir Shavit Set Object Interface Collection of elements No duplicates Methods add() a new element remove() an element contains() if element

More information

Peterson s Algorithm

Peterson s Algorithm Peterson s Algorithm public void lock() { flag[i] = true; victim = i; while (flag[j] && victim == i) {}; } public void unlock() { flag[i] = false; } 24/03/10 Art of Multiprocessor Programming 1 Mutual

More information

Unit 6: Indeterminate Computation

Unit 6: Indeterminate Computation Unit 6: Indeterminate Computation Martha A. Kim October 6, 2013 Introduction Until now, we have considered parallelizations of sequential programs. The parallelizations were deemed safe if the parallel

More information

Linked Lists: Locking, Lock- Free, and Beyond. Companion slides for The Art of Multiprocessor Programming by Maurice Herlihy & Nir Shavit

Linked Lists: Locking, Lock- Free, and Beyond. Companion slides for The Art of Multiprocessor Programming by Maurice Herlihy & Nir Shavit Linked Lists: Locking, Lock- Free, and Beyond Companion slides for The Art of Multiprocessor Programming by Maurice Herlihy & Nir Shavit Coarse-Grained Synchronization Each method locks the object Avoid

More information

Universality of Consensus. Companion slides for The Art of Multiprocessor Programming by Maurice Herlihy & Nir Shavit

Universality of Consensus. Companion slides for The Art of Multiprocessor Programming by Maurice Herlihy & Nir Shavit Universality of Consensus Companion slides for The by Maurice Herlihy & Nir Shavit Turing Computability 1 0 1 1 0 1 0 A mathematical model of computation Computable = Computable on a T-Machine 2 Shared-Memory

More information

Spin Locks and Contention. Companion slides for The Art of Multiprocessor Programming by Maurice Herlihy & Nir Shavit

Spin Locks and Contention. Companion slides for The Art of Multiprocessor Programming by Maurice Herlihy & Nir Shavit Spin Locks and Contention Companion slides for The Art of Multiprocessor Programming by Maurice Herlihy & Nir Shavit Real world concurrency Understanding hardware architecture What is contention How to

More information

Concurrent Queues, Monitors, and the ABA problem. Companion slides for The Art of Multiprocessor Programming by Maurice Herlihy & Nir Shavit

Concurrent Queues, Monitors, and the ABA problem. Companion slides for The Art of Multiprocessor Programming by Maurice Herlihy & Nir Shavit Concurrent Queues, Monitors, and the ABA problem Companion slides for The Art of Multiprocessor Programming by Maurice Herlihy & Nir Shavit Queues Often used as buffers between producers and consumers

More information

Consistency & Coherence. 4/14/2016 Sec5on 12 Colin Schmidt

Consistency & Coherence. 4/14/2016 Sec5on 12 Colin Schmidt Consistency & Coherence 4/14/2016 Sec5on 12 Colin Schmidt Agenda Brief mo5va5on Consistency vs Coherence Synchroniza5on Fences Mutexs, locks, semaphores Hardware Coherence Snoopy MSI, MESI Power, Frequency,

More information

bool Account::withdraw(int val) { atomic { if(balance > val) { balance = balance val; return true; } else return false; } }

bool Account::withdraw(int val) { atomic { if(balance > val) { balance = balance val; return true; } else return false; } } Transac'onal Memory Acknowledgement: Slides in part adopted from: 1. a talk on Intel TSX from Intel Developer's Forum in 2012 2. the companion slides for the book "The Art of Mul'processor Programming"

More information

Review of last lecture. Peer Quiz. DPHPC Overview. Goals of this lecture. Is coherence everything?

Review of last lecture. Peer Quiz. DPHPC Overview. Goals of this lecture. Is coherence everything? Review of last lecture Design of Parallel and High-Performance Computing Fall Lecture: Memory Models Motivational video: https://www.youtube.com/watch?v=twhtg4ous Instructor: Torsten Hoefler & Markus Püschel

More information

Lecture 4: Languages, Fast Locks, and Lock-free

Lecture 4: Languages, Fast Locks, and Lock-free T. HOEFLER, M. PUESCHEL Lecture 4: Languages, Fast Locks, and Lock-free Teaching assistant: Salvatore Di Girolamo Motivational video: https://www.youtube.com/watch?v=1o4yvibagu0 So, a computing scientist

More information

Introduction to Multiprocessor Synchronization

Introduction to Multiprocessor Synchronization Introduction to Multiprocessor Synchronization Maurice Herlihy http://cs.brown.edu/courses/cs176/lectures.shtml Moore's Law Transistor count still rising Clock speed flattening sharply Art of Multiprocessor

More information

CSE Opera,ng System Principles

CSE Opera,ng System Principles CSE 30341 Opera,ng System Principles Synchroniza2on Overview Background The Cri,cal-Sec,on Problem Peterson s Solu,on Synchroniza,on Hardware Mutex Locks Semaphores Classic Problems of Synchroniza,on Monitors

More information

DD2451 Parallel and Distributed Computing --- FDD3008 Distributed Algorithms

DD2451 Parallel and Distributed Computing --- FDD3008 Distributed Algorithms DD2451 Parallel and Distributed Computing --- FDD3008 Distributed Algorithms Lecture 4 Consensus, I Mads Dam Autumn/Winter 2011 Slides: Much material due to M. Herlihy and R Wa8enhofer Last Lecture Shared

More information

Mutual Exclusion. Companion slides for The Art of Multiprocessor Programming by Maurice Herlihy & Nir Shavit

Mutual Exclusion. Companion slides for The Art of Multiprocessor Programming by Maurice Herlihy & Nir Shavit Mutual Exclusion Companion slides for The by Maurice Herlihy & Nir Shavit Mutual Exclusion In his 1965 paper E. W. Dijkstra wrote: "Given in this paper is a solution to a problem which, to the knowledge

More information

Spin Locks and Contention

Spin Locks and Contention Spin Locks and Contention Companion slides for The Art of Multiprocessor Programming by Maurice Herlihy & Nir Shavit Modified for Software1 students by Lior Wolf and Mati Shomrat Kinds of Architectures

More information

Spin Locks and Contention. Companion slides for The Art of Multiprocessor Programming by Maurice Herlihy & Nir Shavit

Spin Locks and Contention. Companion slides for The Art of Multiprocessor Programming by Maurice Herlihy & Nir Shavit Spin Locks and Contention Companion slides for The Art of Multiprocessor Programming by Maurice Herlihy & Nir Shavit Focus so far: Correctness and Progress Models Accurate (we never lied to you) But idealized

More information

CS 5614: (Big) Data Management Systems. B. Aditya Prakash Lecture #6: Transac/ons 1: Intro. to ACID

CS 5614: (Big) Data Management Systems. B. Aditya Prakash Lecture #6: Transac/ons 1: Intro. to ACID CS 5614: (Big) Data Management Systems B. Aditya Prakash Lecture #6: Transac/ons 1: Intro. to ACID Project dates Proposal due: Feb 23 Milestone due: Mar 28 Final report/posters etc: May 2 (last class)

More information

CONCURRENT LIBRARIES. Correctness Criteria, Verification

CONCURRENT LIBRARIES. Correctness Criteria, Verification CONCURRENT LIBRARIES Correctness Criteria, Verification Verification Ingredients Specifying a Library: φ Implementing a Library: L Verifying a Library implementation: L φ The History of an Object Object

More information

CS 4604: Introduc0on to Database Management Systems. B. Aditya Prakash Lecture #17: Transac0ons 1: Intro. to ACID

CS 4604: Introduc0on to Database Management Systems. B. Aditya Prakash Lecture #17: Transac0ons 1: Intro. to ACID CS 4604: Introduc0on to Database Management Systems B. Aditya Prakash Lecture #17: Transac0ons 1: Intro. to ACID Why Transac0ons? Database systems are normally being accessed by many users or processes

More information

Important Lessons. A Distributed Algorithm (2) Today's Lecture - Replication

Important Lessons. A Distributed Algorithm (2) Today's Lecture - Replication Important Lessons Lamport & vector clocks both give a logical timestamps Total ordering vs. causal ordering Other issues in coordinating node activities Exclusive access to resources/data Choosing a single

More information

The Relative Power of Synchronization Methods

The Relative Power of Synchronization Methods Chapter 5 The Relative Power of Synchronization Methods So far, we have been addressing questions of the form: Given objects X and Y, is there a wait-free implementation of X from one or more instances

More information

Coarse-grained and fine-grained locking Niklas Fors

Coarse-grained and fine-grained locking Niklas Fors Coarse-grained and fine-grained locking Niklas Fors 2013-12-05 Slides borrowed from: http://cs.brown.edu/courses/cs176course_information.shtml Art of Multiprocessor Programming 1 Topics discussed Coarse-grained

More information

Memory Consistency Models

Memory Consistency Models Memory Consistency Models Contents of Lecture 3 The need for memory consistency models The uniprocessor model Sequential consistency Relaxed memory models Weak ordering Release consistency Jonas Skeppstedt

More information

The Universality of Consensus

The Universality of Consensus Chapter 6 The Universality of Consensus 6.1 Introduction In the previous chapter, we considered a simple technique for proving statements of the form there is no wait-free implementation of X by Y. We

More information

Transac.on Management. Transac.ons. CISC437/637, Lecture #16 Ben Cartere?e

Transac.on Management. Transac.ons. CISC437/637, Lecture #16 Ben Cartere?e Transac.on Management CISC437/637, Lecture #16 Ben Cartere?e Copyright Ben Cartere?e 1 Transac.ons A transac'on is a unit of program execu.on that accesses and possibly updates rela.ons The DBMS s view

More information

Linked Lists: Locking, Lock-Free, and Beyond. Companion slides for The Art of Multiprocessor Programming by Maurice Herlihy & Nir Shavit

Linked Lists: Locking, Lock-Free, and Beyond. Companion slides for The Art of Multiprocessor Programming by Maurice Herlihy & Nir Shavit Linked Lists: Locking, Lock-Free, and Beyond Companion slides for The Art of Multiprocessor Programming by Maurice Herlihy & Nir Shavit Concurrent Objects Adding threads should not lower throughput Contention

More information

Section 4 Concurrent Objects Correctness, Progress and Efficiency

Section 4 Concurrent Objects Correctness, Progress and Efficiency Section 4 Concurrent Objects Correctness, Progress and Efficiency CS586 - Panagiota Fatourou 1 Concurrent Objects A concurrent object is a data object shared by concurrently executing processes. Each object

More information

Introduction to Threads

Introduction to Threads Computer Systems Introduction to Threads Race Conditions Single- vs. Multi-Threaded Processes Process Process Thread Thread Thread Thread Memory Memory Heap Stack Heap Stack Stack Stack Data Data Code

More information

Shared-Memory Computability

Shared-Memory Computability Shared-Memory Computability 10011 Universal Object Wait-free/Lock-free computable = Threads with methods that solve n- consensus Art of Multiprocessor Programming Copyright Herlihy- Shavit 2007 93 GetAndSet

More information

The Java Memory Model

The Java Memory Model The Java Memory Model The meaning of concurrency in Java Bartosz Milewski Plan of the talk Motivating example Sequential consistency Data races The DRF guarantee Causality Out-of-thin-air guarantee Implementation

More information

Reminder from last ;me

Reminder from last ;me Concurrent systems Lecture 5: Concurrency without shared data; transac;ons Dr Robert N. M. Watson 1 Reminder from last ;me Liveness proper;es Deadlock (requirements; resource alloca;on graphs; detec;on;

More information

SPIN, PETERSON AND BAKERY LOCKS

SPIN, PETERSON AND BAKERY LOCKS Concurrent Programs reasoning about their execution proving correctness start by considering execution sequences CS4021/4521 2018 jones@scss.tcd.ie School of Computer Science and Statistics, Trinity College

More information

Computer Programming-I. Developed by: Strawberry

Computer Programming-I. Developed by: Strawberry Computer Programming-I Objec=ve of CP-I The course will enable the students to understand the basic concepts of structured programming. What is programming? Wri=ng a set of instruc=ons that computer use

More information

CSE 613: Parallel Programming. Lecture 17 ( Concurrent Data Structures: Queues and Stacks )

CSE 613: Parallel Programming. Lecture 17 ( Concurrent Data Structures: Queues and Stacks ) CSE 613: Parallel Programming Lecture 17 ( Concurrent Data Structures: Queues and Stacks ) Rezaul A. Chowdhury Department of Computer Science SUNY Stony Brook Spring 2012 Desirable Properties of Concurrent

More information

Story so far. Parallel Data Structures. Parallel data structure. Working smoothly with Galois iterators

Story so far. Parallel Data Structures. Parallel data structure. Working smoothly with Galois iterators Story so far Parallel Data Structures Wirth s motto Algorithm + Data structure = Program So far, we have studied parallelism in regular and irregular algorithms scheduling techniques for exploiting parallelism

More information

Synchroniza+on II COMS W4118

Synchroniza+on II COMS W4118 Synchroniza+on II COMS W4118 References: Opera+ng Systems Concepts (9e), Linux Kernel Development, previous W4118s Copyright no2ce: care has been taken to use only those web images deemed by the instructor

More information

COMP Parallel Computing. CC-NUMA (2) Memory Consistency

COMP Parallel Computing. CC-NUMA (2) Memory Consistency COMP 633 - Parallel Computing Lecture 11 September 26, 2017 Memory Consistency Reading Patterson & Hennesey, Computer Architecture (2 nd Ed.) secn 8.6 a condensed treatment of consistency models Coherence

More information

Blocking Non-blocking Caveat:

Blocking Non-blocking Caveat: Overview of Lecture 5 1 Progress Properties 2 Blocking The Art of Multiprocessor Programming. Maurice Herlihy and Nir Shavit. Morgan Kaufmann, 2008. Deadlock-free: some thread trying to get the lock eventually

More information

The Wait-Free Hierarchy

The Wait-Free Hierarchy Jennifer L. Welch References 1 M. Herlihy, Wait-Free Synchronization, ACM TOPLAS, 13(1):124-149 (1991) M. Fischer, N. Lynch, and M. Paterson, Impossibility of Distributed Consensus with One Faulty Process,

More information

CS370 Opera;ng Systems Midterm Review. Yashwant K Malaiya Spring 2018

CS370 Opera;ng Systems Midterm Review. Yashwant K Malaiya Spring 2018 CS370 Opera;ng Systems Midterm Review Yashwant K Malaiya Spring 2018 1 1 Computer System Structures Computer System Opera2on Stack for calling func2ons (subrou2nes) I/O Structure: polling, interrupts,

More information

Mutual Exclusion: Classical Algorithms for Locks

Mutual Exclusion: Classical Algorithms for Locks Mutual Exclusion: Classical Algorithms for Locks John Mellor-Crummey Department of Computer Science Rice University johnmc@cs.rice.edu COMP 422 Lecture 18 21 March 2006 Motivation Ensure that a block of

More information

Parallel Computer Architecture Spring Memory Consistency. Nikos Bellas

Parallel Computer Architecture Spring Memory Consistency. Nikos Bellas Parallel Computer Architecture Spring 2018 Memory Consistency Nikos Bellas Computer and Communications Engineering Department University of Thessaly Parallel Computer Architecture 1 Coherence vs Consistency

More information

Shared Objects. Shared Objects

Shared Objects. Shared Objects Shared Objects Shared Objects Invoked operations have a non-zero duration Invocations can overlap Useful for: modeling distributed shared memory Objects can be combined together to implement higher level

More information

Coherence and Consistency

Coherence and Consistency Coherence and Consistency 30 The Meaning of Programs An ISA is a programming language To be useful, programs written in it must have meaning or semantics Any sequence of instructions must have a meaning.

More information

CS5460: Operating Systems

CS5460: Operating Systems CS5460: Operating Systems Lecture 9: Implementing Synchronization (Chapter 6) Multiprocessor Memory Models Uniprocessor memory is simple Every load from a location retrieves the last value stored to that

More information

Mutual Exclusion. 1 Formal problem definitions. Time notion CSE /17/2015. Outline of this lecture:

Mutual Exclusion. 1 Formal problem definitions. Time notion CSE /17/2015. Outline of this lecture: CSE 539 03/17/2015 Mutual Exclusion Lecture 15 Scribe: Son Dinh Outline of this lecture: 1. Formal problem definitions 2. Solution for 2 threads 3. Solution for n threads 4. Inherent costs of mutual exclusion

More information

Proofs about Programs

Proofs about Programs Proofs about Programs Program Verification (Rosen, Sections 5.5) TOPICS Program Correctness Preconditions & Postconditions Program Verification Assignment Statements Conditional Statements Loops Composition

More information

Symmetric Multiprocessors: Synchronization and Sequential Consistency

Symmetric Multiprocessors: Synchronization and Sequential Consistency Constructive Computer Architecture Symmetric Multiprocessors: Synchronization and Sequential Consistency Arvind Computer Science & Artificial Intelligence Lab. Massachusetts Institute of Technology November

More information

Thread-unsafe code. Synchronized blocks

Thread-unsafe code. Synchronized blocks Thread-unsafe code How can the following class be broken by mul6ple threads? 1 public class Counter { 2 private int c = 0; 3 4 public void increment() { int old = c; 5 6 c = old + 1; // c++; 7 8 public

More information

Database design and implementation CMPSCI 645. Lectures 18: Transactions and Concurrency

Database design and implementation CMPSCI 645. Lectures 18: Transactions and Concurrency Database design and implementation CMPSCI 645 Lectures 18: Transactions and Concurrency 1 DBMS architecture Query Parser Query Rewriter Query Op=mizer Query Executor Lock Manager Concurrency Control Access

More information

On the Definition of Sequential Consistency

On the Definition of Sequential Consistency On the Definition of Sequential Consistency Ali Sezgin Ganesh Gopalakrishnan Abstract The definition of sequential consistency is compared with an intuitive notion of correctness. A relation between what

More information

Locking Granularity. CS 475, Spring 2019 Concurrent & Distributed Systems. With material from Herlihy & Shavit, Art of Multiprocessor Programming

Locking Granularity. CS 475, Spring 2019 Concurrent & Distributed Systems. With material from Herlihy & Shavit, Art of Multiprocessor Programming Locking Granularity CS 475, Spring 2019 Concurrent & Distributed Systems With material from Herlihy & Shavit, Art of Multiprocessor Programming Discussion: HW1 Part 4 addtolist(key1, newvalue) Thread 1

More information

Foundations of the C++ Concurrency Memory Model

Foundations of the C++ Concurrency Memory Model Foundations of the C++ Concurrency Memory Model John Mellor-Crummey and Karthik Murthy Department of Computer Science Rice University johnmc@rice.edu COMP 522 27 September 2016 Before C++ Memory Model

More information

MULTITHREADING AND SYNCHRONIZATION. CS124 Operating Systems Fall , Lecture 10

MULTITHREADING AND SYNCHRONIZATION. CS124 Operating Systems Fall , Lecture 10 MULTITHREADING AND SYNCHRONIZATION CS124 Operating Systems Fall 2017-2018, Lecture 10 2 Critical Sections Race conditions can be avoided by preventing multiple control paths from accessing shared state

More information

SELECTED TOPICS IN COHERENCE AND CONSISTENCY

SELECTED TOPICS IN COHERENCE AND CONSISTENCY SELECTED TOPICS IN COHERENCE AND CONSISTENCY Michel Dubois Ming-Hsieh Department of Electrical Engineering University of Southern California Los Angeles, CA90089-2562 dubois@usc.edu INTRODUCTION IN CHIP

More information

Lecture 27: Safety and Liveness Properties, Java Synchronizers, Dining Philosophers Problem

Lecture 27: Safety and Liveness Properties, Java Synchronizers, Dining Philosophers Problem COMP 322: Fundamentals of Parallel Programming Lecture 27: Safety and Liveness Properties, Java Synchronizers, Dining Philosophers Problem Mack Joyner and Zoran Budimlić {mjoyner, zoran}@rice.edu http://comp322.rice.edu

More information

CSL373: Lecture 5 Deadlocks (no process runnable) + Scheduling (> 1 process runnable)

CSL373: Lecture 5 Deadlocks (no process runnable) + Scheduling (> 1 process runnable) CSL373: Lecture 5 Deadlocks (no process runnable) + Scheduling (> 1 process runnable) Past & Present Have looked at two constraints: Mutual exclusion constraint between two events is a requirement that

More information

CS510 Advanced Topics in Concurrency. Jonathan Walpole

CS510 Advanced Topics in Concurrency. Jonathan Walpole CS510 Advanced Topics in Concurrency Jonathan Walpole Threads Cannot Be Implemented as a Library Reasoning About Programs What are the valid outcomes for this program? Is it valid for both r1 and r2 to

More information

Cache-Aware Lock-Free Queues for Multiple Producers/Consumers and Weak Memory Consistency

Cache-Aware Lock-Free Queues for Multiple Producers/Consumers and Weak Memory Consistency Cache-Aware Lock-Free Queues for Multiple Producers/Consumers and Weak Memory Consistency Anders Gidenstam Håkan Sundell Philippas Tsigas School of business and informatics University of Borås Distributed

More information

The New Java Technology Memory Model

The New Java Technology Memory Model The New Java Technology Memory Model java.sun.com/javaone/sf Jeremy Manson and William Pugh http://www.cs.umd.edu/~pugh 1 Audience Assume you are familiar with basics of Java technology-based threads (

More information

Related Course Objec6ves

Related Course Objec6ves Syntax 9/18/17 1 Related Course Objec6ves Develop grammars and parsers of programming languages 9/18/17 2 Syntax And Seman6cs Programming language syntax: how programs look, their form and structure Syntax

More information

Relaxed Memory-Consistency Models

Relaxed Memory-Consistency Models Relaxed Memory-Consistency Models [ 9.1] In Lecture 13, we saw a number of relaxed memoryconsistency models. In this lecture, we will cover some of them in more detail. Why isn t sequential consistency

More information

Dr. George Michelogiannakis. EECS, University of California at Berkeley CRD, Lawrence Berkeley National Laboratory

Dr. George Michelogiannakis. EECS, University of California at Berkeley CRD, Lawrence Berkeley National Laboratory CS 152 Computer Architecture and Engineering Lecture 18: Snoopy Caches Dr. George Michelogiannakis EECS, University of California at Berkeley CRD, Lawrence Berkeley National Laboratory http://inst.eecs.berkeley.edu/~cs152!

More information

UPCRC. Illiac. Gigascale System Research Center. Petascale computing. Cloud Computing Testbed (CCT) 2

UPCRC. Illiac. Gigascale System Research Center. Petascale computing. Cloud Computing Testbed (CCT) 2 Illiac UPCRC Petascale computing Gigascale System Research Center Cloud Computing Testbed (CCT) 2 www.parallel.illinois.edu Mul2 Core: All Computers Are Now Parallel We con'nue to have more transistors

More information

Instructor: Randy H. Katz hap://inst.eecs.berkeley.edu/~cs61c/fa13. Fall Lecture #7. Warehouse Scale Computer

Instructor: Randy H. Katz hap://inst.eecs.berkeley.edu/~cs61c/fa13. Fall Lecture #7. Warehouse Scale Computer CS 61C: Great Ideas in Computer Architecture Everything is a Number Instructor: Randy H. Katz hap://inst.eecs.berkeley.edu/~cs61c/fa13 9/19/13 Fall 2013 - - Lecture #7 1 New- School Machine Structures

More information

Models of concurrency & synchronization algorithms

Models of concurrency & synchronization algorithms Models of concurrency & synchronization algorithms Lecture 3 of TDA383/DIT390 (Concurrent Programming) Carlo A. Furia Chalmers University of Technology University of Gothenburg SP3 2016/2017 Today s menu

More information

A simple correctness proof of the MCS contention-free lock. Theodore Johnson. Krishna Harathi. University of Florida. Abstract

A simple correctness proof of the MCS contention-free lock. Theodore Johnson. Krishna Harathi. University of Florida. Abstract A simple correctness proof of the MCS contention-free lock Theodore Johnson Krishna Harathi Computer and Information Sciences Department University of Florida Abstract Mellor-Crummey and Scott present

More information

Program Verification (Rosen, Sections 5.5)

Program Verification (Rosen, Sections 5.5) Program Verification (Rosen, Sections 5.5) TOPICS Program Correctness Preconditions & Postconditions Program Verification Assignments Composition Conditionals Loops Proofs about Programs Why study logic?

More information

Process Synchronization

Process Synchronization Process Synchronization Concurrent access to shared data may result in data inconsistency Multiple threads in a single process Maintaining data consistency requires mechanisms to ensure the orderly execution

More information

Indistinguishability: Friend and Foe of Concurrent Data Structures. Hagit Attiya CS, Technion

Indistinguishability: Friend and Foe of Concurrent Data Structures. Hagit Attiya CS, Technion Indistinguishability: Friend and Foe of Concurrent Data Structures Hagit Attiya CS, Technion Uncertainty is a main obstacle for designing correct applications in concurrent systems Formally captured by

More information

Concurrent specifications beyond linearizability

Concurrent specifications beyond linearizability Concurrent specifications beyond linearizability Éric Goubault Jérémy Ledent Samuel Mimram École Polytechnique, France OPODIS 2018, Hong Kong December 19, 2018 1 / 14 Objects Processes communicate through

More information

Lecture Topics. Announcements. Today: Concurrency: Mutual Exclusion (Stallings, chapter , 5.7)

Lecture Topics. Announcements. Today: Concurrency: Mutual Exclusion (Stallings, chapter , 5.7) Lecture Topics Today: Concurrency: Mutual Exclusion (Stallings, chapter 5.1-5.4, 5.7) Next: Concurrency: Deadlock and Starvation (Stallings, chapter 6.1, 6.6-6.8) 1 Announcements Self-Study Exercise #5

More information

1 The comparison of QC, SC and LIN

1 The comparison of QC, SC and LIN Com S 611 Spring Semester 2009 Algorithms for Multiprocessor Synchronization Lecture 5: Tuesday, 3rd February 2009 Instructor: Soma Chaudhuri Scribe: Jianrong Dong 1 The comparison of QC, SC and LIN Pi

More information

Overview: Memory Consistency

Overview: Memory Consistency Overview: Memory Consistency the ordering of memory operations basic definitions; sequential consistency comparison with cache coherency relaxing memory consistency write buffers the total store ordering

More information

NON-BLOCKING DATA STRUCTURES AND TRANSACTIONAL MEMORY. Tim Harris, 28 November 2014

NON-BLOCKING DATA STRUCTURES AND TRANSACTIONAL MEMORY. Tim Harris, 28 November 2014 NON-BLOCKING DATA STRUCTURES AND TRANSACTIONAL MEMORY Tim Harris, 28 November 2014 Lecture 8 Problems with locks Atomic blocks and composition Hardware transactional memory Software transactional memory

More information

DISTRIBUTED COMPUTER SYSTEMS

DISTRIBUTED COMPUTER SYSTEMS DISTRIBUTED COMPUTER SYSTEMS CONSISTENCY AND REPLICATION CONSISTENCY MODELS Dr. Jack Lange Computer Science Department University of Pittsburgh Fall 2015 Consistency Models Background Replication Motivation

More information

Memory Consistency. Minsoo Ryu. Department of Computer Science and Engineering. Hanyang University. Real-Time Computing and Communications Lab.

Memory Consistency. Minsoo Ryu. Department of Computer Science and Engineering. Hanyang University. Real-Time Computing and Communications Lab. Memory Consistency Minsoo Ryu Department of Computer Science and Engineering 2 Distributed Shared Memory Two types of memory organization in parallel and distributed systems Shared memory (shared address

More information

DD2451 Parallel and Distributed Computing --- FDD3008 Distributed Algorithms

DD2451 Parallel and Distributed Computing --- FDD3008 Distributed Algorithms DD2451 Parallel and Distributed Computing --- FDD3008 Distributed Algorithms Lecture 1 Mads Dam Autumn/Winter 2011 DD2451 Overview Lectures 12 double lectures Twice a week until beg. December Focus on

More information

Order Is A Lie. Are you sure you know how your code runs?

Order Is A Lie. Are you sure you know how your code runs? Order Is A Lie Are you sure you know how your code runs? Order in code is not respected by Compilers Processors (out-of-order execution) SMP Cache Management Understanding execution order in a multithreaded

More information

Verifica(on of Concurrent Programs

Verifica(on of Concurrent Programs Verifica(on of Concurrent Programs Parker Aldric Mar With special thanks to: Azadeh Farzan and Zachary Kincaid Research Field: Program Verifica(on Goal is to program code that is safe, i.e. code that produces

More information

CMSC Computer Architecture Lecture 15: Memory Consistency and Synchronization. Prof. Yanjing Li University of Chicago

CMSC Computer Architecture Lecture 15: Memory Consistency and Synchronization. Prof. Yanjing Li University of Chicago CMSC 22200 Computer Architecture Lecture 15: Memory Consistency and Synchronization Prof. Yanjing Li University of Chicago Administrative Stuff! Lab 5 (multi-core) " Basic requirements: out later today

More information

Modern High-Performance Locking

Modern High-Performance Locking Modern High-Performance Locking Nir Shavit Slides based in part on The Art of Multiprocessor Programming by Maurice Herlihy & Nir Shavit Locks (Mutual Exclusion) public interface Lock { public void lock();

More information

Distributed Computing through Combinatorial Topology MITRO207, P4, 2017

Distributed Computing through Combinatorial Topology MITRO207, P4, 2017 Distributed Computing through MITRO207, P4, 2017 Administrivia Language: (fr)anglais? Lectures: Fridays (28.04, 20.05-23.06, 30.06), Thursday (29.06), 8:30-11:45, B555-557 Web page: http://perso.telecom-paristech.fr/~kuznetso/

More information