Composite Messages: a Structural Pattern for Communication between Components

Complex software systems are composed of interacting components. These components collaborate to implement abstractions, such as \packets" in a networking system or \virtual memory page" in a virtual memory system. This pattern focuses on organizing the communication infrastructure used by the components , so that communicating components can be added or removed with minimalchanges. At the same time, the communication overhead is minimized. 1 Intent Structure inter-component communication in a system so that loosely coupled components make minimal assumptions about the communication infrastructure , while tightly coupled components localize their interactions. 2 Motivation To motivate the pattern, consider the implementation of networking systems and virtual memory systems. Networking systems are typically implemented as subsystems \layered" on top of one another. In this case, the individual layers are our components, and they operate on a single logical resource, the packet. We are interested in how the layers interact with each other to construct a packet that can be transmitted (this is not to be confused with the application-to-application communication implemented by the layers). Typically, the user session layer creates a message with a header and payload, and each subsequent Supported by CNRI contract CNRI GIGABIT/UILL. layer adds a header to the packet to be transmitted, In doing so, the layers implicitly \communicate" with each other by following a recipe to ensure the header added by one layer is not destroyed by another, and that the eventual format of the packet matches that prescribed by the overall networking protocol. If the implicit communication is implemented so that each layer knows the size and placement of head-ers added by others, it becomes diicult to reuse code in case some layer is removed or header size changed. Instead, we should design a simple recipe to be followed by each layer, resolving the following forces: Memory management should be eecient. Packet layout must be immune to addition and removal of layers. Furthermore, packets have to be marshalled or fragmented 8] for communication across the network. Network layers communicate in order to create transmissible packets, so although marshalling and fragmentation are not necessary for inter-layer communication , we will include them as a force that aaects packet layout. Packet layout has to simplify marshalling, fragmentation , reassembly, and unmarshalling of packets. Now consider a diierent example of communication between system components. The virtual memory system of a modern operating system such as Choices 2] or Mach …

[1]  Larry L. Peterson,et al.  The x-Kernel: An Architecture for Implementing Network Protocols , 1991, IEEE Trans. Software Eng..

[2]  Roy H. Campbell,et al.  Distributed virtual memory consistency protocols: design and performance , 1990, IEEE Workshop on Experimental Distributed Systems.

[3]  Roy H. Campbell,et al.  The Design of a Multiprocessor Operating System , 1987, C++ Workshop.