DC Module2
DC Module2
There are two ways of sending data when the Send primitive is called:
Buffered: The standard option copies the data from the user buffer to the
kernel buffer. The data later gets copied from the kernel buffer onto the
network. For the Receive primitive, the buffered option is usually required
because the data may already have arrived when the primitive is invoked, and
needs a storage place in the kernel.
Unbuffered: The data gets copied directly from the user buffer onto the
network.
Blocking primitives
The primitive commands wait for the message to be
delivered. The execution of the processes is blocked.
The sending process must wait after a send until an
acknowledgement is made by the receiver.
The receiving process must wait for the expected
message from the sending process
The receipt is determined by polling common buffer or
interrupt
This is a form of synchronization or synchronous
communication.
A primitive is blocking if control returns to the invoking
process after the processing for the primitive completes.
Non Blocking primitives
If send is nonblocking, it returns control to the caller
immediately, before the message is sent. The advantage of this
scheme is that the sending process can continue computing in
parallel with the message transmission, instead of having the CPU
go idle.
This is a form of asynchronous communication.
A primitive is non-blocking if control returns back to the
invoking process immediately after invocation, even though the
operation has not completed.
For a non-blocking Send, control returnsto the process even
before the data is copied out of the user buffer.
For anon-blocking Receive, control returns to the process even
before the datamay have arrived from the sender.
Synchronous
A Send or a Receive primitive is synchronous if both the
Send() and Receive() handshake with each other.
The processing for the Send primitive completes only after
the invoking processor learns that the other corresponding
Receive primitive has also been invoked and that the receive
operation has been completed.
The processing for the Receive primitive completes when
the data to be received is copied into the receiver’s user buffer.
Asynchronous
A Send primitive is said to be asynchronous, if control returns
back to the invoking process after the data item to be sent has
been copied out of the user specified buffer.
It does not make sense to define asynchronous Receive
primitives.
Implementing non -blocking operations are tricky.
For non-blocking primitives, a return parameter on the primitive
call returns a system-generated handle which can be later used to
check
the status of completion of the call.
The process can check for the completion:
o checking if the handle has been flagged or posted
o issue a Wait with a list of handles as parameters: usually blocks
until one of the parameter handles is posted
The send and receive primitives can be implemented in
four modes:
Blocking synchronous
Non- blocking synchronous
Blocking asynchronous
Non- blocking asynchronous
Communication
Inter-process communication :-
• Applications,Services
• RMI,RPC
• Request-Reply protocol
• Marshalling and External Data
Representation
• UDP and TCP
Discussion Focus
– Representation of objects
• providing a common interface for object references
– Protocol construction
• Two communication patterns for distributed programming: C-S using
RMI/RPC and Group communication using ‘broadcasting’
Characteristics of IPC
• Message destinations.
• Reliability.
• Ordering.
Characteristics of IPC
synchronous and asynchronous communication.
• Synchronous
• Asynchronous communication
– Send from client is non-blocking and proceeds in parallel with local
operations
– Receive could be non-blocking (requiring a background buffer for when
message finally arrives, with notification – using interrupts or polling)
AND if blocking, perhaps, remote process needs the message, then the
process must wait on it
– Having both sync/async is advantageous, e.g., one thread of a process
can do blocked-receive while other thread of same process perform non-
block receive or are active – simplifies synchronization. In general non-
blocking-receive is simple but complex to implement due to messages
arriving out-of-order in the background buffer
Characteristics of IPC
Message destinations
– Possibility: receiving process can have many ports for different message
types
– Server processes usually publish their service-ports for clients
Reliability
Ordering
Sockets
– Provide an abstraction of endpoints for both TCP and UDP communication
– Each computer has 216 possible ports available to local processes for
receiving messages
– Many processes in the same computer can deliver to the same port
(many-to-one), however
Sockets
– Provide an abstraction of endpoints for both TCP and UDP communication
– Each computer has 216 possible ports available to local processes for
receiving messages
– Many processes in the same computer can deliver to the same port
(many-to-one), however
• No acknowledgements/retries.
• Message size:The receiving process
specifies an array of bytes,messages
are truncated on arrival.
• IP allows packets lengths of 2^16.
• Larger messages are truncated
• Non-blocking sends but blocking
receives
• Setting Time-outs on receives.
UDP Datagram communication..Failure
Model
•Blocking
•Threads
Issues related to stream communication
• Failure Model
•HTTP ,80
•FTP,20,21
•Telnet 23
•SMTP,25
A list of all TCP/UDP well known
services.
TCP and UDP comparison
TCP protocol
•It is fast and used mostly for audio and video streaming
R- Request protocol