IT533 - SOFTWARE ARCHITECTURES - CLASS 3
See text Table 4.1 on page 126
The architecture for one of the event processors that was shown
in the architecture on the viewtype page is shown
in Figure 5:
Figure 5: Architecture for Event Processor 2
There are three basic types of components that participate
in a pipe-and-filter processing chain:
- Pump (Producer)
Produces data and puts it to an output port that is connected to
the input end of a pipe.
Gets data from an inport port connected to the output end of a pipe,
transforms the data, and puts it to an output port that is connected to
the input end of a different pipe.
A filter may have multiple input and/or output ports.
- Sink (Consumer)
Gets data from the input port that is connected to the output end of
a pipe and consumes the data.
In the abstract, a filter is a combination of a sink and a pump.
Some possible ways to implement pipes are:
- Procedure Invokation
Filters that are running synchronously on a single processor may
be connected by procedure invokations.
The output port of a filter is a call to a
method in the next filter.
The input port of a filter is parameter set that is passed
A consequence of this type of pipe is that one unit of data
from the producer passes through the entire filter chain to the
consumer before control returns to the produce to put the
next data item.
If threading is available, a buffered invokation pipe can be created
with a filter running in one thread and the following filter
running in another thread.
- Character and Byte Streams
Many operating systems and some object oriented languages provide
pipes that are streams of bytes.
The software sockets that are used to implement connections
between two (possibly remote) applications are basically two way
streams of bytes.
Some advantages of the pipe-and-connector style are
- Filters stand alone and can be treated as black boxes.
This isolation of functionality helps to ensure quality
attributes such as information hiding, high cohesion,
modifiability, and reuse.
- Filters interact with other components in limited ways.
This connection simplicity helps to ensure low coupling.
- Pipes and filters can be hierarchically composed.
Higher order filters can be created from any combination
of lower order pipes and filters.
- The construction of the pipe and filter sequence can often be
delayed until runtime (late binding).
This permits a controller component to tailor a process based
on the current state of the applcation.
- Because the process performed by the filter is isolated from
the other components in the system, it is relatively easy to
run a pipe-and-filter system on parallel processors or in multiple
threads on a single processor.
Some disadvantages of the pipe-and-connector style are
- Because the problem is decomposed into sequential steps,
a batch mentality is encouraged.
It is difficult to create entire interactive applications
using this style.
- Filters often force the data to be represented in the
lowest common denominator, typically byte or character streams.
This means that if processing must be based on information tokens
(words, lines, records), every filter may introduce overhead for
parsing and unparsing the data stream.
- If a filter can not produce any output until it has received
all of its input, the filter will require a buffer of unlimited
If fixed size buffers are used, the system could deadlock.
A sort filter has this problem.
Prepared by David L. March -- Last Revised on April 11, 2003
COPYRIGHT © 2003 BY DAVID L. MARCH