Given a behavior spec for a protocol say TCP/IP, can a stack be synthesized
as a composition of the ensemble micro protocols? Given 60
micro protocols in the ensemble suite, there are way too many combinations for a
brute force approach. Instead. In the ensemble approach, the user heuristic
algorithm for synthesizing the stack given
the desired behavioral spec and designer's knowledge
of the micro protocols. The result is a protocol stack which is functional, but
not optimized for performance. Of course, as
operating system designers, we're always worried about
perf, performance. And we naturally have to
think about how to optimize the protocol
stack, so that it is not only
functional, but also performant. In particular, the
fact that we've assembled this protocol stack
like Lego blocks. Putting together all these
micro protocols leads to layering and layering
leads to inefficiencies. Now this is where
the analogy to VLSI component based design,
breaks down. And the reason is because in
VLSI component based design, even though we
are building a complex chi, like a CPU.
By putting together components, the components just
fit together very nicely. There is, there is
no inefficiency in going between these components.
But in software components unfortunately, they have interfaces.
And interfaces usually mean that, that there
is well defined boundaries between these components and
so to cross the component boundary, you may have
to copy parameters at here to interface specifications of the
components and so on. All of those things leads to
inefficiencies and this where the VLSI component based design idea
breaks down little bit when we just put together
the components of software in order to build the, the
large scale system. So we have to do the extra
work that is needed in order to optimize the component-based
design so that it can perform well. Fortunately there
are several sources of optimization that are possible. For
instance I mentioned that OCaml has implicit garbage collection.
Now it is good that it has implicit garbage collection
as a fall-back. But, maybe we don't want to use
it all the time and we want to be
explicit about how we manage our own memory that
can be more efficient, that is a source of optimization.
I mentioned that OCaml has ability for doing
marshaling and unmarshaling of arguments to go across
layers, but is also a very good thing to do, in order to have a component-based
design. But, when you're going across layers, these
things can add overheads and this is another
source of optimization that is possible by avoiding
these marshalling and unmarshalling across the layers but collapsing
the layers. Another opportunity that exists especially in networking
systems, is the fact that there's going to be
communication and computation. If you think about TCPIP Protocol,
it has to necessarily buffer the packets that it's sending
out. Because if the packets are lost for some
reason, it may have to re-transmit it. This is again,
a situation where we can overlap this buffering which
is computation on the node that is sending the packet
with the actual transmission. So, we can overlap that.
That's another opportunity for optimization.
Another opportunity is compressing the
header, especially when we have this layering, at every
layer it might add a new header specific to that
layer, and that may have common fields for instance,
size of the packet or check sum for the packet
and so on. Those are common things that you can
eliminate when we are going across these layers. So the
header compression is another possibility for optimization. Another thing
that we always have to worry about, is making
sure that the code that we execute fits in
the caches and this has been something that we've talked
about all along when we talked about single node
systems to parallel systems. That locality enhancement, making sure that
the working set of whatever code that is executing
on a processor fits in the cache is very important.
So, this again is an opportunity by identifying common
code path across the different layers of the protocol
stack, and co-locating that common code path across the
layers. In order to make sure that we can
enhance locality for processing is another source of optimization
that is possible. This is all good. So there
are lots of opportunities for optimization but do it
by hand manually, that's tedious. So how do we
automate the process of optimization so that we don't have to do it manually?