View
230
Download
2
Embed Size (px)
Citation preview
CS 551-Memory Management 1
Learning Objectives
• Centralized Memory Management -review
• Simple Memory Model
• Shared Memory Model
• Distributed Shared Memory
• Memory Migration
CS 551-Memory Management 2
Review of Centralized Memory Management
• Virtual memory– Extending the size of available memory beyond
its physical size of RAM– Paging versus segmentation– Internal versus external fragmentation– Segment placement algorithms– Page replacement algorithms
• page faults and thrashing
CS 551-Memory Management 3
Simple Memory Model
• In Simple Memory Model access times for all processors are equal.
• Requires strict control of degree of multi-programming.
• Often does not use virtual memory or caching because of overhead.
CS 551-Memory Management 4
Shared Memory Model
• Used for inter-process communication.
• Multiple processes share memory locations.
• May includes physical RAMs, local cache, and secondary storage.
• Memory access takes place via common bus thus a possibility of a bus contention.
CS 551-Memory Management 5
Bus Contention
• Bus contention occurs when the demand for bus access is excessive.
• Bus contention may cause a bottleneck in a shared memory system.
• Shared memory model usually does implement more than 32 processors on a single bus.
CS 551-Memory Management 6
Shared Memory Support
• UNIX System V supports shared memory via the following function calls:– shmget– shmat– shmdt
CS 551-Memory Management 7
Shared Memory Performance• Performance is an important issue in a
Shared Memory System.
• Important issues:– scalability - ability to accommodate growth
without sacrificing performance– real time needs
• overlap of communication and computation
• prefetching of data (? Answer problem 4.5., p.102)
– non-local memory references are expensive (up to 10:1 ratio)
CS 551-Memory Management 8
Cache Consistency
• Consistency is a term used to describe the function ensuring that all data copies are the same and correct.
• Consistency protocols:– critical section approach– prevention of shared memory caching– snoopy cache (see fig 4.3. p. 89)
CS 551-Memory Management 9
Distributed Shared Memory• Concept introduced in 1989.
• DSM presents a logical shared memory for multi-computer systems.
• DSM maintains communication and data consistency for applications.
• Usually portions of local memory are mapped onto DSM.
• DSM maintains a directory service for all data residing in the system.
CS 551-Memory Management 10
Distributed Shared Memory Management
• DSM Management involves two main decisions:
– How to distribute shared data ?
– How many readers and writers should be allowed for a shared data segment?
CS 551-Memory Management 11
Distributing Shared Data
• Replication– maintaining multiple copies of shared data at
various locations
• Migration– moving the copy of shared data to various
locations (only one copy of shared data is allowed)
CS 551-Memory Management 12
Readers/Writers Protocols for Shared Data
• Single Reader/Single Writer
• Multiple Reader/Single Writer
• Multiple Reader/Multiple Writer
CS 551-Memory Management 13
Single Reader/Single Writer
• Allows one reader or one writer for a shared data set (inhibits concurrency).
• Replication is NOT allowed.
• Both centralized and distributed algorithms are used to control DSM.
CS 551-Memory Management 14
Multiple Reader/Single Writer
• Allows multiple readers but only one writer to a shared data set.
• Consequently it allows for multiple copies of a shared data set.
• If the writer changes the shared data, the readers’ copies are no longer accurate. This requires an invalidation protocol.
CS 551-Memory Management 15
Invalidation protocols for multiple reader/single writer
• Copy Set - is a list of system participants that have a copy of each piece of data.
• Invalidation protocols:– centralized– partially distributed– distributed
• ? Study figures 4.4, 4.5 and 4.6 p.93 and explain them.
CS 551-Memory Management 16
Static and Dynamic Multiple Reader/Single Writer Protocol
• Study Box 4.3 and Box 4.4 page 94.
• ? Compare and contrast the algorithms and state the most important commonalities and differences?
• Homework for 3/1/00
CS 551-Memory Management 17
Centralized Multiple Reader/Single Writer Protocol
• ? Answer question 4.6. p.103?
• ? Write an algorithm for centralized MR/SW problem based on Fig.4.4. and trace your algorithm for request sequence from problem 4.7. p.103?
CS 551-Memory Management 18
Multiple Reader/Multiple Writer
• Allows for multiple copies of the same data and for concurrent writes to multiple copies.
• Not only the data needs to be validated but also it needs coordination for multiple updates.
• Automated solutions are possible for some applications only, and they require a sequencer, i.e. an algorithm for ordering all read and write requests.
CS 551-Memory Management 19
DSM Performance• Issues to be considered:
– Thrashing• How to avoid thrashing, i.e. the situation where data
constantly travels between various locations?
– Selection of a block size• What is the best size for sharable data block?• (page size, packet size, segment size?)
– Location of data• Which is the best original site for shared data location?
– Implementation location for DSM• Where should be DSM implemented? (hardware or software
or both)
CS 551-Memory Management 20
Memory Migration
• Memory Migration requires two fundamental decisions:– When in the migration process will we migrate
memory?– How much memory needs to be migrated?
CS 551-Memory Management 21
Memory Migration Protocols
• Stop-and-copy.
• Concurrent-copy.
• Copy-on-reference– two approaches: data stays at origin, data is
copied to file server.
• ? Study fig. 4.8, 4.9 and 4.10 p.99 and answer problem 4.8 p. 103.