Many systems, especially computer systems are built in layers. The lower layers do simple, even trivial things. The middle layers build on combining the effect of entities at the lower layers to do more complex things. The upper layers in the system may be so far removed from the lower layers that it is not possible to think of the system as a whole due to the limits of the human mind. For example, while working on a simple program to compute student grades, I cannot think in terms of the bit manipulations done at the logic gate level in the ALU of the CPU to accomplish the computation of averages and standard deviations. Bit manipulations are done at a very low level when compared to the library routines I would use to do statistical computations.
Typically, one pictures such systems as in the figure below. Each layer provides services to a higher layer and uses the services of a lower layer. It would not be uncommon either for each layer to dealing with different levels of complexity and abstraction. A lower layer would typically be dealing with simpler entities and less abstract concepts. A higher layer would deal with combinations of entities of the lower layers or possibly less concrete concepts.
Figure 1: Interactions
between entities in a layered system.
A strictly layered system enforces the layering concept as a system design and construction criterion. Such a system design allows an entity at layer N only to interact with entities at layers N+1 and N-1 and no other layers.
Figure 2:Contrast between
layered systems without strict layering (on left) and with strict layering
(on right). The red color highlights the interactions that violate strict
layering.
The advantage to a strictly layered system is the simplicity with which it can be modified. If one adds a new layer N entity or replaces it, the sphere of interaction with other parts of the entire system is quite limited and easy to manage.
The disadvantage of a strictly layered system is that it can be inefficient to deal with intermediate layers when there is an interaction between entities at distant layers.
Networking systems are built using the layering concept extensively and are often criticized for their inefficiency. In some cases, the inefficiencies are indeed caused by excessively strict layering. Most actual systems, however, do not follow strict layering and the layering is more conceptual than actual. Generally, what appears to be inefficiency is actually intricacy. The complexity of networked systems is much greater than standalone systems, and the casual observer is usually mystified as to the reason for many of the parts of a network system.
In a simple, traditionally designed software system the interaction between layers is always initiated by the higher layer. However, in a communication system, information must travel in both directions. A high level entity on the sending system interacts with a lower level entity on the sending system setting off a chain of interactions. This chain eventually results in an interaction between a very low level entity in the sending system and a very low level entity in the receiving system. A new chain of interactions works its way up the layers in the sending system until a message is delivered to some high level entity in the receiving system.
Figure 3: Communication
downward between layers on sender (on left) and communication upward between
layers on receiver (on right). Actual interaction between sender a receiver
only takes place at the lowest layers.
The whole point of layering is to eliminate the need to consider the abstract concepts and the details at the same time. With a layered communication system, one can accomplish this by treating actual interactions with a lower layer as a virtual interaction with the peer layer at the other end of the conversation.
For example, suppose data is being sent from layer N on the sender to its peer, layer N on the receiver. Data is actually sent to layer N-1 on the sender and sets of a chain that reaches layer 0. At layer 0 an actual interaction takes place between peer layers in the sender and receiver. The upward chain completes the actual chain of data interchange resulting in delivery of data to layer N on the receiver. However, due to the abstraction facilities that layering provides, it suffices to concentrate only on layers N and N -1 The delivery of virtual delivery of data from one layer N entity to its peer layer N entity is then viewed in terms of interactions occurring at layer N-1.
Figure 4: Virtual communication
paths between peers are highlighted in red while actual communication paths
are in black. Note that only actual communication between sender (on left)
and receiver (on right) is at the lowest level.