Distributed Shared Memory Distributed Memory[1]

19
Distributed Shar ed Memor y Distributed Shar ed Memor y BE Project Kamlesh Laddhad Dh ruv Mehta Makarand Sonare Sa meer Ma sram Vijay Iyer Ins tructors: Prof V . J. Abhyankar and Prof. C. S. Mog he

Transcript of Distributed Shared Memory Distributed Memory[1]

Page 1: Distributed Shared Memory Distributed Memory[1]

8/3/2019 Distributed Shared Memory Distributed Memory[1]

http://slidepdf.com/reader/full/distributed-shared-memory-distributed-memory1 1/19

Distributed Shared MemoryDistributed Shared Memory

BE Project

Kamlesh Laddhad

Dhruv Mehta

Makarand Sonare

Sameer MasramVijay Iyer

Instructors: Prof V. J. Abhyankar and Prof. C. S. Moghe

Page 2: Distributed Shared Memory Distributed Memory[1]

8/3/2019 Distributed Shared Memory Distributed Memory[1]

http://slidepdf.com/reader/full/distributed-shared-memory-distributed-memory1 2/19

What is DSM?What is DSM?

Abstraction that supports the notion of shared memoryin a physically non shared (distributed) architecture.

Local as well as remote memories can be accessed in a

uniform manner, with the location of the shared region

transparent to the application program.

Our implementation:

◦ under paged virtual memory environment.

Page 3: Distributed Shared Memory Distributed Memory[1]

8/3/2019 Distributed Shared Memory Distributed Memory[1]

http://slidepdf.com/reader/full/distributed-shared-memory-distributed-memory1 3/19

Issues Involved in DSMIssues Involved in DSM

NETWORK COMMUNICATION◦ Since the individual computers have to communicate

with each other over the network, network delayscannot be ignored.

CONSISTENCY DATA GRANULARITY

◦ The requirement to integrate VM management andDSM often forces the granularity of the shared region

to be an integral number of the fundamental unit of memory management, which is a page.

COHERENCE

Page 4: Distributed Shared Memory Distributed Memory[1]

8/3/2019 Distributed Shared Memory Distributed Memory[1]

http://slidepdf.com/reader/full/distributed-shared-memory-distributed-memory1 4/19

Consistency ModelsConsistency Models

• Strict consistency in shared memory systems.

• Sequential consistency in shared memory systems – Ourfocus.

• Other consistency protocols• Casual consistency protocol.

• ‗Weak and release‘ consistency protocol

Page 5: Distributed Shared Memory Distributed Memory[1]

8/3/2019 Distributed Shared Memory Distributed Memory[1]

http://slidepdf.com/reader/full/distributed-shared-memory-distributed-memory1 5/19

Coherence ModelCoherence Model

WRITE-INVALIDATE PROTOCOL◦ A write caused invalidation of all other copies.

◦ Disad: Invalidations sent to all nodes that have copies.

◦ Efficient: Where several updates occur between reads.

Inefficient: Where many nodes frequently access an object. WRITE-UPDATE PROTOCOL

◦ A write causes all copies to be updated.

◦ More difficult to implement as a new value has to be sentinstead of invalidation messages.

◦ Generate considerable network traffic.

Protocol used by us : ‗ write- invalidate‘.

Page 6: Distributed Shared Memory Distributed Memory[1]

8/3/2019 Distributed Shared Memory Distributed Memory[1]

http://slidepdf.com/reader/full/distributed-shared-memory-distributed-memory1 6/19

ArchitectureArchitecture

DSM Subsystem

DSM Server

KEY Server

Page 7: Distributed Shared Memory Distributed Memory[1]

8/3/2019 Distributed Shared Memory Distributed Memory[1]

http://slidepdf.com/reader/full/distributed-shared-memory-distributed-memory1 7/19

DSM SubsystemDSM Subsystem

Routines to handle pagefaults relating to virtualaddresses corresponding toa DSM region.

Code to service systemcalls which allow a userprocess to get, attach anddetach a DSM region.

Code to handle system callsfrom the DSM server.

Page 8: Distributed Shared Memory Distributed Memory[1]

8/3/2019 Distributed Shared Memory Distributed Memory[1]

http://slidepdf.com/reader/full/distributed-shared-memory-distributed-memory1 8/19

DSM Server DSM Server 

In-server◦ Receives messages from

remote DSM servers and takesappropriate action. (E.g.Invalidate its copy of a page)

Out-server◦ Receives requests from the

DSM subsystem andcommunicates with its peerDSM servers at remote nodes.Note that the DSM subsystem

itself does not directlycommunicate over thenetwork with other hosts.

◦ Communication with keyServer.

Page 9: Distributed Shared Memory Distributed Memory[1]

8/3/2019 Distributed Shared Memory Distributed Memory[1]

http://slidepdf.com/reader/full/distributed-shared-memory-distributed-memory1 9/19

Key Sever Key Sever 

Each region must beuniquely identifiable acrossthe entire LAN. When aprocess executes shmget

system call with a key and isthe first process at thathost to do so, the keyserver is consulted.

Key server‘s internal table is

looked-up for the key, if notfound then it stores thespecified key in the table asa new entry.

Page 10: Distributed Shared Memory Distributed Memory[1]

8/3/2019 Distributed Shared Memory Distributed Memory[1]

http://slidepdf.com/reader/full/distributed-shared-memory-distributed-memory1 10/19

Communication IssuesCommunication Issues

Communication between

User level process andDSM subsystem.(Explainednext)

DSM subsystem and DSMserver.◦ Uses message queues. We

modified the system V messagequeues for this purpose

Amongst DSM servers. DSM server and key

server.◦ Used UDP and broadcast

messaging for this purpose forreasons of efficiency

Page 11: Distributed Shared Memory Distributed Memory[1]

8/3/2019 Distributed Shared Memory Distributed Memory[1]

http://slidepdf.com/reader/full/distributed-shared-memory-distributed-memory1 11/19

User Level Process : DSMUser Level Process : DSM

Subsystem CommunicationSubsystem Communication We distinguish between two types of user level

processes

A user process that makes use of DSM facility.

◦ The user process uses a set of system calls such as shmget( ),

shmat( ), shmdt( ) to communicate with the kernel.

The DSM server process, which is a privileged process.

The DSM server process makes use of the following

system calls.

dsmcreat(), dsmgot(), dsmget(), dsmattch(),

dsmattched(), dsmwpage(), dsmrpage() . dsminv().

Page 12: Distributed Shared Memory Distributed Memory[1]

8/3/2019 Distributed Shared Memory Distributed Memory[1]

http://slidepdf.com/reader/full/distributed-shared-memory-distributed-memory1 12/19

DSM ProtocolDSM Protocol

Membership protocol◦ The membership protocol is used to keep trak of 

those hosts that arecurrently interested in accessing a DSM region

Consistency protocol◦ Consistency protocol comes into play when hosts

wish to read or write from or to pages in a DSMregion.

The correctness of the consistency protocol

depends on the accuracy-of informationmaintainedby the membership protocol.

Page 13: Distributed Shared Memory Distributed Memory[1]

8/3/2019 Distributed Shared Memory Distributed Memory[1]

http://slidepdf.com/reader/full/distributed-shared-memory-distributed-memory1 13/19

TERMINOLOGYTERMINOLOGY

Manager :◦ The host where a DSM region is first created is the manager of that

DSM region.

◦ Grants membership for the dsm region it owns.

◦ Any change in the membership set is communicated to all othermembers.

Owner :◦ The host that currently has the write permission for a DSM page

◦ Different pages of a DSM region can have different owners

◦ Ownership of a particular page may change during the lifetime of theregion.

Information maintained by each host for each DSM region◦ Manager of the DSM region.

◦ Key of the DSM region.◦ Current membership set for the DSM region.

◦ No. of local clients (processes on that host which executed shmat( )).

◦ Number of global clients.

Page 14: Distributed Shared Memory Distributed Memory[1]

8/3/2019 Distributed Shared Memory Distributed Memory[1]

http://slidepdf.com/reader/full/distributed-shared-memory-distributed-memory1 14/19

TERMINOLOGYTERMINOLOGY

Some more information…

Owner hint:

◦ The owner hint indicates who the current owner of the page

Copies hint :◦ Copies hint is an estimate of the number of copies of a DSM page.

Version hint :

◦ Version hint indicates the current version of the DSM page. The version

hint is used for maintaining sequence of the pages in case of loss of 

messages or out of order delivery.

Page 15: Distributed Shared Memory Distributed Memory[1]

8/3/2019 Distributed Shared Memory Distributed Memory[1]

http://slidepdf.com/reader/full/distributed-shared-memory-distributed-memory1 15/19

DD

AA

TTAA

SSTT

RR

UUCC

TT

PCB

Permissible Operations

Page directory and page table

Memory management

info for a particular

process

Defines properties of region

Task array

maintainedby OS

Page 16: Distributed Shared Memory Distributed Memory[1]

8/3/2019 Distributed Shared Memory Distributed Memory[1]

http://slidepdf.com/reader/full/distributed-shared-memory-distributed-memory1 16/19

Data structures for DSMData structures for DSM

Describes a

SM region

Array of page table entries

Processes attached to this region

Additions in System V to support DSM

Page 17: Distributed Shared Memory Distributed Memory[1]

8/3/2019 Distributed Shared Memory Distributed Memory[1]

http://slidepdf.com/reader/full/distributed-shared-memory-distributed-memory1 17/19

RefetencesRefetences

Michael Beck et al, ―Linux Kernel Internals‖, Addison-Wesley.

Andrew Tanenbaum, ―Distributed Operating Systems‖. Prentice Hall of India.

Maurice Bach,―Design and Implementation of Unix Operating System‖,Prentice Hall of India.

W. Richards Stevens, ―Unix Network Programming‖,Prentice Hall of India. Pedro Souto and Eugene W. Stark, ―A Distributed Shared Memory Facility

for FreeBSD‖, Proceedings of the USENIX 1997 Technical Conference,Anaheim, California, January 6-10, 1997.

Kai Li and Paul Hudak,

―Memory Coherence in Shared Virtual Memory Systems‖, ACM

Transactions on Computer Systems, 7(4):321 — 359, November 1989. Mukesh Singhal and Niranjn G. Shivaratri, ―Advanced Concepts in

Operating Systems‖

McGraw Hill

Page 18: Distributed Shared Memory Distributed Memory[1]

8/3/2019 Distributed Shared Memory Distributed Memory[1]

http://slidepdf.com/reader/full/distributed-shared-memory-distributed-memory1 18/19

Extra SlidesExtra Slides

Page 19: Distributed Shared Memory Distributed Memory[1]

8/3/2019 Distributed Shared Memory Distributed Memory[1]

http://slidepdf.com/reader/full/distributed-shared-memory-distributed-memory1 19/19

Our Addition to System V for DSMOur Addition to System V for DSM

dsm_nattch: No. of hosts using this DSM region. manager_d: Details of manager such as ip

address of the host and also the index intoshm_segs of the manager.

member: Info about members in membership

set. copy_set: Info about on which some process

has attached this DSM region. dsm_wait: Queue for hosts who has requested

to attach to this DSM region and are waiting. dsm_pages: Info(owner hint, version hint, copies,

page wait) about the pages belonging to thisDSM region.