SlideShare a Scribd company logo
1 of 25
ADVANCED SYSTEM ARCHITECTURE
Parallel Programming In The Parallel Virtual
Machine
--Communication Among Tasks
Presented By
J.Roslin vimala
Msc(cs) II year
COMMUNICATION AMONG TASKS:
 Communication among PVM tasks is performed
using the message passing approach,which is
achieved using a library of routines and a daemon.
 During program execution, the user program
communicates with the PVM daemon through the
library routines.
 The daemon, which runs on each machine in the
PVM environment, determines the destination of
each machine.
 If the message is for a task on the local
machine,
Message send
daemon routes
message
 If the message for a task on a remote host,
Message Send
remote daemon routes
Message
Sender Local Machine Task
Daemon
Daemon
Receiving Task
OPERATIONS:
 Send
 Receive
These two operations are heart of this
communication scheme.
Generally Asynchronous.
A message can be sent to one or more
destinations by calling one of the PVM send
functions.
A message can be received by calling either
a blocking or nonblocking receive function.
User
Application Library
User
Application Library
Daemon Daemon
1 4 5 8
2 3 6 7
Host-1 Host-2
Communication in PVM
Sender Task Receiver task
DESCRIPTION OF ABOVE DIAGRAM
 The arrow from the user applications to the daemons
represent communication calls.
 The arrows from the daemons to the user applications
represent the return from the API.
 Point-1: A sending process issues a send command.
 Point-2: The message is transferred to the daemon.
 Point-3: daemon will transmit the message on the
physical link some time after returning control to the
user application.
Continued…
 Point-4: The control is return to the user application.
 Point-5: At some other time, either before or after send
command, the receiving task issues a receive command.
 Point-6: In the case of a blocking receive, the receiving
task blocks on the daemon waiting for a message.
 Point-7,8:
i) After the message arrives, control is returned to the
user application.
ii) In the case of nonblocking receive , control is
returned to the user application immediately (points7&8)
Even if the message has not yet arrived.
 A sender task can send the message to one or more receivers
in three steps as follows:
*A send buffer must be initialized.(Message Buffer)
*The message is packed into this buffer.(Data Packing)
*The completed message is sent to its destination(s ).
(Sending a Message)
 Receiving a message is done in two steps as follows:
*The message is received.(Receiving a Message)
*The message items are unpacked from the receive
buffer.(Data Unpacking)
1)MESSAGE BUFFERS:
Before packing a message for transmission, a send buffer
must be created and prepared for data to be assembled
into it.
PVM provide two functions for buffer creation:
# pvm_initsend().
# pvm_mkbuf().
These two functions agree on the i/p & o/p parameters.
They take as input an integer value specify the next
message’s encoding scheme, and they return an integer
value specifying the message buffer identifier.
 The two functions are listed below,
 Three encoding types:
bufid=pvm_initsend(encoding_option)
bufid=pvm_mkbuf(encoding_option)
• XDR
• Default option0
• No encoding
• Skip the encoding type1
• Leave data in place
• Make send operation copy items directly from the
user’s memory
2
If user is
using only
one buffer
pvm_initsend()
Only a required
function
It clears send buffer &
prepares it for packing
a new message
Pvm_mkbuf()
It is useful when
multiple message
buffers are required
It creates a new empty
send buffer every time
it is called
2)Data Packing:
PVM provides a variety of packing functions pvm_pk*()
to pack an array of a given data type into the active send
buffer.
Three arguments as inputs:
1st argument is a pointer to where the first item is,
2nd argument specifies the no of packed in an array.
3rd argument is the stride to use when packing.
There are several packing functions for all kinds of
data types such as,
Byte , Double , String , And so on.
 All the functions have the same no of arguments
except the string packing function pvm_pkstr(),
which takes only one argument.
 Packing functions for the different data types
include:
# pvm_pkbyte(), pvm_pkcplx(),
pvm_pkdcplx(), pvm_pkdouble(), pvm_pkfloat(),
pvm_pkint(), pvm_pklong(), pvm_pkshort(),
pvm_pkuint(), pvm_pkushort(), pvm_pkulong().
3)Sending a Message:
*Sending messages in PVM is done in an
asynchronous fashion.
*The sending task will resume its execution once the
message is sent.
*It will not wait for the receiving task to execute the
matching receive operation as in synchronous
communication.
Sending to one Receiver:
The function pvm_send() performs a
point-to-point send operation.
Two Arguments:
TID of the destination task.
An integer message identifier(tag).
Ex,
The function call info=pvm_send(tid, tag)
Sending to multiple receiver:
To send the message to multiple destinations, the
function pvm_mcast() should be used.
pvm_mcast()=>Multiple receivers.(multicast)
Ex,
info= pvm_mcast(tid, n, tag) (n=tasks)
Sending to a group:
A message can be broadcast to all members of a group
using the function pvm_bcast().
Ex,
info=pvm_bcast(group_name, tag) (bcast=>broadcast)
Packing and sending in one step:
PVM also provides another function to send
messages without the need to prepare and pack the
buffer manually.
The operation pvm_psend() does the packing
automatically for then programmer.
Ex,
info=pvm_psend(tid, tag, my_array, n, int)
Packs an array of n integers called my_array into
a message labeled tag, and sends it to the task
whose TID is tid.
4)Receiving a message:
 Three types of message receiving functions are,
Blocking Nonblocking Timeout
The receiving task must
wait until the expected
message arrives in the
receive buffer.
A nonblocking receive
immediately returns with
either the expected data or a
flag that the data have not
arrived.
Timeout receive allows the
programmer to specify a
period of time for which the
receive function should wait
before it returns.
BLOCKING RECEIVE:
bufid =pvm_recv(tid, tag)
 This function will wait until a message with label
tag is received from a task with
TID = tid.
 A value of -1 can be used as a wild card to match
anything in either one of the arguments:
tid or tag.
A successful receive will create a receive buffer
and return the buffer identifier to be used in unpacking
the message.
Nonblocking receive
bufid = pvm_nrecv(tid, tag)
 If the message has arrived successfully when this
function is called, it will return a buffer identifier similar
to the case of blocking receive.
 However, if the expected message has not arrived, the
function will return immediately with bufid = 0.
Timeout Receive:
bufid = pvm_trecv(tid, tag, timeout)
 This function blocks the execution of its caller task until a message with a
label tag has arrived from tid within a specified waiting period of time.
 If there is no matching message arriving within the specified waiting time,
this function will return with
bufid = 0, which indicates that no message was received.
Receive and Unpack in One Step:
 Similar to the pvm_psend() function, PVM
provides the function pvm_precv(), which combines the
functions of blocking receive and unpacking in one
routine.
It does not return a buffer
Identifier; instead it returns the actual values.
Ex,
info = pvm_precv(tid, tag, my_array, len, datatype,
&src, &atag, &alen)
5)Data Unpacking:
• When messages are received, they need to be
unpacked in the same way they were
packed in the sending task.
• Unpacking functions must match their
Corresponding packing functions in type, number of
items, and stride.
• PVM provides many unpacking functions
pvm_upk(), each of which corresponds to a
particular packing function.
• PVM also provides the two functions
pvm_upkstr() and pvm_unpackf() to unpack the
messages packed bypvm_pkstr() and pvm_packf(),
respectively.
Other unpacking functions for the different data
types include:
pvm_upkbyte(), pvm_upkcplx(), pvm_upkdcplx(),
pvm_upkdouble(),
pvm_upkfloat(), pvm_upkint(), pvm_upklong(),
pvm_upkshort(),
pvm_upkuint(), pvm_upkushort(), pvm_upkulong().
Thank
you…

More Related Content

What's hot

Memory management ppt coa
Memory management ppt coaMemory management ppt coa
Memory management ppt coaBharti Khemani
 
Operating system memory management
Operating system memory managementOperating system memory management
Operating system memory managementrprajat007
 
message passing vs shared memory
message passing vs shared memorymessage passing vs shared memory
message passing vs shared memoryHamza Zahid
 
Cloud computing using Eucalyptus
Cloud computing using EucalyptusCloud computing using Eucalyptus
Cloud computing using EucalyptusAbhishek Dey
 
Distributed Computing system
Distributed Computing system Distributed Computing system
Distributed Computing system Sarvesh Meena
 
Dichotomy of parallel computing platforms
Dichotomy of parallel computing platformsDichotomy of parallel computing platforms
Dichotomy of parallel computing platformsSyed Zaid Irshad
 
Shared-Memory Multiprocessors
Shared-Memory MultiprocessorsShared-Memory Multiprocessors
Shared-Memory MultiprocessorsSalvatore La Bua
 
Distributed web based systems
Distributed web based systemsDistributed web based systems
Distributed web based systemsReza Gh
 
File models and file accessing models
File models and file accessing modelsFile models and file accessing models
File models and file accessing modelsishmecse13
 
Computer architecture multi processor
Computer architecture multi processorComputer architecture multi processor
Computer architecture multi processorMazin Alwaaly
 
Distributed system Tanenbaum chapter 1,2,3,4 notes
Distributed system Tanenbaum chapter 1,2,3,4 notes Distributed system Tanenbaum chapter 1,2,3,4 notes
Distributed system Tanenbaum chapter 1,2,3,4 notes SAhammedShakil
 
Hadoop & MapReduce
Hadoop & MapReduceHadoop & MapReduce
Hadoop & MapReduceNewvewm
 
Distributed process and scheduling
Distributed process and scheduling Distributed process and scheduling
Distributed process and scheduling SHATHAN
 
Distributed dbms architectures
Distributed dbms architecturesDistributed dbms architectures
Distributed dbms architecturesPooja Dixit
 
Lecture 6
Lecture  6Lecture  6
Lecture 6Mr SMAK
 

What's hot (20)

Naming in Distributed System
Naming in Distributed SystemNaming in Distributed System
Naming in Distributed System
 
Memory management ppt coa
Memory management ppt coaMemory management ppt coa
Memory management ppt coa
 
Operating system memory management
Operating system memory managementOperating system memory management
Operating system memory management
 
message passing vs shared memory
message passing vs shared memorymessage passing vs shared memory
message passing vs shared memory
 
Slide05 Message Passing Architecture
Slide05 Message Passing ArchitectureSlide05 Message Passing Architecture
Slide05 Message Passing Architecture
 
Distributed Operating System_1
Distributed Operating System_1Distributed Operating System_1
Distributed Operating System_1
 
Cloud computing using Eucalyptus
Cloud computing using EucalyptusCloud computing using Eucalyptus
Cloud computing using Eucalyptus
 
Distributed Computing system
Distributed Computing system Distributed Computing system
Distributed Computing system
 
Dichotomy of parallel computing platforms
Dichotomy of parallel computing platformsDichotomy of parallel computing platforms
Dichotomy of parallel computing platforms
 
Shared-Memory Multiprocessors
Shared-Memory MultiprocessorsShared-Memory Multiprocessors
Shared-Memory Multiprocessors
 
Distributed web based systems
Distributed web based systemsDistributed web based systems
Distributed web based systems
 
Shared memory
Shared memoryShared memory
Shared memory
 
File models and file accessing models
File models and file accessing modelsFile models and file accessing models
File models and file accessing models
 
Hadoop HDFS Concepts
Hadoop HDFS ConceptsHadoop HDFS Concepts
Hadoop HDFS Concepts
 
Computer architecture multi processor
Computer architecture multi processorComputer architecture multi processor
Computer architecture multi processor
 
Distributed system Tanenbaum chapter 1,2,3,4 notes
Distributed system Tanenbaum chapter 1,2,3,4 notes Distributed system Tanenbaum chapter 1,2,3,4 notes
Distributed system Tanenbaum chapter 1,2,3,4 notes
 
Hadoop & MapReduce
Hadoop & MapReduceHadoop & MapReduce
Hadoop & MapReduce
 
Distributed process and scheduling
Distributed process and scheduling Distributed process and scheduling
Distributed process and scheduling
 
Distributed dbms architectures
Distributed dbms architecturesDistributed dbms architectures
Distributed dbms architectures
 
Lecture 6
Lecture  6Lecture  6
Lecture 6
 

Similar to communication among tasks in advanced system architecture

Message passing Programing and MPI.
Message passing Programing and MPI.Message passing Programing and MPI.
Message passing Programing and MPI.Munawar Hussain
 
1 messagepassing-121015032028-phpapp01
1 messagepassing-121015032028-phpapp011 messagepassing-121015032028-phpapp01
1 messagepassing-121015032028-phpapp01Zaigham Abbas
 
Characterization of communication.ppt
Characterization of communication.pptCharacterization of communication.ppt
Characterization of communication.pptAthira Ravindranathan
 
Intro to MPI
Intro to MPIIntro to MPI
Intro to MPIjbp4444
 
Symfony Messenger (Symfony Live San Francisco)
Symfony Messenger (Symfony Live San Francisco)Symfony Messenger (Symfony Live San Francisco)
Symfony Messenger (Symfony Live San Francisco)Samuel ROZE
 
Command Transfer Protocol (CTP) for Distributed or Parallel Computation
Command Transfer Protocol (CTP) for Distributed or Parallel ComputationCommand Transfer Protocol (CTP) for Distributed or Parallel Computation
Command Transfer Protocol (CTP) for Distributed or Parallel Computationpaperpublications3
 
parallel programming in tthe PVM-advanced system architecture
parallel programming in tthe PVM-advanced system architectureparallel programming in tthe PVM-advanced system architecture
parallel programming in tthe PVM-advanced system architectureRoslinJoseph
 
Simulation of BRKSS Architecture for Data Warehouse Employing Shared Nothing ...
Simulation of BRKSS Architecture for Data Warehouse Employing Shared Nothing ...Simulation of BRKSS Architecture for Data Warehouse Employing Shared Nothing ...
Simulation of BRKSS Architecture for Data Warehouse Employing Shared Nothing ...Dr. Amarjeet Singh
 
Usp message queues
Usp message queuesUsp message queues
Usp message queuesRohitK71
 
Java Messaging Services
Java Messaging ServicesJava Messaging Services
Java Messaging Serviceskumar gaurav
 

Similar to communication among tasks in advanced system architecture (20)

Message passing Programing and MPI.
Message passing Programing and MPI.Message passing Programing and MPI.
Message passing Programing and MPI.
 
Open MPI 2
Open MPI 2Open MPI 2
Open MPI 2
 
Intake 37 12
Intake 37 12Intake 37 12
Intake 37 12
 
message passing
 message passing message passing
message passing
 
1 messagepassing-121015032028-phpapp01
1 messagepassing-121015032028-phpapp011 messagepassing-121015032028-phpapp01
1 messagepassing-121015032028-phpapp01
 
Characterization of communication.ppt
Characterization of communication.pptCharacterization of communication.ppt
Characterization of communication.ppt
 
Intro to MPI
Intro to MPIIntro to MPI
Intro to MPI
 
Open MPI
Open MPIOpen MPI
Open MPI
 
MPI.pptx
MPI.pptxMPI.pptx
MPI.pptx
 
MPI
MPIMPI
MPI
 
Symfony Messenger (Symfony Live San Francisco)
Symfony Messenger (Symfony Live San Francisco)Symfony Messenger (Symfony Live San Francisco)
Symfony Messenger (Symfony Live San Francisco)
 
Command Transfer Protocol (CTP) for Distributed or Parallel Computation
Command Transfer Protocol (CTP) for Distributed or Parallel ComputationCommand Transfer Protocol (CTP) for Distributed or Parallel Computation
Command Transfer Protocol (CTP) for Distributed or Parallel Computation
 
parallel programming in tthe PVM-advanced system architecture
parallel programming in tthe PVM-advanced system architectureparallel programming in tthe PVM-advanced system architecture
parallel programming in tthe PVM-advanced system architecture
 
slides9.ppt
slides9.pptslides9.ppt
slides9.ppt
 
Chapter 3 - Processes
Chapter 3 - ProcessesChapter 3 - Processes
Chapter 3 - Processes
 
Ch03
Ch03Ch03
Ch03
 
Simulation of BRKSS Architecture for Data Warehouse Employing Shared Nothing ...
Simulation of BRKSS Architecture for Data Warehouse Employing Shared Nothing ...Simulation of BRKSS Architecture for Data Warehouse Employing Shared Nothing ...
Simulation of BRKSS Architecture for Data Warehouse Employing Shared Nothing ...
 
Usp message queues
Usp message queuesUsp message queues
Usp message queues
 
Os3
Os3Os3
Os3
 
Java Messaging Services
Java Messaging ServicesJava Messaging Services
Java Messaging Services
 

Recently uploaded

Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3JemimahLaneBuaron
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application ) Sakshi Ghasle
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAssociation for Project Management
 
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting DataJhengPantaleon
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfchloefrazer622
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsanshu789521
 
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxRoyAbrique
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionSafetyChain Software
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Celine George
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentInMediaRes1
 

Recently uploaded (20)

Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application )
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha elections
 
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
 
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory Inspection
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
 

communication among tasks in advanced system architecture

  • 1. ADVANCED SYSTEM ARCHITECTURE Parallel Programming In The Parallel Virtual Machine --Communication Among Tasks Presented By J.Roslin vimala Msc(cs) II year
  • 2. COMMUNICATION AMONG TASKS:  Communication among PVM tasks is performed using the message passing approach,which is achieved using a library of routines and a daemon.  During program execution, the user program communicates with the PVM daemon through the library routines.  The daemon, which runs on each machine in the PVM environment, determines the destination of each machine.
  • 3.  If the message is for a task on the local machine, Message send daemon routes message  If the message for a task on a remote host, Message Send remote daemon routes Message Sender Local Machine Task Daemon Daemon Receiving Task
  • 4. OPERATIONS:  Send  Receive These two operations are heart of this communication scheme. Generally Asynchronous. A message can be sent to one or more destinations by calling one of the PVM send functions. A message can be received by calling either a blocking or nonblocking receive function.
  • 5. User Application Library User Application Library Daemon Daemon 1 4 5 8 2 3 6 7 Host-1 Host-2 Communication in PVM Sender Task Receiver task
  • 6. DESCRIPTION OF ABOVE DIAGRAM  The arrow from the user applications to the daemons represent communication calls.  The arrows from the daemons to the user applications represent the return from the API.  Point-1: A sending process issues a send command.  Point-2: The message is transferred to the daemon.  Point-3: daemon will transmit the message on the physical link some time after returning control to the user application.
  • 7. Continued…  Point-4: The control is return to the user application.  Point-5: At some other time, either before or after send command, the receiving task issues a receive command.  Point-6: In the case of a blocking receive, the receiving task blocks on the daemon waiting for a message.  Point-7,8: i) After the message arrives, control is returned to the user application. ii) In the case of nonblocking receive , control is returned to the user application immediately (points7&8) Even if the message has not yet arrived.
  • 8.  A sender task can send the message to one or more receivers in three steps as follows: *A send buffer must be initialized.(Message Buffer) *The message is packed into this buffer.(Data Packing) *The completed message is sent to its destination(s ). (Sending a Message)  Receiving a message is done in two steps as follows: *The message is received.(Receiving a Message) *The message items are unpacked from the receive buffer.(Data Unpacking)
  • 9. 1)MESSAGE BUFFERS: Before packing a message for transmission, a send buffer must be created and prepared for data to be assembled into it. PVM provide two functions for buffer creation: # pvm_initsend(). # pvm_mkbuf(). These two functions agree on the i/p & o/p parameters. They take as input an integer value specify the next message’s encoding scheme, and they return an integer value specifying the message buffer identifier.
  • 10.  The two functions are listed below,  Three encoding types: bufid=pvm_initsend(encoding_option) bufid=pvm_mkbuf(encoding_option) • XDR • Default option0 • No encoding • Skip the encoding type1 • Leave data in place • Make send operation copy items directly from the user’s memory 2
  • 11. If user is using only one buffer pvm_initsend() Only a required function It clears send buffer & prepares it for packing a new message Pvm_mkbuf() It is useful when multiple message buffers are required It creates a new empty send buffer every time it is called
  • 12. 2)Data Packing: PVM provides a variety of packing functions pvm_pk*() to pack an array of a given data type into the active send buffer. Three arguments as inputs: 1st argument is a pointer to where the first item is, 2nd argument specifies the no of packed in an array. 3rd argument is the stride to use when packing. There are several packing functions for all kinds of data types such as, Byte , Double , String , And so on.
  • 13.  All the functions have the same no of arguments except the string packing function pvm_pkstr(), which takes only one argument.  Packing functions for the different data types include: # pvm_pkbyte(), pvm_pkcplx(), pvm_pkdcplx(), pvm_pkdouble(), pvm_pkfloat(), pvm_pkint(), pvm_pklong(), pvm_pkshort(), pvm_pkuint(), pvm_pkushort(), pvm_pkulong().
  • 14. 3)Sending a Message: *Sending messages in PVM is done in an asynchronous fashion. *The sending task will resume its execution once the message is sent. *It will not wait for the receiving task to execute the matching receive operation as in synchronous communication.
  • 15. Sending to one Receiver: The function pvm_send() performs a point-to-point send operation. Two Arguments: TID of the destination task. An integer message identifier(tag). Ex, The function call info=pvm_send(tid, tag)
  • 16. Sending to multiple receiver: To send the message to multiple destinations, the function pvm_mcast() should be used. pvm_mcast()=>Multiple receivers.(multicast) Ex, info= pvm_mcast(tid, n, tag) (n=tasks) Sending to a group: A message can be broadcast to all members of a group using the function pvm_bcast(). Ex, info=pvm_bcast(group_name, tag) (bcast=>broadcast)
  • 17. Packing and sending in one step: PVM also provides another function to send messages without the need to prepare and pack the buffer manually. The operation pvm_psend() does the packing automatically for then programmer. Ex, info=pvm_psend(tid, tag, my_array, n, int) Packs an array of n integers called my_array into a message labeled tag, and sends it to the task whose TID is tid.
  • 18. 4)Receiving a message:  Three types of message receiving functions are, Blocking Nonblocking Timeout The receiving task must wait until the expected message arrives in the receive buffer. A nonblocking receive immediately returns with either the expected data or a flag that the data have not arrived. Timeout receive allows the programmer to specify a period of time for which the receive function should wait before it returns.
  • 19.
  • 20. BLOCKING RECEIVE: bufid =pvm_recv(tid, tag)  This function will wait until a message with label tag is received from a task with TID = tid.  A value of -1 can be used as a wild card to match anything in either one of the arguments: tid or tag. A successful receive will create a receive buffer and return the buffer identifier to be used in unpacking the message.
  • 21. Nonblocking receive bufid = pvm_nrecv(tid, tag)  If the message has arrived successfully when this function is called, it will return a buffer identifier similar to the case of blocking receive.  However, if the expected message has not arrived, the function will return immediately with bufid = 0. Timeout Receive: bufid = pvm_trecv(tid, tag, timeout)  This function blocks the execution of its caller task until a message with a label tag has arrived from tid within a specified waiting period of time.  If there is no matching message arriving within the specified waiting time, this function will return with bufid = 0, which indicates that no message was received.
  • 22. Receive and Unpack in One Step:  Similar to the pvm_psend() function, PVM provides the function pvm_precv(), which combines the functions of blocking receive and unpacking in one routine. It does not return a buffer Identifier; instead it returns the actual values. Ex, info = pvm_precv(tid, tag, my_array, len, datatype, &src, &atag, &alen)
  • 23. 5)Data Unpacking: • When messages are received, they need to be unpacked in the same way they were packed in the sending task. • Unpacking functions must match their Corresponding packing functions in type, number of items, and stride. • PVM provides many unpacking functions pvm_upk(), each of which corresponds to a particular packing function. • PVM also provides the two functions pvm_upkstr() and pvm_unpackf() to unpack the messages packed bypvm_pkstr() and pvm_packf(), respectively.
  • 24. Other unpacking functions for the different data types include: pvm_upkbyte(), pvm_upkcplx(), pvm_upkdcplx(), pvm_upkdouble(), pvm_upkfloat(), pvm_upkint(), pvm_upklong(), pvm_upkshort(), pvm_upkuint(), pvm_upkushort(), pvm_upkulong().

Editor's Notes

  1. All packing,sending,receiving & unpacking functions affect only the active buffer. PVM provides the some functions to set the active send or receive buffers to bufid.They save the state of the previous buffer and return its identifier in oldbuf. oldbuf=pvm_setsbuf (bufid) oldbuf=pvm_setrbuf (bufid)