1 © R. Guerraoui Registers Prof R. Guerraoui Distributed Programming Laboratory.

Slides:



Advertisements
Similar presentations
1 © R. Guerraoui The Limitations of Registers R. Guerraoui Distributed Programming Laboratory.
Advertisements

CSNB143 – Discrete Structure
Optimizing single thread performance Dependence Loop transformations.
1 © R. Guerraoui The Power of Registers Prof R. Guerraoui Distributed Programming Laboratory.
Bernstein’s Conditions. Techniques to Exploit Parallelism in Sequential Programming Hierarchy of levels of parallelism: Procedure or Methods Statements.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 6: Process Synchronization.
Process Synchronization. Module 6: Process Synchronization Background The Critical-Section Problem Peterson’s Solution Synchronization Hardware Semaphores.
COP4020 Programming Languages Expression and assignment Prof. Xin Yuan.
1 © R. Guerraoui Implementing the Consensus Object with Timing Assumptions R. Guerraoui Distributed Programming Laboratory.
Foundations of Shared Memory Companion slides for The Art of Multiprocessor Programming by Maurice Herlihy & Nir Shavit Art of Multiprocessor Programming.
1 © R. Guerraoui Object implementations out of faulty base objects Prof R. Guerraoui Distributed Programming Laboratory.
1 © R. Guerraoui - Shared Memory - R. Guerraoui Distributed Programming Laboratory lpdwww.epfl.ch.
1 Chapter 7: Runtime Environments. int * larger (int a, int b) { if (a > b) return &a; //wrong else return &b; //wrong } int * larger (int *a, int *b)
Distributed Algorithms (22903) Lecturer: Danny Hendler Shared objects: linearizability, wait-freedom and simulations Most of this presentation is based.
Dynamic Programming Code
1 Digital Logic
11-1 Matrix-chain Multiplication Suppose we have a sequence or chain A 1, A 2, …, A n of n matrices to be multiplied –That is, we want to compute the product.
Distributed Systems Terminating Reliable Broadcast Prof R. Guerraoui Distributed Programming Laboratory.
Midterm Exam 06: Exercise 2 Atomic Shared Memory.
MATRICES. Matrices A matrix is a rectangular array of objects (usually numbers) arranged in m horizontal rows and n vertical columns. A matrix with m.
Operating Systems CSE 411 CPU Management Oct Lecture 13 Instructor: Bhuvan Urgaonkar.
1 © R. Guerraoui Seth Gilbert Professor: Rachid Guerraoui Assistants: M. Kapalka and A. Dragojevic Distributed Programming Laboratory.
Chapter 13. Binary Files In binary files we do not need to format data File streams include two member functions specifically designed to input and output.
MIPS coding. SPIM Some links can be found such as:
IT253: Computer Organization Lecture 4: Instruction Set Architecture Tonga Institute of Higher Education.
Programmer's view on Computer Architecture by Istvan Haller.
Digital Computer Concept and Practice Copyright ©2012 by Jaejin Lee Logic Circuits I.
Logic Design Dr. Yosry A. Azzam. Binary systems Chapter 1.
Operation Frequency No. of Clock cycles ALU ops % 1 Loads 25% 2
REGISTER TRANSFER AND MICROOPERATIONS
1 © R. Guerraoui Concurrent Algorithms (Overview) Prof R. Guerraoui Distributed Programming Laboratory.
Chapter 4 – Matrix CSNB 143 Discrete Mathematical Structures.
Lec 6 Data types. Variable: Its data object that is defined and named by the programmer explicitly in a program. Data Types: It’s a class of Dos together.
1 7.Algorithm Efficiency What to measure? Space utilization: amount of memory required  Time efficiency: amount of time required to process the data.
The Central Processing Unit (CPU) and the Machine Cycle.
1 © R. Guerraoui Regular register algorithms R. Guerraoui Distributed Programming Laboratory lpdwww.epfl.ch.
Basic Programming Lingo. A program is also known as a  Sequence of instructions  Application  App  Binary  Executable.
INT213-Week-2 Working with Variables. What is variable
1 Notation and Specification of Concurrency n Concurrency Topics  1. Sequential programming notation  2. Expressing concurrency with co and process 
Higher Computing Science 2016 Prelim Revision. Topics to revise Computational Constructs parameter passing (value and reference, formal and actual) sub-programs/routines,
“Towards Self Stabilizing Wait Free Shared Memory Objects” By:  Hopeman  Tsigas  Paptriantafilou Presented By: Sumit Sukhramani Kent State University.
Models of Computation: Automata and Formal Languages Sam M. Kim.
Distributed Algorithms (22903) Lecturer: Danny Hendler The Atomic Snapshot Object The Renaming Problem This presentation is based on the book “Distributed.
“Distributed Algorithms” by Nancy A. Lynch SHARED MEMORY vs NETWORKS Presented By: Sumit Sukhramani Kent State University.
Distributed Algorithms (22903) Lecturer: Danny Hendler Shared objects: linearizability, wait-freedom and simulations Most of this presentation is based.
Foundations of Shared Memory Companion slides for The Art of Multiprocessor Programming by Maurice Herlihy & Nir Shavit.
1 Register Transfer and Microoperations Acknowledgment: Most of the slides are adapted from Prof. Hyunsoo Yoon’s slides.
Chapter 6 Synchronization Dr. Yingwu Zhu. The Problem with Concurrent Execution Concurrent processes (& threads) often access shared data and resources.
A very brief introduction to Matrix (Section 2.7) Definitions Some properties Basic matrix operations Zero-One (Boolean) matrices.
CSCE 668 DISTRIBUTED ALGORITHMS AND SYSTEMS
Constructing MRMW Atomic Registers from Safe Bits
Atomic register algorithms
Expressions and Assignment
Computing with anonymous processes
REGISTER TRANSFER LANGUAGE AND DESIGN OF CONTROL UNIT
Distributed systems Total Order Broadcast
Activation Records and Function Calls
Process Synchronization
Lecture 43 Section 10.1 Wed, Apr 6, 2005
Logic Circuits I Lecture 3.
Lecture 5 Binary Operation Boolean Logic. Binary Operations Addition Subtraction Multiplication Division.
Distributed Algorithms (22903)
Constructing Reliable Registers From Unreliable Byzantine Components
Distributed Algorithms (22903)
- Atomic register specification -
MIPS assembly.
R. Guerraoui Distributed Programming Laboratory lpdwww.epfl.ch
Computing with anonymous processes
Distributed Systems Terminating Reliable Broadcast
R. Guerraoui Distributed Programming Laboratory lpdwww.epfl.ch
Presentation transcript:

1 © R. Guerraoui Registers Prof R. Guerraoui Distributed Programming Laboratory

2 Register A register has two operations: read() and write() Sequential specification read() return(x) write(v) x <- v; return(ok)

3 Space of registers Dimension 1: binary (boolean) – multivalued Dimension 2: safe – regular – atomic Dimension 3: SRSW – MRSW – MRMW

4 Space of registers Theorem: A multivalued MRMW atomic register can be implemented with binary SRSW safe register (2 decades of research in distributed computing)

5 Safe execution p1 p2 p3 write(1) - ok read() - 1 read() - 25

6 Regular execution p1 p2 p3 write(1) - ok read() - 0 read() - 1

7 Simplifications We assume that registers contain only integers Unless explicitely stated otherwise, registers are initially supposed to contain 0 The process executing the code is implicitely assumed to be pi (we assume a system of N processes)

8 Conventions Shared registers are denoted Reg The operations to be implemented are denoted Read() and Write() Those of the base registers are denoted read() and write() We omit the return(ok) instruction at the end of Write() implementations

9 From (binary) SRSW safe to (binary) MRSW safe Read() return (Reg  i .read()); We use an array of SRSW registers Reg  1,..,N  Write(v) for j = 1 to N Reg  j .write(v);

10 The transformation works also for multi- valued registers and regular ones It does not however work for atomic registers From (binary) SRSW safe to (binary) MRSW safe

11 From Binary MRSW safe to Binary MRSW regular We use one MRSW safe register Read() return(Reg.read()); Write(v) if old ≠ v then Reg.write(v); old := v;

12 The transformation works for single reader registers It does not work for multi-valued registers It does not work for atomic registers From Binary MRSW safe to Binary MRSW regular

13 From binary to M-Valued MRSW regular Read() for j = 0 to M if Reg  j .read() = 1 then return(j) We use an array of MRSW registers Reg  0,1,..,M  init to  1,0,..,0  Write(v) Reg  v .write(1); for j=v-1 downto 0 Reg  j .write(0);

14 The transformation would not work if the Write() would first write 0s and then 1 The transformation works for regular but NOT for atomic registers From binary to M-Valued MRSW regular

15 From SRSW regular to SRSW atomic Read() (t’,x’) = Reg.read(); if t’ > t then t:=t’; x:=x’; return(x) We use one SRSW register Reg and two local variables t and x Write(v) t := t+1; Reg.write(v,t);

16 The transformation would not work for multiple readers The transformation would not work without timestamps (variable t representing logical time) From SRSW regular to SRSW atomic

17 From SRSW atomic to MRSW atomic We use N*N SRSW atomic registers RReg  (1,1),(1,2),..,(k,j),..(N,N)  to communicate among the readers In RReg  (k,j)  the reader is pk and the writer is pj We also use n SRSW atomic registers WReg  1,..,N  to store new values the writer in all these is p1 the reader in WReg  k  is pk

18 From SRSW atomic to MRSW atomic (cont’d) Write(v) t1 := t1+1; for j = 1 to N WReg.write(v,t1);

19 From SRSW atomic to MRSW atomic (cont’d) Read() for j = 1 to N do (t  j ,x  j  ) = RReg  i,j .read(); (t  0 ,x  0  ) = WReg  i .read(); (t,x) := highest(t .. ,x ..  ); for j = 1 to N do RReg  j,i .write(t,x); return(x)

20 From SRSW atomic to MRSW atomic (cont’d) The transformation would not work for multiple writers The transformation would not work if the readers do not communicate (i.e., if a reader does not write)

21 From MRSW atomic to MRMW atomic We use N MRSW atomic registers Reg  1,..,N  ; the writer of Reg  j  is pj Write(v) for j = 1 to N do (t  j ,x  j  ) = Reg  j .read(); (t,x) := highest(t .. ,x ..  ); t := t+1; Reg  i .write(t,v);

22 From MRSW atomic to MRMW atomic (cont’d) Read() for j = 1 to N do (t  j ,x  j  ) = Reg  j .read(); (t,x) := highest(t .. ,x ..  ); return(x)