PDC Lec 9
PDC Lec 9
Computing
Namra Mukhtar
[email protected]
Lecturer, GCWUS
Content
Software Architecture
Processes and message passing
Process and Message Passing
programming paradigm.
• Asynchronous paradigm.
defined as follows:
Process and Message Passing cont…
The Building Blocks: Send and Receive
Operations
• send(void *sendbuf, int nelems, int dest)
The dest is the identifier of the process that receives the data
The source is the identifier of the process that sends the data
Process and Message Passing cont…
The Building Blocks: Send and Receive
Operations
Process and Message Passing cont…
The Building Blocks: Send and Receive
Operations
• The important thing to note is that process P0 changes the value of a
• The semantics of the send operation require that the value received
100!
Process and Message Passing cont…
The Building Blocks: Send and Receive
Operations Blocking Message Passing
Operations
• A simple solution to the dilemma presented in the code fragment above is
for the send operation to return only when it is semantically safe to do so.
• It simply means that the sending operation blocks until it can guarantee
operation does not return until the matching receive has been
• When this happens, the message is sent and the send operation
• We start with a simple case in which the sender has a buffer pre-allocated for
communicating messages.
• On encountering a send operation, the sender simply copies the data into the
Process and Message Passing cont…
The Building Blocks: Send and Receive
Operations Blocking Message Passing
Operations
• The sender process can now continue with the program knowing that
• Note that at the receiving end, the data cannot be stored directly at
(a) presence of communication hardware (b) absence of communication hardware, sender interrupts
with buffers at send and receive ends receiver & deposits data in buffer at receiver end
Process and Message Passing cont…
The Building Blocks: Send and Receive
Operations Blocking Message Passing
Operations
• The sender process can now continue with the program knowing that
• Note that at the receiving end, the data cannot be stored directly at