Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved DISTRIBUTED SYSTEMS Principles and Paradigms Second Edition ANDREW S. TANENBAUM MAARTEN VAN STEEN Chapter 13 Distributed Coordination-Based Systems
Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved Introduction To Coordination Models Figure A taxonomy of coordination models (adapted from Cabri et al., 2000).
Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved Direct Coordination The referential coupling generally appears in the form of explicit referencing in communication A process can communicate only if it knows the name or identifier of the other processes it want to exchange information with
Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved Mailbox Coordination In this case, there is no need for two communication take place Communication takes place by putting messages in a (possibly shared) mailbox Persistent message-oriented communication Necessary to explicitly address the mailbox that hold the messages that are to be exchanged
Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved Meeting Oriented The referential coupling generally appears in the form of explicit referencing in communication When a process wants to coordinate its activities with other processes, it cannot directly refer to another process There is a concept of a meeting in which processes temporarily group together to coordinate their activities
Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved Generative Communication The key idea in generative communication is that a collection of independent processes make use of a shared persistent dataspace of tuples Tuples are tagged data records consisting of a number typed fields Processes can put any type of record into the shared dataspace
Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved Overall Approach Figure The principle of exchanging data items between publishers and subscribers.
Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved Overall Approach The key idea in generative communication is that a collection of independent processes make use of a shared persistent dataspace of tuples Tuples are tagged data records consisting of a number typed fields Processes can put any type of record into the shared dataspace
Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved Example: Jini and JavaSpaces Figure The general organization of a JavaSpace in Jini.
Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved Example: Jini and JavaSpaces class public Tuple implements Entry { public Integer id, value; public Tuple(Integer id, Integer value) { this.id = id; this.value = value; } Then a template declared as Tuple template = new Tuple (null, new Integer(42)); will match the tuple Tuple item = new Tuple (“MyName”, new Integer(42));
Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved Example: TIB/Rendezvous Figure The principle of a publish/subscribe system as implemented in TIB/Rendezvous. messaeg string : news.comp.os.books. template string : news.comp.*.books.
Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved A Gossip-Based Publish/Subscribe System A subscription s takes the form of a tuple of (attribute, value/range) pairs, such as s = Assume that every node i enters only one subscription s i S = ∪ S i (S m ∩S i ≠Ø) = >(S m S i ) In that case, when a data item is published, the system need merely find the S m to which that item belongs, form which point it forward the item to the associated node
Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved Example: A Gossip-Based Publish/Subscribe System Figure Grouping nodes for supporting range queries in a peer-to-peer publish/subscribe system.
Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved Example: A Gossip-Based Publish/Subscribe System Each node maintains a list of references to other neighbors (a partial view) which it periodically exchanges with one of its neighbors If node i exchanges information with node j Select the one with the lowest identifier i 1 > j The next one to be selected is i 2 > i 1, i 2 contains elements not yet covered by node i 1 The process continues until all nodes that have an overlapping interest with node i have been inspected, leading to an ordered list i 1 < i 2 < … < i n Note that a node i k is in this list. If it covers region that i and j not yet jointly cover by nodes with a lower identifier than it, it is the first node that node j should forward a data to it
Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved Mobility and Coordination Assumed that there is a fixed basic infrastructure with access points for mobile nodes Under this assumption, how to ensure that published messages are not delivered more than once to a subscriber Keep track of the messages they have already received and simply discard duplicates Keep track of which messages have been sent to which subscribers
Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved Example: Lime Figure Transient sharing of local dataspaces in Lime.
Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved Example: Lime When a process P executes a write operation, the associated tuple is stored in the process’s local dataspace. In practical, it stays until there is a matching take operation Read and take operations can have an additional parameter specifying form which process a tuple is expected To better control how tuples are distribute: reactions A reaction specifies an action to executed when a tuple matching a given template is found in the local dataspace Each tuple has an associated code fragment telling exactly how that tuple should be moved between dataspaces
Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved Content-Based Routing Routers can take routing decisions by considering the content of a message In order to read messages, an applications will have previously provided the server with a description of the kind of data it is interest in The server, in turn, will notify the application when relevant data has arrived
Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved Content-Based Routing (1) Figure Naive content-based routing.
Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved Content-Based Routing (1) Let every server broadcast its subscriptions to all other server Every server will be able to compile a list of (subject, destination) pairs When the messages reaches a router, the latter can use the list to decide on the paths that the message should follow
Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved Content-Based Routing (2) Figure A partially filled routing table.