2008 dce Distributed Shared Memory Pham Quoc Cuong & Phan Dinh Khoi Use some slides of James Deak - NJIT.

Slides:



Advertisements
Similar presentations
Slides for Chapter 18: Distributed Shared Memory From Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design Edition 4, © Pearson Education.
Advertisements

Relaxed Consistency Models. Outline Lazy Release Consistency TreadMarks DSM system.
Presented by Evan Yang. Overview of Munin  Distributed shared memory (DSM) system  Unique features Multiple consistency protocols Release consistency.
Study of Hurricane and Tornado Operating Systems By Shubhanan Bakre.
Distributed Shared Memory
Consistency Models Based on Tanenbaum/van Steen’s “Distributed Systems”, Ch. 6, section 6.2.
1 Lecture 12: Hardware/Software Trade-Offs Topics: COMA, Software Virtual Memory.
CS 425 / ECE 428 Distributed Systems Fall 2014 Indranil Gupta (Indy) Lecture 25: Distributed Shared Memory All slides © IG.
Distributed Operating Systems CS551 Colorado State University at Lockheed-Martin Lecture 4 -- Spring 2001.
Slides for Parallel Programming Techniques & Applications Using Networked Workstations & Parallel Computers 2nd ed., by B. Wilkinson & M
Computer Science Lecture 14, page 1 CS677: Distributed OS Consistency and Replication Today: –Introduction –Consistency models Data-centric consistency.
1 Multiprocessors. 2 Idea: create powerful computers by connecting many smaller ones good news: works for timesharing (better than supercomputer) bad.
1 Chapter 8 Virtual Memory Virtual memory is a storage allocation scheme in which secondary memory can be addressed as though it were part of main memory.
Distributed Resource Management: Distributed Shared Memory
©Brooks/Cole, 2003 Chapter 7 Operating Systems Dr. Barnawi.
Memory Consistency Models
CSS434 DSM1 CSS434 Distributed Shared Memory Textbook Ch18 Professor: Munehiro Fukuda.
PRASHANTHI NARAYAN NETTEM.
ECE669 L17: Memory Systems April 1, 2004 ECE 669 Parallel Computer Architecture Lecture 17 Memory Systems.
Dr. Kalpakis CMSC 621, Advanced Operating Systems. Fall 2003 URL: Distributed Shared Memory.
Multiprocessor Cache Coherency
Memory Consistency Models Some material borrowed from Sarita Adve’s (UIUC) tutorial on memory consistency models.
Lecture 4: Parallel Programming Models. Parallel Programming Models Parallel Programming Models: Data parallelism / Task parallelism Explicit parallelism.
Distributed Shared Memory Systems and Programming
Distributed Shared Memory: A Survey of Issues and Algorithms B,. Nitzberg and V. Lo University of Oregon.
Distributed Shared Memory (DSM)
Lazy Release Consistency for Software Distributed Shared Memory Pete Keleher Alan L. Cox Willy Z.
CSE 486/586, Spring 2012 CSE 486/586 Distributed Systems Distributed Shared Memory Steve Ko Computer Sciences and Engineering University at Buffalo.
B. Prabhakaran 1 Distributed Shared Memory DSM provides a virtual address space that is shared among all nodes in the distributed system. Programs access.
ECE200 – Computer Organization Chapter 9 – Multiprocessors.
TECHNIQUES FOR REDUCING CONSISTENCY- RELATED COMMUNICATION IN DISTRIBUTED SHARED-MEMORY SYSTEMS J. B. Carter University of Utah J. K. Bennett and W. Zwaenepoel.
Memory Coherence in Shared Virtual Memory System ACM Transactions on Computer Science(TOCS), 1989 KAI LI Princeton University PAUL HUDAK Yale University.
CS425/CSE424/ECE428 – Distributed Systems Nikita Borisov - UIUC1 Some material derived from slides by I. Gupta, M. Harandi, J. Hou, S. Mitra,
1 Lecture 12: Hardware/Software Trade-Offs Topics: COMA, Software Virtual Memory.
Ch 10 Shared memory via message passing Problems –Explicit user action needed –Address spaces are distinct –Small Granularity of Transfer Distributed Shared.
Distributed Shared Memory Based on Reference paper: Distributed Shared Memory, Concepts and Systems.
Cache Coherence Protocols 1 Cache Coherence Protocols in Shared Memory Multiprocessors Mehmet Şenvar.
Distributed Shared Memory Presentation by Deepthi Reddy.
Distributed Shared Memory (part 1). Distributed Shared Memory (DSM) mem0 proc0 mem1 proc1 mem2 proc2 memN procN network... shared memory.
Implementation and Performance of Munin (Distributed Shared Memory System) Dongying Li Department of Electrical and Computer Engineering University of.
DISTRIBUTED COMPUTING
Page 1 Distributed Shared Memory Paul Krzyzanowski Distributed Systems Except as otherwise noted, the content of this presentation.
A Design of User-Level Distributed Shared Memory Zhi Zhai Feng Shen Computer Science and Engineering University of Notre Dame Oct. 27, 2009 Progress Report.
CIS 720 Distributed Shared Memory. Shared Memory Shared memory programs are easier to write Multiprocessor systems Message passing systems: - no physically.
Memory Coherence in Shared Virtual Memory Systems Yeong Ouk Kim, Hyun Gi Ahn.
1 Chapter 9 Distributed Shared Memory. 2 Making the main memory of a cluster of computers look as though it is a single memory with a single address space.
Lazy Release Consistency for Software Distributed Shared Memory Pete Keleher Alan L. Cox Willy Z. By Nooruddin Shaik.
Memory Coherence in Shared Virtual Memory System ACM Transactions on Computer Science(TOCS), 1989 KAI LI Princeton University PAUL HUDAK Yale University.
Lecture 4 Mechanisms & Kernel for NOSs. Mechanisms for Network Operating Systems  Network operating systems provide three basic mechanisms that support.
1 Lecture 19: Scalable Protocols & Synch Topics: coherence protocols for distributed shared-memory multiprocessors and synchronization (Sections )
OpenMP for Networks of SMPs Y. Charlie Hu, Honghui Lu, Alan L. Cox, Willy Zwaenepoel ECE1747 – Parallel Programming Vicky Tsang.
Distributed shared memory u motivation and the main idea u consistency models F strict and sequential F causal F PRAM and processor F weak and release.
Lectures 8 & 9 Virtual Memory - Paging & Segmentation System Design.
Implementation and Performance of Munin (Distributed Shared Memory System) Dongying Li Department of Electrical and Computer Engineering University of.
Memory Management.
Software Coherence Management on Non-Coherent-Cache Multicores
Distributed Shared Memory
12.4 Memory Organization in Multiprocessor Systems
Multiprocessor Cache Coherency
Ivy Eva Wu.
Chapter 10 Distributed Shared Memory
Distributed Shared Memory
Lecture 26 A: Distributed Shared Memory
Outline Midterm results summary Distributed file systems – continued
Distributed Shared Memory
Distributed Shared Memory
CSS490 Distributed Shared Memory
Exercises for Chapter 16: Distributed Shared Memory
Lecture 26 A: Distributed Shared Memory
Distributed Resource Management: Distributed Shared Memory
Presentation transcript:

2008 dce Distributed Shared Memory Pham Quoc Cuong & Phan Dinh Khoi Use some slides of James Deak - NJIT

Computer Engineering 2008 ©2008, Pham Quoc Cuong – Phan Dinh Khoi 2 Distributed Shared Memory Outline Introduction Design and Implementation Sequential consistency and Ivy – case study Release consistency and Munin – case study Other consistency models

Computer Engineering 2008 ©2008, Pham Quoc Cuong – Phan Dinh Khoi 3 Distributed Shared Memory Outline Introduction Design and Implementation Sequential consistency and Ivy – case study Release consistency and Munin – case study Other consistency models

Computer Engineering 2008 ©2008, Pham Quoc Cuong – Phan Dinh Khoi 4 Distributed Shared Memory Distributed Shared Memory (DSM) allows programs running on separate computers to share data without the programmer having to deal with sending messages Instead underlying technology will send the messages to keep the DSM consistent (or relatively consistent) between computers DSM allows programs that used to operate on the same computer to be easily adapted to operate on separate computers

Computer Engineering 2008 ©2008, Pham Quoc Cuong – Phan Dinh Khoi 5 Distributed Shared Memory Introduction Programs access what appears to them to be normal memory Hence, programs that use DSM are usually shorter and easier to understand than programs that use message passing However, DSM is not suitable for all situations. Client-server systems are generally less suited for DSM, but a server may be used to assist in providing DSM functionality for data shared between clients

Computer Engineering 2008 ©2008, Pham Quoc Cuong – Phan Dinh Khoi 6 Distributed Shared Memory The distributed shared memory abstraction Distributed Shared Memory (exists only virtually) CPU 1 CPU n Memory Memory- Mapping Manager CPU 1 CPU n Memory Memory- Mapping Manager CPU 1 CPU n Memory Memory- Mapping Manager Communication Network

Computer Engineering 2008 ©2008, Pham Quoc Cuong – Phan Dinh Khoi 7 Distributed Shared Memory DSM History Memory mapped files started in the MULTICS operating system in the 1960s One of the first DSM implementations was Apollo. One of the first system to use Apollo was Integrated shared Virtual memory at Yale (IVY) DSM developed in parallel with shared- memory multiprocessors

Computer Engineering 2008 ©2008, Pham Quoc Cuong – Phan Dinh Khoi 8 Distributed Shared Memory DSM vs Message passing DSMMessage passing Variables are shared directlyVariables have to be marshalled yourself Processes can cause error to one another by altering data Processes are protected from one another by having private address spaces Processes may execute with non-overlapping lifetimes Processes must execute at the same time Invisibility of communication’s cost Cost of communication is obvious

Computer Engineering 2008 ©2008, Pham Quoc Cuong – Phan Dinh Khoi 9 Distributed Shared Memory Outline Introduction Design and Implementation Sequential consistency and Ivy – case study Release consistency and Munin – case study Other consistency models

Computer Engineering 2008 ©2008, Pham Quoc Cuong – Phan Dinh Khoi 10 Distributed Shared Memory DSM implementations Hardware: Mainly used by shared-memory multiprocessors. The hardware resolves LOAD and STORE commands by communicating with remote memory as well as local memory Paged virtual memory: Pages of virtual memory get the same set of addresses for each program in the DSM system. This only works for computers with common data and paging formats. This implementation does not put extra structure requirements on the program since it is just a series of bytes.

Computer Engineering 2008 ©2008, Pham Quoc Cuong – Phan Dinh Khoi 11 Distributed Shared Memory DSM Implementations (continued) Middleware: DSM is provided by some languages and middleware without hardware or paging support. For this implementation, the programming language, underlying system libraries, or middleware send the messages to keep the data synchronized between programs so that the programmer does not have to.

Computer Engineering 2008 ©2008, Pham Quoc Cuong – Phan Dinh Khoi 12 Distributed Shared Memory Efficiency DSM systems can perform almost as well as equivalent message-passing programs for systems that run on about 10 or less computers. There are many factors that affect the efficiency of DSM, including the implementation, design approach, and memory consistency model chosen.

Computer Engineering 2008 ©2008, Pham Quoc Cuong – Phan Dinh Khoi 13 Distributed Shared Memory Design approaches Byte-oriented: This is implemented as a contiguous series of bytes. The language and programs determine the data structures Object-oriented: Language-level objects are used in this implementation. The memory is only accessed through class routines and therefore, OO semantics can be used when implementing this system Immutable data: Data is represented as a group of many tuples. Data can only be accessed through read, take, and write routines

Computer Engineering 2008 ©2008, Pham Quoc Cuong – Phan Dinh Khoi 14 Distributed Shared Memory Memory consistency To use DSM, one must also implement a distributed synchronization service. This includes the use of locks, semaphores, and message passing Most implementations, data is read from local copies of the data but updates to data must be propagated to other copies of the data Memory consistency models determine when data updates are propagated and what level of inconsistency is acceptable

Computer Engineering 2008 ©2008, Pham Quoc Cuong – Phan Dinh Khoi 15 Distributed Shared Memory Two processes accessing shared variables a := a + 1; b := b + 1; br := b; ar := a; if(ar ≥ br) then print ("OK"); Process 1Process 2

Computer Engineering 2008 ©2008, Pham Quoc Cuong – Phan Dinh Khoi 16 Distributed Shared Memory Memory consistency models Linearizability or atomic consistency is the strongest model. It ensures that reads and writes are made in the proper order. This results in a lot of underlying messaged being passed.  Variables can only be changed by a write operation  The order of operations is consistent with the real times at which the operations occurred in the actual execution Sequential consistency is strong, but not as strict. Reads and writes are done in the proper order in the context of individual programs.  The order of operations is consistent with the program order in which each individual client executed them

Computer Engineering 2008 ©2008, Pham Quoc Cuong – Phan Dinh Khoi 17 Distributed Shared Memory Memory consistency models (continued) Coherence has significantly weaker consistency. It ensures writes to individual memory locations are done in the proper order, but writes to separate locations can be done in improper order Weak consistency requires the programmer to use locks to ensure reads and writes are done in the proper order for data that needs it

Computer Engineering 2008 ©2008, Pham Quoc Cuong – Phan Dinh Khoi 18 Distributed Shared Memory Interleaving under sequential consistency br := b; ar := a; if(ar ≥ br) then print ("OK"); Time Process 1 Process 2 a := a + 1; b := b + 1; read write

Computer Engineering 2008 ©2008, Pham Quoc Cuong – Phan Dinh Khoi 19 Distributed Shared Memory Update options Write-update: Each update is multicast to all programs. Reads are performed on local copies of the data Write-invalidate: A message is multicast to each program invalidating their copy of the data before the data is updated. Other programs can request the updated data

Computer Engineering 2008 ©2008, Pham Quoc Cuong – Phan Dinh Khoi 20 Distributed Shared Memory DSM using write-update

Computer Engineering 2008 ©2008, Pham Quoc Cuong – Phan Dinh Khoi 21 Distributed Shared Memory Granularity Granularity is the amount of data sent with each update If granularity is too small and a large amount of contiguous data is updated, the overhead of sending many small messages leads to less efficiency If granularity is too large, a whole page (or more) would be sent for an update to a single byte, thus reducing efficiency

Computer Engineering 2008 ©2008, Pham Quoc Cuong – Phan Dinh Khoi 22 Distributed Shared Memory Data items laid out over pages

Computer Engineering 2008 ©2008, Pham Quoc Cuong – Phan Dinh Khoi 23 Distributed Shared Memory Trashing Thrashing occurs when network resources are exhausted, and more time is spent invalidating data and sending updates than is used doing actual work Based on system specifics, one should choose write-update or write-invalidate to avoid thrashing

Computer Engineering 2008 ©2008, Pham Quoc Cuong – Phan Dinh Khoi 24 Distributed Shared Memory Outline Introduction Design and Implementation Sequential consistency and Ivy – case study Release consistency and Munin – case study Other consistency models

Computer Engineering 2008 ©2008, Pham Quoc Cuong – Phan Dinh Khoi 25 Distributed Shared Memory Sequential consistency and Ivy case study This model is page-based A single segment is shared between programs The computers are equipped with a paged memory management unit The DSM restricts data access permissions temporarily in order to maintain sequential consistency Permissions can be none, read-only, or read- write

Computer Engineering 2008 ©2008, Pham Quoc Cuong – Phan Dinh Khoi 26 Distributed Shared Memory System model for page-based DSM

Computer Engineering 2008 ©2008, Pham Quoc Cuong – Phan Dinh Khoi 27 Distributed Shared Memory Write-update If a program tries to do more than it has permission for, a page fault occurs and the program is block until the page fault is resolved If writes can be buffered, write-updated is used

Computer Engineering 2008 ©2008, Pham Quoc Cuong – Phan Dinh Khoi 28 Distributed Shared Memory Write-invalidate If writes cannot be buffered, write-invalidate is used The invalidation message acts as requesting a lock on the data When one program is updating the data it has read-write permissions and everyone else has no permissions on that page At all other times, all have read-only access to the page

Computer Engineering 2008 ©2008, Pham Quoc Cuong – Phan Dinh Khoi 29 Distributed Shared Memory State transitions under write-invalidation Single writerMultiple reader W (invalidation) R P W writes; none read P R1, P R2,..P Rn read; none write RW (invalidation) Note: R = read fault occurs; W = write fault occurs.

Computer Engineering 2008 ©2008, Pham Quoc Cuong – Phan Dinh Khoi 30 Distributed Shared Memory Terminology copyset (p): the set of process that have a copy of page p owner(p): a process with the most up-to- date version of a page p

Computer Engineering 2008 ©2008, Pham Quoc Cuong – Phan Dinh Khoi 31 Distributed Shared Memory Write page-fault handling Process P W attempts to write a page p to which it does not have permission  The page p is transferred to P w if it has not an up-to- date read-only copy  An invalidate message is sent to all member of copyset(p)  copyset(p) = {P w }  owner(p) = P w

Computer Engineering 2008 ©2008, Pham Quoc Cuong – Phan Dinh Khoi 32 Distributed Shared Memory Read page-fault handling If a process P R attempts to read a page p for which it does not have permissions  The page is copied from owner(p) to P R  If current owner is a single writer => its access permission for p is set to read-only  Copyset(p) = copyset(p)  {P R }

Computer Engineering 2008 ©2008, Pham Quoc Cuong – Phan Dinh Khoi 33 Distributed Shared Memory Problems with invalidation protocols How to locate owner(p) for a given page p Where to store copyset(p)

Computer Engineering 2008 ©2008, Pham Quoc Cuong – Phan Dinh Khoi 34 Distributed Shared Memory Central manager and associated messages

Computer Engineering 2008 ©2008, Pham Quoc Cuong – Phan Dinh Khoi 35 Distributed Shared Memory Alternative manager strategy A central manager may become a performance bottleneck There are a three alternatives:  Fixed distributed page management where on program will manage a set of pages for its lifetime (even if it does not own them)  Multicast-based management where the owner of a page manages it, read and write requests are multicast, only the owner answers  Dynamic distributed management where each program keeps a set of the probable owner(s) of each page

Computer Engineering 2008 ©2008, Pham Quoc Cuong – Phan Dinh Khoi 36 Distributed Shared Memory Dynamic distributed manager Initially each process is supplied with accurate page locations PiPi p PjPj p transfers probOwner(p) PiPi PjPj invalidation probOwner(p) PiPi PjPj request read probOwner(p) granted read PiPi PjPj request probOwner(p) Forward request

Computer Engineering 2008 ©2008, Pham Quoc Cuong – Phan Dinh Khoi 37 Distributed Shared Memory Updating probOwner pointers (a) probOwner pointers just before process A takes a page fault for a page owned by E

Computer Engineering 2008 ©2008, Pham Quoc Cuong – Phan Dinh Khoi 38 Distributed Shared Memory Updating probOwner pointers (b) Write fault: probOwner pointers after A's write request is forwarded

Computer Engineering 2008 ©2008, Pham Quoc Cuong – Phan Dinh Khoi 39 Distributed Shared Memory Updating probOwner pointers (c) Read fault: probOwner pointers after A's read request is forwarded

Computer Engineering 2008 ©2008, Pham Quoc Cuong – Phan Dinh Khoi 40 Distributed Shared Memory Outline Introduction Design and Implementation Sequential consistency and Ivy – case study Release consistency and Munin – case study Other consistency models

Computer Engineering 2008 ©2008, Pham Quoc Cuong – Phan Dinh Khoi 41 Distributed Shared Memory Release consistency and Munin case study Be weaker than sequential consistency, but cheaper to implement Reduce overhead Used semaphores, locks, and barriers to achieve enough consistency

Computer Engineering 2008 ©2008, Pham Quoc Cuong – Phan Dinh Khoi 42 Distributed Shared Memory Memory accesses Types of memory accesses:  Competing accesses They may occur concurrently – there is no enforced ordering between them At least one is a write  Non-competing or ordinary accesses All read-only access, or enforced ordering

Computer Engineering 2008 ©2008, Pham Quoc Cuong – Phan Dinh Khoi 43 Distributed Shared Memory Competing Memory Access Competing memory accesses are divided into two categories:  Synchronization accesses are concurrent and contribute to synchronization  Non-synchronization accesses are concurrent but do not contribute to synchronization

Computer Engineering 2008 ©2008, Pham Quoc Cuong – Phan Dinh Khoi 44 Distributed Shared Memory Release consistency requirements To achieve release consistency, the system must:  Preserve synchronization with locks  Gain performance by allowing asynchronous memory operations  Limit the overlap between memory operations

Computer Engineering 2008 ©2008, Pham Quoc Cuong – Phan Dinh Khoi 45 Distributed Shared Memory Release consistency requirements One must acquire appropriate permissions before performing memory operations All memory operations must be performed before releasing memory Acquiring permissions and releasing memory

Computer Engineering 2008 ©2008, Pham Quoc Cuong – Phan Dinh Khoi 46 Distributed Shared Memory Munin Munin had programmers use acquireLock, releaseLock, and waitAtBarrier Munin sends updates/invalidations when locks are released  An alternative has the update/invalidation sent when the lock is next acquired

Computer Engineering 2008 ©2008, Pham Quoc Cuong – Phan Dinh Khoi 47 Distributed Shared Memory Processes executing on a release-consistent DSM Process 1: acquireLock();// enter critical section a := a + 1; b := b + 1; releaseLock();// leave critical section Process 2: acquireLock();// enter critical section print ("The values of a and b are: ", a, b); releaseLock();// leave critical section

Computer Engineering 2008 ©2008, Pham Quoc Cuong – Phan Dinh Khoi 48 Distributed Shared Memory Munin: Sharing annotations The following are options with Munin on the data item level:  Using write-update or write-invalidate  Whether several copies of data may exist  Whether to send updates/invalidate immediately  Whether a data has a fixed owner, and whether that data can be modified by several at once  Whether the data can be modified at all  Whether the data is shared by a fixed set of programs

Computer Engineering 2008 ©2008, Pham Quoc Cuong – Phan Dinh Khoi 49 Distributed Shared Memory Munin: Standard annotations Read-only: Initialized, but not allow to be updated Migratory: Programs access a particular data item in turn Write-shared: Programs access the same data item, but write to different parts of the data item Producer-consumer:  One program write to the data item  A fixed set of programs read it Reduction: The data is always locked, read, updated, and unlocked Result: Several programs write to different parts of one data item. One program reads it Conventional: Data is managed using write-invalidate

Computer Engineering 2008 ©2008, Pham Quoc Cuong – Phan Dinh Khoi 50 Distributed Shared Memory Outline Introduction Design and Implementation Sequential consistency and Ivy – case study Release consistency and Munin – case study Other consistency models

Computer Engineering 2008 ©2008, Pham Quoc Cuong – Phan Dinh Khoi 51 Distributed Shared Memory Other consistency models Casual consistency – The happened – before relationship can be applied to read and write operations Pipelining RAM – Programs apply write operations through pipelining Processor consistency – Pipelining RAM plus memory coherent

Computer Engineering 2008 ©2008, Pham Quoc Cuong – Phan Dinh Khoi 52 Distributed Shared Memory Other consistency models Entry consistency – Every shared data item is paired with a synchronization object Scope consistency – Locks are applied automatically to data objects instead of relying on programmers to apply locks Weak consistency – Guarantees that previous read and write operations complete before acquire or release operations

Computer Engineering 2008 ©2008, Pham Quoc Cuong – Phan Dinh Khoi 53 Distributed Shared Memory Summary Design and Implementation Sequential consistency and Ivy – case study Release consistency and Munin – case study Other consistency models