% $Id: Related.tex,v 1.9 2005/10/18 16:27:53 arvindk Exp $
\section {Related Research}
\label{related}

% Doug, fix all the references to use the proper capitalization!
This section compares our work on context-specific specializations for
middleware-based PLAs for DRE systems with related research in a range
of system and application domains.

% \sqztiny
\subsection{Operating systems}
Specialization techniques have been applied to operating systems.  For
example, the Synthesis Kernel~\cite{Massalin:88} generated custom
system calls for specific situations to collapse layers and eliminate
unnecessary procedure calls.  This approach has been extended to use
incremental specialization techniques.  For example,~\cite{Pu:95} have
identified several invariants for an OS \url{read()} call on HP/UX.
Based on these invariants, code is synthesized to adapt to different
situations.  Once the invariants fail, either re-plugging code is used
to adapt to a different invariant or default unoptimized code is used.
Our work extends the range of specializations to encompass middleware
invariants in the context of PLA-based DRE systems, which have some
different constraints.  For example, we do not consider dynamic
re-plugging costs since it would unduly increase jitter for product
variants in many DRE systems.

% \sqztiny
\subsection{Middleware}
Specialization techniques have also been applied to various
generations of middleware.  \cite{marlet99efficient} describes the use
of the Tempo C program partial evaluator tool to automatically
optimize common software architecture structures with respect to fixed
application contexts.  For instance, the authors show how partial
evaluation can be applied to fold together and optimize layers in
early generations of middleware, {\em i.e.}, a remote procedure call
(RPC) implementation, by specializing RPC invocations to the size and
type of remote procedure parameters (yielding speed-ups of 1.7x and
3.5x).

\cite{marlet99efficient} also customize a publish/subscribe framework
to a context in which subscribers of a particular event are known {\em
a priori}.  This type of architecture is representative of the
structures encountered in middleware for PLA-based DRE systems, which
motivated us to consider similar techniques that could be applied with
good effect to optimize Real-time CORBA implementations.  In our work,
we have identified additional CORBA architectural structures that are
amenable to optimization via specialization.  Technical challenges
remaining include extending the automatic C program techniques in
\cite{marlet99efficient} to richer object-oriented languages, such as
C++ and Java, that place a greater emphasis on dynamically created
data.

Other research on middleware~\cite{zhang03refactoring,Zhang:05a} has
applied aspect-oriented programming (AOP) techniques to factor out
cross-cutting middleware features, such as portable interceptors,
(de)marshaling routines, and dynamic typing.  Some specializations
described in this paper can be implemented using AOP.  The primary
difference is that our specializations focus more on the {\em
transformations} (woven code) required to specialize middleware,
whereas AOP is more of a delivery mechanism to realize
specializations.

\iffalse
\sqztiny
\subsection {Other domains}
Specialization mechanisms have been applied to computer graphics,
database systems, and neural networks.  In computer graphics, for
example, ray tracing algorithms compute information on how light rays
traverse a scene based on different origination.  Specialization of
these algorithms~\cite{Andersen:1995:PartialEvaluation} for a given
scene has yielded better performance rather than general purpose
approaches.  Similarly in databases~\cite{Sakama:1988:Partial},
general-purpose queries have been transformed into specific programs
optimized for a given input.  Similarly, training neural
networks~\cite{Lei:1990:ADeductive} for a given scenario has improved
its performance.  The specializations described in this paper, in
contrast, focus on specializations that customize standards-based,
general-purpose middleware for particular product variants and
application-specific contexts.
\fi

% \sqztiny
\subsection {Empirically-guided Optimizers}
The ATLAS~\cite{Padua:03} numerical algebra library uses an empirical
optimization engine to set the values of optimization parameters by
generating different program versions that are run on various
hardware/\-OS platforms.  The output from these runs are used to
select parameter values that maximize performance.
%  Mathematical models are also used to estimate optimization
%  parameters based on the underlying architecture, though empirical
%  data is not fed into the models to refine it.
Similarly, our GNU \url{autoconf} specializations run empirical
benchmarks on the target deployment platform to determine the OS,
compiler, and hardware parameters that maximize performance.
