Homework 8 Solved

22C:116, Fall 1999

Douglas W. Jones

  1. Part A: The client and server should both allocate new mailboxes for the secondary messages exchanged during each transaction. The client-server interaction begins with an exchange of links; the client gives the server a reply link and the server gives the client a follow-up link. Then, the client sends all the links that must be passed, one per message, over the followup link, and finally, after the service has been completed, the server sends the results to the reply links, and if it sends a list of links as results, these are sent one per message.

    The assignment explicitly said not to write pseudocode. The following code is included here to illustrate how much more work is involved in formulating pseudocode to solve this problem:

      client-call( sl, out-l, in-l, out-p, in-p )
        r = create new box
        rl = create new link to box r
        c = length of list of links in-l
        send to sl the link rl with the body [c,out-p]
        await message in box r containing link pl
        for each link l in the list of links out-l
          send to pl the link l
          (this loop iterates c iterations)
        endloop
        --
        in-l = empty list of links
        await message in box r containing body [c,in-p]
        iterate c times
          await message in box r containing link l
          add link l the list in-l
        endloop
        
      server
        loop
          await message in box s the link rl and body [c,out-p]
          p = create new box
          pl = creat new link to box p
          send to rl the link pl
          out-l = empty list of links
          iterate c times
            wait message in box p containing link l
            add link l to the list out-l
          endloop
          --
          call service function ( out-l, in-l, out-p, in-p )
          --
          c = length of list in-l
          send to rl the body [c,in-p]
          for each link l in list in-l
            send to rl the link l
            (this loop iterates c iterations)
          endloop
        forever
      
    

    Part B: In the case where the server is a nameserver, the messages that must be exchanged between the client and server for the operations are as follows:

     save(l,n)
    
       initiate save message from client to server's public mailbox:
          body: ( save, n )
          link: reply-link
    
       initial reply from server to client's reply box:
          body: none
          link: private-link
    
       followup save message, from client to server's private-link:
          body: none
          link: l
    
       optional final reply from server to client's reply box:
          body: none
          link: none
    
     lookup(n) returns l
    
       initiate lookup message from client to server's public mailbox:
          body: ( lookup, n )
          link: reply-link
    
       optional initial reply from server to client's reply box:
          body: none
          link: private-link
    
       final reply from server to client's reply box:
          body: none
          link: l
    
    In the above, the optional messages are not, strictly speaking, needed, but a generic skeleton for the server following the outline of part A will tend to include them unless it is optimized. Furthermore, in a fault tolerant system, it is handy to know, in the case of save(), that the service has been completed, and in the case of lookup(), that the initial message was delivered.

    Part C: The basic interprocess communication primitives of our DEMOS like example are at the transport level in the ISO OSI model protocol hierarchy. They are stateless, so they aren't at or above the session layer, but they clearly address messages to logical recipients (boxes) and not to physical machines.

    Part D: In the ISO OSI model protocol hierarchy, what level is represented by The client-server protocol described in part A establishes a temporary connection between client and server using temporary boxes and links, so it is at the session level in the ISO OSI model protocol hierarchy.

  2. Many server architectures require some kind of multi-wait primitive that will continue when a message is sent to any of a number of incoming boxes. Imagine a single-threaded server that implements the protocols described in problem 1. If this server operated in a strictly sequential fashion, it would never need a multi-wait primitive, but if it was designed to allow overlap of computation with I/O or the performance of secondary services by other servers, it would have to wait, for example, for messages from any of a number of active clients while at the same time waiting for requests from new clients. Multi-wait primitives allow this.

  3. If a system does not have group communication primitives, but only has, for example, process to process message passing primitives such as the DEMOS-like primitives outlined above, there is a possible loss of performance. If a group of processes wanted, for example, barrier synchronization or more complex group communications, this could always be implemented by a server. All members of the group of communicating processes would have to communicate with this server each time they needed to synchronize on the barrier or exchange "groupcast" messages.