SlideShare a Scribd company logo
1
Chapter 9
Distributed Shared Memory
2
Distributed Shared Memory
Making the main memory of a cluster of computers look as though
it is a single memory with a single address space.
Then can use shared memory programming techniques.
3
DSM System
Still need messages or mechanisms to get data to processor, but
these are hidden from the programmer:
4
Advantages of DSM
• System scalable
• Hides the message passing - do not explicitly specific sending
messages between processes
• Can us simple extensions to sequential programming
• Can handle complex and large data bases without replication
or sending the data to processes
5
Disadvantages of DSM
• May incur a performance penalty
• Must provide for protection against simultaneous access to
shared data (locks, etc.)
• Little programmer control over actual messages being generated
• Performance of irregular problems in particular may be difficult
6
Methods of Achieving DSM
• Hardware
Special network interfaces and cache coherence circuits
• Software
Modifying the OS kernel
Adding a software layer between the operating system
and the application - most convenient way for teaching
purposes
7
Software DSM Implementation
• Page based - Using the system’s virtual memory
• Shared variable approach- Using routines to access
shared variables
• Object based- Shared data within collection of objects.
Access to shared data through object oriented discipline
(ideally)
8
Software Page Based DSM
Implementation
9
Some Software DSM Systems
• Treadmarks
Page based DSM system
Apparently not now available
• JIAJIA
C based
Obtained at UNC-Charlotte but required significant
modifications for our system (in message-passing
calls)
• Adsmith object based
C++ library routines
We have this installed on our cluster - chosen for teaching
10
Consistency Models
• Strict Consistency - Processors sees most recent update,
i.e. read returns the most recent wrote to location.
• Sequential Consistency - Result of any execution same as
an interleaving of individual programs.
• Relaxed Consistency- Delay making write visible to reduce
messages.
• Weak consistency - programmer must use synchronization
operations to enforce sequential consistency when
necessary.
• Release Consistency - programmer must use specific
synchronization operators, acquire and release.
• Lazy Release Consistency - update only done at time of
acquire.
11
Strict Consistency
Every write immediately visible
Disadvantages: number of messages, latency, maybe unnecessary.
12
Consistency Models used on DSM Systems
Release Consistency
An extension of weak consistency in which the synchronization
operations have been specified:
• acquire operation - used before a shared variable or variables
are to be read.
• release operation - used after the shared variable or variables
have been altered (written) and allows another process to
access to the variable(s)
Typically acquire is done with a lock operation and release by an
unlock operation (although not necessarily).
13
Release Consistency
14
Lazy Release Consistency
Advantages: Fewer messages
15
Adsmith
16
Adsmith
• User-level libraries that create distributed shared memory system
on a cluster.
• Object based DSM - memory seen as a collection of objects that
can be shared among processes on different processors.
• Written in C++
• Built on top of pvm
• Freely available - installed on UNCC cluster
User writes application programs in C or C++ and calls Adsmith
routines for creation of shared data and control of its access.
17
Adsmith Routines
These notes are based upon material in Adsmith User
Interface document.
18
Initialization/Termination
Explicit initialization/termination of Adsmith not necessary.
19
Process
To start a new process or processes:
adsm_spawn(filename, count)
Example
adsm_spawn(“prog1”,10);
starts 10 copies of prog1 (10 processes). Must use Adsmith
routine to start a new process. Also version of adsm_spawn() with
similar parameters to pvm_spawn().
20
Process “join”
adsmith_wait();
will cause the process to wait for all its child processes (processes
it created) to terminate.
Versions available to wait for specific processes to terminate,
using pvm tid to identify processes. Then would need to use the
pvm form of adsmith() that returns the tids of child processes.
21
Access to shared data (objects)
Adsmith uses “release consistency.” Programmer explicitly needs
to control competing read/write access from different processes.
Three types of access in Adsmith, differentiated by the use of the
shared data:
• Ordinary Accesses - For regular assignment statements
accessing shared variables.
• Synchronization Accesses - Competing accesses used for
synchronization purposes.
• Non-Synchronization Accesses - Competing accesses, not
used for synchronization.
22
Ordinary Accesses - Basic read/write actions
Before read, do:
adsm_refresh()
to get most recent value - an “acquire/load.” After write, do:
adsm_flush()
to store result - “store”
Example
int *x; //shared variable
.
.
adsm_refresh(x);
a = *x + b;
23
Synchronization accesses
To control competing accesses:
• Semaphores
• Mutex’s (Mutual exclusion variables)
• Barriers.
available. All require an identifier to be specified as all three
class instances are shared between processes.
24
Semaphore routines
Four routines:
wait()
signal()
set()
get().
class AdsmSemaphore {
public:
AdsmSemaphore( char *identifier, int init = 1 );
void wait();
void signal();
void set( int value);
void get();
};
25
Mutual exclusion variables – Mutex
Two routines
lock
unlock()
class AdsmMutex {
public:
AdsmMutex( char *identifier );
void lock();
void unlock();
};
26
Example
int *sum;
AdsmMutex x(“mutex”);
x.lock();
adsm_refresh(sum);
*sum += partial_sum;
adsm_flush(sum);
x.unlock();
27
Barrier Routines
One barrier routine
barrier()
class AdsmBarrier {
public:
AdsmBarrier( char *identifier );
void barrier( int count);
};
28
Example
AdsmBarrier barrier1(“sample”);
.
.
barrier1.barrier(procno);
29
Non-synchronization Accesses
For competing accesses that are not for synchronization:
adsm_refresh_now( void *ptr );
And
adsm_flush_now( void *ptr );
refresh and flush take place on home location (rather
than locally) and immediately.
30
Features to Improve Performance
Routines that can be used to overlap messages or reduce
number of messages:
• Prefetch
• Bulk Transfer
• Combined routines for critical sections
31
Prefetch
adsm_prefetch( void *ptr )
used before adsm_refresh() to get data as early as possible.
Non-blocking so that can continue with other work prior to
issuing refresh.
32
Bulk Transfer
Combines consecutive messages to reduce number. Can apply
only to “aggregating”:
adsm_malloc( AdsmBulkType *type );
adsm_prefetch( AdsmBulkType *type )
adsm_refresh( AdsmBulkType *type )
adsm_flush( AdsmBulkType *type )
where AdsmBulkType is defined as:
enum AdsmBulkType {
adsmBulkBegin,
AdsmBulkEnd
}
Use parameters AdsmBulkBegin and AdsmBulkEnd in pairs to
“aggregate” actions.
Easy to add afterwards to improve performance.
33
Example
adsm_refresh(AdsmBulkBegin);
adsm_refresh(x);
adsm_refresh(y);
adsm_refresh(z);
adsm_refresh(AdsmBulkEnd);
34
Routines to improve performance of
critical sections
Called “Atomic Accesses” in Adsmith.
adsm_atomic_begin()
adsm_atomic_end()
Replaces two routines and reduces number of messages.
35
Sending an expression to be executed
on home process
Can reduce number of messages. Called “Active Access” in
Adsmith. Achieved with:
adsm_atomic(void *ptr, char *expression);
where the expression is written as [type] expression.
Object pointed by ptr is the only variable allowed in the expression
(and indicated in this expression with the symbol @).
36
Collect Access
Efficient routines for shared objects used as an accumulator:
void adsm_collect_begin(void *ptr, int num);
void adsm_collect_end(void *ptr);
where num is the number of processes involved in the access, and *ptr
points to the shared accumulator
Example
(from page 10 of Adsmith User Interface document):
int partial_sum = ... ; // calculate the partial sum
adsm_collect_begin(sum,nproc);
sum+=partial_sum; //add partial sum
adsm_collect_end(sum); //total; sum is returned
37
Other Features
Pointers
Can be shared but need to use adsmith address translation
routines to convert local address to a globally recognizable
address and back to an local address:
To translates local address to global address (an int)
int adsm_gid(void *ptr);
To translates global address back to local address for use by
requesting process
void *adsm_attach(int gid);
38
Message passing
Can use PVM routines in same program but must use
adsm_spawn() to create processes (not pvm_spawn().
Message tags MAXINT-6 to MAXINT used by Adsmith.
39
Information Retrieval Routines
For getting host ids (zero to number of hosts -1) or process id (zero to
number of processes -1):
int adsm_hostno(int procno = -1);
- Returns host id where process specified by process number
procno resides. (If procno not specified, returns host id of calling
process).
int adsm_procno();
-Returns process id of calling process.
int adsm_procno2tid(int procno);
-Translates process id to corresponding PVM task id.
int adsm_tid2procno(int tid)
translates PVM task id to corresponding process id.
40
DSM Implementation Projects
Using underlying message-passing software
• Easy to do
• Can sit on top of message-passing software such as MPI.
41
Issues in Implementing a DSM
System
• Managing shared data - reader/writer policies
• Timing issues - relaxing read/write orders
42
Reader/Writer Policies
• Single reader/single writer policy - simple to do with
centralized servers
• Multiple reader/single writer policy - again quite simple
to do
• Multiple reader/multiple writer policy - tricky
43
Simple DSM system using a
centralized server
44
Simple DSM system using multiple servers
45
Simple DSM system using multiple
servers and multiple reader policy
46
Shared Data with Overlapping
Regions A New Concept Developed at
UNC-Charlotte
Based upon earlier work on so-called over-lapping
connectivity interconnection networks
A large family of scalable interconnection networks devised –
all have characteristic of overlapping domains that nodes can
Interconnect
Many applications require communication to logically nearby
processors
47
Overlapping Regions
48
Symmetrical Multiprocessor System with
Overlapping Data Regions
49
Static and Dynamic Overlapping
Groups
• Static - defined prior to program execution – add
routines for declaring and specifying these groups
• Dynamic - shared variable migration during program
execution
50
Shared Variable Migration between Data
Regions
51
DSM Projects
• Write a DSM system in C++ using MPI for the underlying
message-passing and process communication.
• Write a DSM system in Java using MPI for the underlying
message-passing and process communication.
• (More advanced) One of the fundamental disadvantages of
software DSM system is the lack of control over the
underlying message passing. Provide parameters in a DSM
routine to be able to control the message-passing. Write
routines that allow communication and computation to be
overlapped.

More Related Content

PPT
slides8 SharedMemory.ppt
aminnezarat
 
PPT
Migration To Multi Core - Parallel Programming Models
Zvi Avraham
 
PPTX
25-MPI-OpenMP.pptx
GopalPatidar13
 
PPTX
CST 402 Distributed Computing Module 1 Notes
sm8i4
 
PDF
1844 1849
Editor IJARCET
 
PDF
1844 1849
Editor IJARCET
 
PPSX
System on chip architectures
Dr. A. B. Shinde
 
PPTX
Ch-7.pptx about architecture and computer
Toyba2
 
slides8 SharedMemory.ppt
aminnezarat
 
Migration To Multi Core - Parallel Programming Models
Zvi Avraham
 
25-MPI-OpenMP.pptx
GopalPatidar13
 
CST 402 Distributed Computing Module 1 Notes
sm8i4
 
1844 1849
Editor IJARCET
 
1844 1849
Editor IJARCET
 
System on chip architectures
Dr. A. B. Shinde
 
Ch-7.pptx about architecture and computer
Toyba2
 

Similar to slides9.ppt (20)

PDF
Lec+3-Introduction-to-Distributed-Systems.pdf
samaghorab
 
PPTX
Ch-7 COAwrdftghkjnxcvgbdxfhbgfjmgdxghn.pptx
FiraolGadissa
 
PPTX
intro, definitions, basic laws+.pptx
ssuser413a98
 
PPTX
Aman 16 os sheduling algorithm methods.pptx
vikramkagitapu
 
PDF
cpu-affinity
Magnetic Poetry
 
PPTX
distributed-systemsfghjjjijoijioj-chap3.pptx
lencho3d
 
PPTX
Chapter 2 Operating System Structures.pptx
kawser108ahmed
 
PPT
OS Unit 3 ProcessSyncronization in operation g system
kundansingh1642004
 
DOCX
Backtrack Manual Part6
Nutan Kumar Panda
 
PDF
Distributed Shared Memory – A Survey and Implementation Using Openshmem
IJERA Editor
 
PDF
Distributed Shared Memory – A Survey and Implementation Using Openshmem
IJERA Editor
 
ODP
Firewalld : A New Interface to Your Netfilter Stack
Mahmoud Shiri Varamini
 
PPTX
5.7 Parallel Processing - Reactive Programming.pdf.pptx
MohamedBilal73
 
PPTX
Open shmem
Ehsan Alirezaei
 
PDF
iTop VPN Latest Version 2025 Crack Free Download
lr74xqnvuf
 
PPTX
VSO ConvertXto HD Free CRACKS Download .
dshut956
 
PDF
Wondershare Filmora Crack Free Download
zqeevcqb3t
 
PDF
Minitool Partition Wizard Crack Free Download
v3r2eptd2q
 
PPTX
Nickelodeon All Star Brawl 2 v1.13 Free Download
michaelsatle759
 
PDF
LDPlayer 9.1.20 Latest Crack Free Download
5ls1bnl9iv
 
Lec+3-Introduction-to-Distributed-Systems.pdf
samaghorab
 
Ch-7 COAwrdftghkjnxcvgbdxfhbgfjmgdxghn.pptx
FiraolGadissa
 
intro, definitions, basic laws+.pptx
ssuser413a98
 
Aman 16 os sheduling algorithm methods.pptx
vikramkagitapu
 
cpu-affinity
Magnetic Poetry
 
distributed-systemsfghjjjijoijioj-chap3.pptx
lencho3d
 
Chapter 2 Operating System Structures.pptx
kawser108ahmed
 
OS Unit 3 ProcessSyncronization in operation g system
kundansingh1642004
 
Backtrack Manual Part6
Nutan Kumar Panda
 
Distributed Shared Memory – A Survey and Implementation Using Openshmem
IJERA Editor
 
Distributed Shared Memory – A Survey and Implementation Using Openshmem
IJERA Editor
 
Firewalld : A New Interface to Your Netfilter Stack
Mahmoud Shiri Varamini
 
5.7 Parallel Processing - Reactive Programming.pdf.pptx
MohamedBilal73
 
Open shmem
Ehsan Alirezaei
 
iTop VPN Latest Version 2025 Crack Free Download
lr74xqnvuf
 
VSO ConvertXto HD Free CRACKS Download .
dshut956
 
Wondershare Filmora Crack Free Download
zqeevcqb3t
 
Minitool Partition Wizard Crack Free Download
v3r2eptd2q
 
Nickelodeon All Star Brawl 2 v1.13 Free Download
michaelsatle759
 
LDPlayer 9.1.20 Latest Crack Free Download
5ls1bnl9iv
 
Ad

More from nazimsattar (20)

PPTX
how to build a simple operating system type
nazimsattar
 
PPTX
operating system Evolution understanding the basics
nazimsattar
 
PPT
working with internet technologies using XML
nazimsattar
 
PPT
working with internet technologies using CSS
nazimsattar
 
PPT
different Data_Analysis concepts in data science
nazimsattar
 
PPT
Data Munging in concepts of data mining in DS
nazimsattar
 
PDF
Class diagram and its importance in software
nazimsattar
 
PDF
GRASP_Designing Objects With Responsibilities.pdf
nazimsattar
 
PPT
Memory management principles in operating systems
nazimsattar
 
PPT
Deadlock principles in operating systems
nazimsattar
 
PDF
overview of natural language processing concepts
nazimsattar
 
PDF
introduction to natural language processing
nazimsattar
 
PPT
HCI_usable_user_interface_productivity in HCI
nazimsattar
 
PPT
HCI_user_interaction_Design_interaction design
nazimsattar
 
PPT
Introduction to the operating and its types
nazimsattar
 
PPT
Operating systems structures and their practical applications
nazimsattar
 
PPT
Block_Chain_Technology and its concepts in reality
nazimsattar
 
PPT
Edge Computing and its related technologies
nazimsattar
 
PPTX
The Real time applications of Virtual Reality
nazimsattar
 
PPTX
Marketing of AI technology in real life examples
nazimsattar
 
how to build a simple operating system type
nazimsattar
 
operating system Evolution understanding the basics
nazimsattar
 
working with internet technologies using XML
nazimsattar
 
working with internet technologies using CSS
nazimsattar
 
different Data_Analysis concepts in data science
nazimsattar
 
Data Munging in concepts of data mining in DS
nazimsattar
 
Class diagram and its importance in software
nazimsattar
 
GRASP_Designing Objects With Responsibilities.pdf
nazimsattar
 
Memory management principles in operating systems
nazimsattar
 
Deadlock principles in operating systems
nazimsattar
 
overview of natural language processing concepts
nazimsattar
 
introduction to natural language processing
nazimsattar
 
HCI_usable_user_interface_productivity in HCI
nazimsattar
 
HCI_user_interaction_Design_interaction design
nazimsattar
 
Introduction to the operating and its types
nazimsattar
 
Operating systems structures and their practical applications
nazimsattar
 
Block_Chain_Technology and its concepts in reality
nazimsattar
 
Edge Computing and its related technologies
nazimsattar
 
The Real time applications of Virtual Reality
nazimsattar
 
Marketing of AI technology in real life examples
nazimsattar
 
Ad

Recently uploaded (20)

PPTX
An introduction to Dialogue writing.pptx
drsiddhantnagine
 
PPTX
NOI Hackathon - Summer Edition - GreenThumber.pptx
MartinaBurlando1
 
PPTX
How to Manage Leads in Odoo 18 CRM - Odoo Slides
Celine George
 
PPTX
vedic maths in python:unleasing ancient wisdom with modern code
mistrymuskan14
 
PDF
Electricity-Magnetic-and-Heating-Effects 4th Chapter/8th-science-curiosity.pd...
Sandeep Swamy
 
PPTX
ACUTE NASOPHARYNGITIS. pptx
AneetaSharma15
 
PDF
Arihant Class 10 All in One Maths full pdf
sajal kumar
 
PDF
Types of Literary Text: Poetry and Prose
kaelandreabibit
 
PDF
2.Reshaping-Indias-Political-Map.ppt/pdf/8th class social science Exploring S...
Sandeep Swamy
 
PPTX
Introduction and Scope of Bichemistry.pptx
shantiyogi
 
PPTX
Understanding operators in c language.pptx
auteharshil95
 
PPTX
Strengthening open access through collaboration: building connections with OP...
Jisc
 
PDF
UTS Health Student Promotional Representative_Position Description.pdf
Faculty of Health, University of Technology Sydney
 
PPTX
Nursing Management of Patients with Disorders of Ear, Nose, and Throat (ENT) ...
RAKESH SAJJAN
 
PPTX
Skill Development Program For Physiotherapy Students by SRY.pptx
Prof.Dr.Y.SHANTHOSHRAJA MPT Orthopedic., MSc Microbiology
 
PPTX
TEF & EA Bsc Nursing 5th sem.....BBBpptx
AneetaSharma15
 
PDF
Landforms and landscapes data surprise preview
jpinnuck
 
PPT
Python Programming Unit II Control Statements.ppt
CUO VEERANAN VEERANAN
 
PPTX
Dakar Framework Education For All- 2000(Act)
santoshmohalik1
 
DOCX
Action Plan_ARAL PROGRAM_ STAND ALONE SHS.docx
Levenmartlacuna1
 
An introduction to Dialogue writing.pptx
drsiddhantnagine
 
NOI Hackathon - Summer Edition - GreenThumber.pptx
MartinaBurlando1
 
How to Manage Leads in Odoo 18 CRM - Odoo Slides
Celine George
 
vedic maths in python:unleasing ancient wisdom with modern code
mistrymuskan14
 
Electricity-Magnetic-and-Heating-Effects 4th Chapter/8th-science-curiosity.pd...
Sandeep Swamy
 
ACUTE NASOPHARYNGITIS. pptx
AneetaSharma15
 
Arihant Class 10 All in One Maths full pdf
sajal kumar
 
Types of Literary Text: Poetry and Prose
kaelandreabibit
 
2.Reshaping-Indias-Political-Map.ppt/pdf/8th class social science Exploring S...
Sandeep Swamy
 
Introduction and Scope of Bichemistry.pptx
shantiyogi
 
Understanding operators in c language.pptx
auteharshil95
 
Strengthening open access through collaboration: building connections with OP...
Jisc
 
UTS Health Student Promotional Representative_Position Description.pdf
Faculty of Health, University of Technology Sydney
 
Nursing Management of Patients with Disorders of Ear, Nose, and Throat (ENT) ...
RAKESH SAJJAN
 
Skill Development Program For Physiotherapy Students by SRY.pptx
Prof.Dr.Y.SHANTHOSHRAJA MPT Orthopedic., MSc Microbiology
 
TEF & EA Bsc Nursing 5th sem.....BBBpptx
AneetaSharma15
 
Landforms and landscapes data surprise preview
jpinnuck
 
Python Programming Unit II Control Statements.ppt
CUO VEERANAN VEERANAN
 
Dakar Framework Education For All- 2000(Act)
santoshmohalik1
 
Action Plan_ARAL PROGRAM_ STAND ALONE SHS.docx
Levenmartlacuna1
 

slides9.ppt

  • 2. 2 Distributed Shared Memory Making the main memory of a cluster of computers look as though it is a single memory with a single address space. Then can use shared memory programming techniques.
  • 3. 3 DSM System Still need messages or mechanisms to get data to processor, but these are hidden from the programmer:
  • 4. 4 Advantages of DSM • System scalable • Hides the message passing - do not explicitly specific sending messages between processes • Can us simple extensions to sequential programming • Can handle complex and large data bases without replication or sending the data to processes
  • 5. 5 Disadvantages of DSM • May incur a performance penalty • Must provide for protection against simultaneous access to shared data (locks, etc.) • Little programmer control over actual messages being generated • Performance of irregular problems in particular may be difficult
  • 6. 6 Methods of Achieving DSM • Hardware Special network interfaces and cache coherence circuits • Software Modifying the OS kernel Adding a software layer between the operating system and the application - most convenient way for teaching purposes
  • 7. 7 Software DSM Implementation • Page based - Using the system’s virtual memory • Shared variable approach- Using routines to access shared variables • Object based- Shared data within collection of objects. Access to shared data through object oriented discipline (ideally)
  • 8. 8 Software Page Based DSM Implementation
  • 9. 9 Some Software DSM Systems • Treadmarks Page based DSM system Apparently not now available • JIAJIA C based Obtained at UNC-Charlotte but required significant modifications for our system (in message-passing calls) • Adsmith object based C++ library routines We have this installed on our cluster - chosen for teaching
  • 10. 10 Consistency Models • Strict Consistency - Processors sees most recent update, i.e. read returns the most recent wrote to location. • Sequential Consistency - Result of any execution same as an interleaving of individual programs. • Relaxed Consistency- Delay making write visible to reduce messages. • Weak consistency - programmer must use synchronization operations to enforce sequential consistency when necessary. • Release Consistency - programmer must use specific synchronization operators, acquire and release. • Lazy Release Consistency - update only done at time of acquire.
  • 11. 11 Strict Consistency Every write immediately visible Disadvantages: number of messages, latency, maybe unnecessary.
  • 12. 12 Consistency Models used on DSM Systems Release Consistency An extension of weak consistency in which the synchronization operations have been specified: • acquire operation - used before a shared variable or variables are to be read. • release operation - used after the shared variable or variables have been altered (written) and allows another process to access to the variable(s) Typically acquire is done with a lock operation and release by an unlock operation (although not necessarily).
  • 16. 16 Adsmith • User-level libraries that create distributed shared memory system on a cluster. • Object based DSM - memory seen as a collection of objects that can be shared among processes on different processors. • Written in C++ • Built on top of pvm • Freely available - installed on UNCC cluster User writes application programs in C or C++ and calls Adsmith routines for creation of shared data and control of its access.
  • 17. 17 Adsmith Routines These notes are based upon material in Adsmith User Interface document.
  • 19. 19 Process To start a new process or processes: adsm_spawn(filename, count) Example adsm_spawn(“prog1”,10); starts 10 copies of prog1 (10 processes). Must use Adsmith routine to start a new process. Also version of adsm_spawn() with similar parameters to pvm_spawn().
  • 20. 20 Process “join” adsmith_wait(); will cause the process to wait for all its child processes (processes it created) to terminate. Versions available to wait for specific processes to terminate, using pvm tid to identify processes. Then would need to use the pvm form of adsmith() that returns the tids of child processes.
  • 21. 21 Access to shared data (objects) Adsmith uses “release consistency.” Programmer explicitly needs to control competing read/write access from different processes. Three types of access in Adsmith, differentiated by the use of the shared data: • Ordinary Accesses - For regular assignment statements accessing shared variables. • Synchronization Accesses - Competing accesses used for synchronization purposes. • Non-Synchronization Accesses - Competing accesses, not used for synchronization.
  • 22. 22 Ordinary Accesses - Basic read/write actions Before read, do: adsm_refresh() to get most recent value - an “acquire/load.” After write, do: adsm_flush() to store result - “store” Example int *x; //shared variable . . adsm_refresh(x); a = *x + b;
  • 23. 23 Synchronization accesses To control competing accesses: • Semaphores • Mutex’s (Mutual exclusion variables) • Barriers. available. All require an identifier to be specified as all three class instances are shared between processes.
  • 24. 24 Semaphore routines Four routines: wait() signal() set() get(). class AdsmSemaphore { public: AdsmSemaphore( char *identifier, int init = 1 ); void wait(); void signal(); void set( int value); void get(); };
  • 25. 25 Mutual exclusion variables – Mutex Two routines lock unlock() class AdsmMutex { public: AdsmMutex( char *identifier ); void lock(); void unlock(); };
  • 27. 27 Barrier Routines One barrier routine barrier() class AdsmBarrier { public: AdsmBarrier( char *identifier ); void barrier( int count); };
  • 29. 29 Non-synchronization Accesses For competing accesses that are not for synchronization: adsm_refresh_now( void *ptr ); And adsm_flush_now( void *ptr ); refresh and flush take place on home location (rather than locally) and immediately.
  • 30. 30 Features to Improve Performance Routines that can be used to overlap messages or reduce number of messages: • Prefetch • Bulk Transfer • Combined routines for critical sections
  • 31. 31 Prefetch adsm_prefetch( void *ptr ) used before adsm_refresh() to get data as early as possible. Non-blocking so that can continue with other work prior to issuing refresh.
  • 32. 32 Bulk Transfer Combines consecutive messages to reduce number. Can apply only to “aggregating”: adsm_malloc( AdsmBulkType *type ); adsm_prefetch( AdsmBulkType *type ) adsm_refresh( AdsmBulkType *type ) adsm_flush( AdsmBulkType *type ) where AdsmBulkType is defined as: enum AdsmBulkType { adsmBulkBegin, AdsmBulkEnd } Use parameters AdsmBulkBegin and AdsmBulkEnd in pairs to “aggregate” actions. Easy to add afterwards to improve performance.
  • 34. 34 Routines to improve performance of critical sections Called “Atomic Accesses” in Adsmith. adsm_atomic_begin() adsm_atomic_end() Replaces two routines and reduces number of messages.
  • 35. 35 Sending an expression to be executed on home process Can reduce number of messages. Called “Active Access” in Adsmith. Achieved with: adsm_atomic(void *ptr, char *expression); where the expression is written as [type] expression. Object pointed by ptr is the only variable allowed in the expression (and indicated in this expression with the symbol @).
  • 36. 36 Collect Access Efficient routines for shared objects used as an accumulator: void adsm_collect_begin(void *ptr, int num); void adsm_collect_end(void *ptr); where num is the number of processes involved in the access, and *ptr points to the shared accumulator Example (from page 10 of Adsmith User Interface document): int partial_sum = ... ; // calculate the partial sum adsm_collect_begin(sum,nproc); sum+=partial_sum; //add partial sum adsm_collect_end(sum); //total; sum is returned
  • 37. 37 Other Features Pointers Can be shared but need to use adsmith address translation routines to convert local address to a globally recognizable address and back to an local address: To translates local address to global address (an int) int adsm_gid(void *ptr); To translates global address back to local address for use by requesting process void *adsm_attach(int gid);
  • 38. 38 Message passing Can use PVM routines in same program but must use adsm_spawn() to create processes (not pvm_spawn(). Message tags MAXINT-6 to MAXINT used by Adsmith.
  • 39. 39 Information Retrieval Routines For getting host ids (zero to number of hosts -1) or process id (zero to number of processes -1): int adsm_hostno(int procno = -1); - Returns host id where process specified by process number procno resides. (If procno not specified, returns host id of calling process). int adsm_procno(); -Returns process id of calling process. int adsm_procno2tid(int procno); -Translates process id to corresponding PVM task id. int adsm_tid2procno(int tid) translates PVM task id to corresponding process id.
  • 40. 40 DSM Implementation Projects Using underlying message-passing software • Easy to do • Can sit on top of message-passing software such as MPI.
  • 41. 41 Issues in Implementing a DSM System • Managing shared data - reader/writer policies • Timing issues - relaxing read/write orders
  • 42. 42 Reader/Writer Policies • Single reader/single writer policy - simple to do with centralized servers • Multiple reader/single writer policy - again quite simple to do • Multiple reader/multiple writer policy - tricky
  • 43. 43 Simple DSM system using a centralized server
  • 44. 44 Simple DSM system using multiple servers
  • 45. 45 Simple DSM system using multiple servers and multiple reader policy
  • 46. 46 Shared Data with Overlapping Regions A New Concept Developed at UNC-Charlotte Based upon earlier work on so-called over-lapping connectivity interconnection networks A large family of scalable interconnection networks devised – all have characteristic of overlapping domains that nodes can Interconnect Many applications require communication to logically nearby processors
  • 48. 48 Symmetrical Multiprocessor System with Overlapping Data Regions
  • 49. 49 Static and Dynamic Overlapping Groups • Static - defined prior to program execution – add routines for declaring and specifying these groups • Dynamic - shared variable migration during program execution
  • 50. 50 Shared Variable Migration between Data Regions
  • 51. 51 DSM Projects • Write a DSM system in C++ using MPI for the underlying message-passing and process communication. • Write a DSM system in Java using MPI for the underlying message-passing and process communication. • (More advanced) One of the fundamental disadvantages of software DSM system is the lack of control over the underlying message passing. Provide parameters in a DSM routine to be able to control the message-passing. Write routines that allow communication and computation to be overlapped.