distributed c4

Cards (88)

  • Inter-process communication is at the heart of all distributed systems
  • Communication in distributed systems is always based on low-level message passing as offered by the underlying network
  • Expressing communication through message passing is harder than using primitives based on shared memory, as available for non-distributed platforms
  • Modern distributed systems often consist of thousands or even millions of processes scattered across a network with unreliable communication such as the Internet
  • Unless the primitive communication facilities of computer networks are replaced by something else, development of large-scale distributed applications is extremely difficult
  • Protocols
    Communicating processes must adhere to
  • Structuring protocols
    In the form of layers
  • Models for communication
    • Remote Procedure Call (RPC)
    • Message-Oriented Middleware (MOM)
    • Data streaming
  • Multicasting is the general problem of sending data to multiple receivers
  • Remote Procedure Call (RPC)
    Aims at hiding most of the intricacies of message passing, and is ideal for client-server applications
  • Message-oriented middleware (MOM)

    Communication precedes much the same as in electronic mail systems
  • Before discussing communication in distributed systems, we first recapitulate some of the fundamental issues related to communication
  • Network communication protocols form the basis for any distributed system
  • Layered Protocols
    1. Process A builds a message in its own address space
    2. Executes a system call that causes the operating system to send the message over the network to B
    3. A and B have to agree on the meaning of the bits being sent
  • Agreements needed for communication
    • How many volts should be used to signal 0-bit, and how many volts for 1-bit
    • How does the receiver know which is the last bit of the message
    • How can it detect if a message has been damaged or lost, and what should it do if it finds out
    • How long are numbers, strings, and other data items, and how are they represented
  • Open system
    One that is prepared to communicate with any other open system by using standard rules that govern the format, contents, and meaning of the messages sent and received
  • Protocols
    The standard rules that govern the format, contents, and meaning of the messages sent and received
  • Types of protocols
    • Connection oriented
    • Connectionless
  • Connection oriented protocols
    Sender and receiver first explicitly establish a connection, and possibly negotiate the protocol they will use. When they are done, they must release (terminate) the connection.
  • Connectionless protocols
    No setup in advance is needed. The sender just transmits the first message when it is ready.
  • With computers both connection-oriented and connectionless communications are common
  • OSI model
    • Communication is divided up into seven levels or layers
    • Each layer deals with one specific aspect of the communication
    • Each layer provides an interface to the one above it
  • Communication in OSI model
    1. Process A builds a message and passes it to the application layer
    2. Application layer adds a header and passes it to the presentation layer
    3. Presentation layer adds its own header and passes it to the session layer
    4. Physical layer transmits the message
  • Middleware
    An application that logically lives (mostly) in the application layer, but which contains many general-purpose protocols that warrant their own layers, independent of other, more specific applications
  • Middleware protocols
    • Authentication
    • Authorization
    • Remote Procedure Call (RPC)
    • Streaming
    • Reliable multicast
  • Persistent communication
    A message that has been submitted for transmission is stored by the communication middleware as long as it takes to deliver it to the receiver
  • Transient communication
    A message is stored by the communication system only as long as the sending and receiving application are executing
  • Remote Procedure Call (RPC)

    Allowing programs to call procedures located on other machines
  • Conventional Procedure Call

    1. Caller pushes parameters onto the stack in order, last one first
    2. Called procedure puts return value in a register, removes return address, and transfers control back to caller
    3. Caller removes parameters from the stack
  • Call-by-value and call-by-reference

    • Value parameter is simply copied to the stack
    • Reference parameter is a pointer to the original variable
  • The idea behind RPC is to make a remote procedure call look as much as possible like a local one
  • Remote Procedure Call (RPC)
    1. Client procedure calls client stub
    2. Client stub builds message and calls local OS
    3. Client OS sends message to remote OS
    4. Remote OS gives message to server stub
    5. Server stub unpacks parameters and calls server
    6. Server does work and returns result to stub
    7. Server stub packs result in message and calls local OS
    8. Server OS sends message to client OS
    9. Client OS gives message to client stub
    10. Client stub unpacks result and returns to client
  • Parameter marshaling

    Packing parameters into a message
  • RPC aims to make a remote procedure call look as much as possible like a local one
  • The calling procedure should not be aware that the called procedure is executing on a different machine or vice versa
  • In a traditional single-processor system, the read routine is extracted from the library by the linker and inserted into the object program
  • The read procedure is a kind of interface between the user code and the local operating system
  • When read is a remote procedure, a client stub is put into the library instead of the original read
  • The client stub packs the parameters into a message and requests that message to be sent to the server
  • The server stub unpacks the parameters from the message and then calls the server procedure