Docsity

Communications for Programming Language Technology - Slides | CMSC 433, Study notes of Programming Languages

Partial preview of the text

Download Communications for Programming Language Technology - Slides | CMSC 433 and more Study notes Programming Languages in PDF only on Docsity!

Distributed Computing

CMSC 433

Distributed Computing

  • Computations running across multiple machines
  • Computations that shouldn’t fail just because one machine fails

IP terminology

  • IP address
    • hostname
  • Port
    • port space for UDP and TCP are separate
    • each service typically has a standard port for initiating communication

TCP Server Sockets

  • bound to a particular port
  • accept() waits for a connection request on that port - returns a standard Socket for further communication - ServerSocker can be immediately reused

Socket

  • new Socket(InetAddress a, int port)
    • creates a TCP socket connection to a server socket at the specified address and port
  • For each socket, you can call getInputStream() getOutputStream()

Streams

  • You should all know InputStream, OutputStream, Reader, Writer
  • DataOutputStream adds writeInt, writeLong, writeDouble, writeUTF
  • DataInputStream provides matching read methods

Object graphs

  • Writing to an object output stream writes a graph of objects - writing a map sends all the elements - writing one node of a graph sends all connected nodes
  • Reconstructed into an isomorphic graph

potential problems

  • You write a class that received doesn’t have - error
  • You write a different version of a class than the receiver has - maybe OK

remote code base

  • RMI provides an extension to object serialization
  • allows you to provide a URL from which your classes can be downloaded in received doesn’t have them