next up previous contents
Next: Global Name Space Up: Relay Servers Previous: Server Hierarchy

Threads

The Relay server is implemented as a multithreaded application. Three types of threads handle the server's responsibilities:

  1. The main thread listens to a well known port on the server's machine for new connections. This server thread starts a new Listener thread for every client that connects to the server.
  2. Listener threads receive and apply updates originating from a particular client. A Listener thread is started for each client that connects to the system. Each thread runs in an endless loop, listening to a socket connection for updates. After some processing to make sure the update is ordered and the updated object is named, accepted updates are passed to the Propagator, described below. A Listener thread exits when its corresponding client dies.
  3. The Propagator thread sends updates to all connected clients. Special care must be taken to avoid endless propagation of an update between two servers.

    The Propagator thread does not distinguish server connections from client connections when propagating an update. Therefore, to avoid cyclic propagation of an update, the Update message has a flag to tell the Propagator whether the message came from a client or a server. If the message came from a client, the Propagator broadcasts it to all connections. The update is sent back to where it originated so that any new objects become part of the shared state at that client. If the message came from a server, all connections except the one the message was received from are notified of the update.

  figure107
Figure 4.1: Update propagation through a hierarchy of servers. The system prevents propagation cycles between servers. (I) shows an update originating at a client of the root server. (II) shows an update originating from a client of a child of the root server.

The Listener thread examines and modifies updates to impose a global name space and eventual consistency on cached objects.




next up previous contents
Next: Global Name Space Up: Relay Servers Previous: Server Hierarchy

Carmine F. Greco
Wed Mar 26 23:44:38 EST 1997