Академический Документы
Профессиональный Документы
Культура Документы
Multicomputers
Each processor has its own local memory. Interprocess communication is via message passing.
0 9
1 8
3 10
4 12
7 14
11
13
15
Memory CPU4
CPU1
CPU2
CPU3
DSM
It is essentially normal paging, except that remote RAM is being used as the backing store instead of the local disk.
DSM operation
When a process on a node wants to access some data from a memory block of the shared memory space
The local memory-mapping manager takes charge of its request. If the memory block containing the accessed data is resident in the local memory, the request is satisfied. Otherwise, a network block fault is generated and the control is passed to the operating system. The OS then sends a message to the node on which the desired memory block is located to get the block.
DSM operation
The missing block is migrated from the remote node to the client processs node and the OS maps it into the application address space. Data blocks keep migrating from one node to another on demand basis, but no communication is visible to the user processes. DSM allows replication/migration of data blocks
DSM
In this example, if processor 1 references instructions or data in pages 0, 2, 5,or 9, the references are done locally. References to other pages cause traps.
A reference to an address in page 10 will cause a trap to the operating system, which then moves page 10 from machine 2 to machine 1
11
13
15
10
12 14
CPU1
CPU2
CPU3
CPU4
11
13
15
10
10
12 14
CPU1
CPU2
CPU3
CPU4
In this way, processors 1 and 2 can both reference page 10 as often as needed without causing traps to fetch missing memory.
DSM
Possible variations : 1. No replication : Exactly one copy of each page. Consistency easy to maintain. 2. Replicate read only copies,single write copy. Consistency easy to maintain.
1. Granularity : Refers to the size of a block. Possible units are a few words, a page or a few pages. i.e The unit of data transfer across the network when there is a network block fault.
Factors that influence the size of the Block/page : 1. Paging Overhead : Due to the property of locality of reference(when a word within a page is accessed , words in and around the requested word are likely to be accessed in future) in case of small block size paging overhead increases since more no. of blocks need to be transferred.
2. Directory size : Larger the block size, smaller the directory(information about the blocks in the system). Hence reduced directory management overhead.
3. Thrashing : Thrashing Processes spend more time paging than executing. Larger block sizes leads to thrashing since it may happen that data items in the same data block are being updated by multiple nodes at the same time, causing large no. of block transfers without any progress in execution.
4. False sharing : Two processes on different processors contain data in the same block , hence the block is repeatedly transferred between the two processors. Having data belonging to 2 different processes in the same block is called FALSE SHARING. False sharing leads to thrashing
The relative advantages and disadvantages of small and large block sizes makes it difficult to decide on an optimum block size.
Therefore a suitable compromise is USING THE PAGE SIZE AS A BLOCK SIZE
Issues in Design and Implementation of DSM(consistency) 2. Memory Consistency : In a DSM that allows replication of shared data items, copies of shared data items may simultaneously be available in the MM of 2 or more nodes. Advantage of replication : 1. Improves reliability in case of failure of a copy. 2. Improves performance in terms of access time.
Hence we have a number of consistency models. Data Centric consistency models: Assumptions : 1. Data Store Distributed Shared Memory. 2. Each process can access data from the local copy available of the data store. 3. Data operation is classified as write when it changes data otherwise it is classified as a read operation
A consistency model is a contract between processes and the data store. It says that if processes agree to obey certain rules then the store promises to work correctly.
1. Strict Consistency :
Any read on a data item x returns a value corresponding to the result of the most recent write on x. All writes are instantaneously visible to all processes Strict consistency observed in a uniprocessor system. a=1; a=2; print(a); Value for a displayed is 2
Issues in Design and Implementation of DSM(consistency) The 2 updates should have been performed in the same order at each copy to achieve consistency(sequential)
If event B is caused/influenced by an earlier event A--- Then causality requires that everyone see A then see B
Events that are not causally related are called concurrent events.
a)
b)
1. Each synchronization variable has a current owner i.e the process that last acquired it.
2. The owner may enter and exit critical region (CR) repeatedly without having to send any messages on the network.
A valid event sequence for entry consistency. P1 does an acquire for x, changes x once after which it also does an acquire for y. P2 does an acquire for x but not for y, so it will read a for x but may read NIL for y. P3 first does an acquire for y, hence it will read value b for y
Protocols depends on whether the DSM system allows replication/migration of shared-memory blocks Different strategies are
Non-Replicated, Non-Migrating blocks (NRNMBs) Non-Replicated, Migrating blocks (NRMBs) Replicated, Migrating blocks (RMBs) Replicated, Non-Migrating blocks (RNMBs)
Response Data Locating in the NRNMB strategy : there is a singe copy of each block in the system The location of the block never changes
a copy of block
block
a copy of block
CSS434 DSM
72
CSS434 DSM
74
Client node
(has a replica of the data block) Modification
Sequenced modification
Sequenced modification
Sequenced modification
Replacement Strategy
3. Replacement Strategy
If the available space for the shared data at a node fills up , then the issues that needs to be addressed is : 1. Which block to replace to make space for the newly required block ? Two categories of replacement algorithms--- a) Usage based v/s non-usage based : Usage based algorithm : Keeps track of a history of usage of a page to make replacement decisions. Eg. LRU b) Non usage based algorithm : Do not keep track of use of a page while making replacement decision. Eg: FIFO/Random
CSS434 DSM 79
Replacement Strategy
b) Fixed space v/s variable space : Fixed space algorithm assume that the memory size is fixed while variable space algorithms are based on the assumptions that memory size can change dynamically depending on the need. Fixed space-Involves selection of a specific page for replacement. Variable space A fetch does not imply a replacement. Variable space concept is not suitable for DSM since each nodes memory that acts as a cache for the virtually shared memory is fixed in size.
Replacement Strategy
One of the first DSM implementation was IVY (Integrated shared Virtual memory at Yale) Each memory block of a node is classified into one of the 5 types :
1. 2. 3. 4. 5. Unused : A memory block that is not currently being used . Nil : A block that has been invalidated. Read-Only : A block for which the node has only read access right. Read-owned. A block for which the node has only read access right but is also the owner of the block. Writable : A block for which the node has write access permission . Obviously, the node is the owner of the block since IVY uses the write-invalidate protocol.
Replacement Strategy
Based on the classification of the block, the following replacement priority is used : Both unused and nil blocks have the highest replacement priority. The read-only blocks have the next replacement priority. Read-owned and writable blocks for which replicas exists on some other nodes have the next replacement priority. Read-owned and writable blocks for which only this node has a copy have the lowest priority.
Replacement Strategy
2. Where to place the replaced block?
Using secondary store Using the memory space of other nodes
Thrashing
4. Thrashing
Occurs when a system spends a large amount of time transferring data blocks than executing on them The larger a block, the more chances of false sharing that causes thrashing. How to avoid thrashing? 1. Provide application controlled locks : Locking data to prevent nodes from accessing that data. A lock could be associated with each data block. 2. Nailing a block to a node for a minimum amount of time. Disallow a block to be taken away from a node until a minimum amount of time t elapses after its allocation to that node. How to choose the value for t ? Statically/dynamically
Thrashing
If fixed statically --- If a process accesses a block only once for writing to it , other processes may be prevented from accessing the block until the time t elapses. On the other hand it may happen that a process accesses the block for several write operations on it, and time t elapses before the process has finished using the block. Hence tuning the value of t dynamically is the preferred approach----Value of t for a block is decided based on the access patterns of the block.
Point to note
If a data store is sequential than always causal,FIFO. If a data store is causal, it will be FiFO