Interprocess Communication

Only available on StudyMode
  • Download(s) : 156
  • Published : February 25, 2013
Open Document
Text Preview
Distributed Systems 3. Interprocess Communication

Werner Nutt

1

Interprocess Communication
3.1 Principles

1. 2. 3. 4. 5.

Principles APIs for UDP and TCP External Data Representation Client Server Communication Group Communication 2

Middleware
Middleware offers an infrastructure that enables application processes to communicate with each other Processes issue requests to the transportation layer (i.e., the application takes the initiative, not the middleware)

Applications access the middleware via APIs, e.g., – creation and manipulation of sockets Integration into programming languages – remote procedure call (RPC) – remote method invocation (RMI) For higher level APIs, data has to be transformed before it can be shipped (“data marshalling”) Protocols for Client/Server Interaction (“Request/Reply”) 3

Middleware Layers
ISO/OSI
Applications, services RMI and RPC
This This chapter chapter

7

request-reply protocol marshalling and external data representation UDP and TCP

Middleware layers

6

4,5

4

Characteristics of IPC
Message Passing Primitives: Send, Receive Message = Destination = – Port = destination within a host that identifies a receiving process – Ports are uniquely identified by their port number – Hosts are uniquely identified ... (or not?)

5

Assigned Port Numbers
FTP Data FTP Control SSH Telnet SMTP Domain Name Server Whois HTTP POP3 IMAP4 BGP HTTPS IMAP4 over SSL 20 21 22 23 25 42 43 80 110 143 179 443 993 Assigned by IANA (= Internet Assigned Numbers Authority) Numbers between 0 and 1023 are “well-known” ports — opening a port for such numbers requires privileges

can be found - on the Web - in “/etc/services” under Linux and MAC/OS 6

Sockets
Characteristics – Endpoint for inter-process communication – Message transmission between sockets – A socket is associated with either UDP or TCP – Sockets are bound to ports – One process can use many ports – Processes don’t share sockets (unless for IP multicast) Implementations – originally BSD Unix, but available in Linux, Windows,… – APIs in programming languages (e.g., java.net ) 7

Sockets and Ports

socket

any port

agreed port socket

message client other ports Internet address = 138.37.94.248 Internet address = 138.37.88.249 server

Socket = Internet address + port number Only one receiver but many senders per port Advantage: several points of entry to process Disadvantage: location dependence

8

Communication Primitives
Send – send a message to a socket associated to a process – can be blocking or non-blocking Receive – receive a message on a socket – can be blocking or non-blocking Broadcast/Multicast – send to all processes/all processes in a group 9

Receive
Receive is usually blocking – destination process blocked until message arrives – most common case Variations – conditional receive (continue until receiving indication that message arrived or finding out by polling)

– timeout – selective receive
(wait for message from one of a number of ports)
10

Send in Asynchronous Communication
Characteristics – non-blocking (process continues after the message sent out) – buffering needed (at receive end) – mostly used with blocking receive – efficient implementation Problems – buffer overflow – error reporting (difficult to match error with message) Maps closely onto connectionless service 11

Send in Synchronous Communication
Characteristics – blocking (sender suspended until message received) – synchronisation point for sender & receiver – easier to understand Problems – failure and indefinite delay causes indefinite blocking (use timeout)

– multicasting/broadcasting not supported – implementation more complex Maps closely onto connection-oriented service 12

Interprocess Communication
3.2 APIs for UDP and TCP

1. 2. 3. 4. 5.

Principles APIs for UDP and TCP External Data Representation Client Server Communication Group Communication 13

Java API for...
tracking img