Top Banner
CS 551-Memory Management 1 Learning Objectives Centralized Memory Management - review Simple Memory Model Shared Memory Model Distributed Shared Memory Memory Migration
21

CS 551-Memory Management1 Learning Objectives Centralized Memory Management -review Simple Memory Model Shared Memory Model Distributed Shared Memory Memory.

Dec 21, 2015

Download

Documents

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: CS 551-Memory Management1 Learning Objectives Centralized Memory Management -review Simple Memory Model Shared Memory Model Distributed Shared Memory Memory.

CS 551-Memory Management 1

Learning Objectives

• Centralized Memory Management -review

• Simple Memory Model

• Shared Memory Model

• Distributed Shared Memory

• Memory Migration

Page 2: CS 551-Memory Management1 Learning Objectives Centralized Memory Management -review Simple Memory Model Shared Memory Model Distributed Shared Memory Memory.

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

Page 3: CS 551-Memory Management1 Learning Objectives Centralized Memory Management -review Simple Memory Model Shared Memory Model Distributed Shared Memory Memory.

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.

Page 4: CS 551-Memory Management1 Learning Objectives Centralized Memory Management -review Simple Memory Model Shared Memory Model Distributed Shared Memory Memory.

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.

Page 5: CS 551-Memory Management1 Learning Objectives Centralized Memory Management -review Simple Memory Model Shared Memory Model Distributed Shared Memory Memory.

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.

Page 6: CS 551-Memory Management1 Learning Objectives Centralized Memory Management -review Simple Memory Model Shared Memory Model Distributed Shared Memory Memory.

CS 551-Memory Management 6

Shared Memory Support

• UNIX System V supports shared memory via the following function calls:– shmget– shmat– shmdt

Page 7: CS 551-Memory Management1 Learning Objectives Centralized Memory Management -review Simple Memory Model Shared Memory Model Distributed Shared Memory Memory.

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)

Page 8: CS 551-Memory Management1 Learning Objectives Centralized Memory Management -review Simple Memory Model Shared Memory Model Distributed Shared Memory Memory.

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)

Page 9: CS 551-Memory Management1 Learning Objectives Centralized Memory Management -review Simple Memory Model Shared Memory Model Distributed Shared Memory Memory.

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.

Page 10: CS 551-Memory Management1 Learning Objectives Centralized Memory Management -review Simple Memory Model Shared Memory Model Distributed Shared Memory Memory.

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?

Page 11: CS 551-Memory Management1 Learning Objectives Centralized Memory Management -review Simple Memory Model Shared Memory Model Distributed Shared Memory Memory.

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)

Page 12: CS 551-Memory Management1 Learning Objectives Centralized Memory Management -review Simple Memory Model Shared Memory Model Distributed Shared Memory Memory.

CS 551-Memory Management 12

Readers/Writers Protocols for Shared Data

• Single Reader/Single Writer

• Multiple Reader/Single Writer

• Multiple Reader/Multiple Writer

Page 13: CS 551-Memory Management1 Learning Objectives Centralized Memory Management -review Simple Memory Model Shared Memory Model Distributed Shared Memory Memory.

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.

Page 14: CS 551-Memory Management1 Learning Objectives Centralized Memory Management -review Simple Memory Model Shared Memory Model Distributed Shared Memory Memory.

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.

Page 15: CS 551-Memory Management1 Learning Objectives Centralized Memory Management -review Simple Memory Model Shared Memory Model Distributed Shared Memory Memory.

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.

Page 16: CS 551-Memory Management1 Learning Objectives Centralized Memory Management -review Simple Memory Model Shared Memory Model Distributed Shared Memory Memory.

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

Page 17: CS 551-Memory Management1 Learning Objectives Centralized Memory Management -review Simple Memory Model Shared Memory Model Distributed Shared Memory Memory.

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?

Page 18: CS 551-Memory Management1 Learning Objectives Centralized Memory Management -review Simple Memory Model Shared Memory Model Distributed Shared Memory Memory.

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.

Page 19: CS 551-Memory Management1 Learning Objectives Centralized Memory Management -review Simple Memory Model Shared Memory Model Distributed Shared Memory Memory.

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)

Page 20: CS 551-Memory Management1 Learning Objectives Centralized Memory Management -review Simple Memory Model Shared Memory Model Distributed Shared Memory Memory.

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?

Page 21: CS 551-Memory Management1 Learning Objectives Centralized Memory Management -review Simple Memory Model Shared Memory Model Distributed Shared Memory Memory.

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.