Let's now talk about the implementation of clustered
objects. Given an object reference, there is a
data structure in the operating system called the
translation table and the translation table maps an
object reference to a representation in memory. So,
when you have an object reference presented to
the operating system that can pointed to the
particular representation. Remember that the reference itself is common,
the same object reference may be pointing to this replica
on a particular processor, a different replica on a different
processor, and so on. That's a function of the translation
table, so on each CPU, this is what happens. When
an object reference is presented, the operating system converts it
to a representation. And this is a normal operation. Now,
you present an object reference but that object reference may
not be in the translation table yet, because this object
has not been referenced so far. In that
case, you'll have a miss in looking up the
translation table. And if a miss happens, then
there is another data structure in the operating system
called the miss handling table. And the miss
handling table is a mapping between the object reference
that you are presenting and the handler that
the operating system has for dealing with this missing
object reference. Because if an object reference is
missing, then the operating system has to find some
way to make this reference point to a
representation. So that's the focus of this object miss
handler. What this object miss handler does is
it knows the particular representation for this reference. And
it is also going to make a decision.
Should this object reference point to a representation that
is already existing or should it create a
new representation for it? All of those decisions are
going to be taken by this object miss handler.
Once it takes the decision, it creates a representation
for this object reference and it installs the
mapping between this object reference and this representation in
the translation table. So that subsequently, when you present
the object reference, it'll go to the particular representation
for that particular object reference. So that's the
work done by the object miss handler. And,
so this happens on every translation miss. And
the object reference is locally resolved in this case
because the object miss handler is locally available
and it can handle that. But it can happen
that the object miss handler is not available
locally. Now how will that happen? Well, the idea
is that the miss handling table itself is
not a replicated data structure. It's a partitioned
data structure. Remember that all of these are
things that are being done under the cover
to implement the idea of a clustered object.
So, if you think about the region object
that we talked about. The region object is
something that is not going to be accessed
on every processor because, depending on the threads
that are executing in a particular region, those
are the threads that need to access the
region object. And therefore, this miss handling table is
a partition data structure that contains the mapping
between object references and the miss handlers that
correspond to those object references. So in this
particular example that I give you, the miss handling
table happens to contain the miss handler for
this particular object reference. It is possible that
when an object referenced is presented in a
particular processor, the object miss handler is not local,
because the miss handling table is a partitioned
data structure. What happens in that case? Well,
that's why you have a notion of a global miss handler, and the idea here is if
the miss handling table does not have
the miss handler for that particular object reference,
then you go to a global miss handler. This is something that is replicated on
every node. Every node has its global
miss handler. And this global miss handler knows
exactly the partitioning of the miss handling table.
So it knows, how this miss handler table
has been partitioned and distributed on all the nodes
of the multi-processer. And so, if an object reference is
presented on a node, the translation table will say, well,
you know, this particular object reference, we don't know how
to resolve it because the object miss handler doesn't
exist here. And therefore, we're going to go to this
global miss handler. And the global miss handler, because it
is replicated on every node, it says, oh, I know
exactly which node has the miss handling table
that corresponds to this object reference. And so it
can go to that node. And from that node it can obtain a replica, and once it
obtains a replica, it can populate it in
the translation table for this particular node. And once
it populates it, then we are back in
business again, as in this case. So, the function
of the global miss handler is to resolve the
location of the object miss handler for a particular
object reference i. So given an object reference i,
if you have no way of resolving it locally,
then the global miss handler that is present on
every node can tell you the location of the
object miss handler for this particular object, so that
he can resolve that reference, get the replica for it,
install it locally, populate the translation table,
then you're back in business again. So what
this workflow is telling you is how incrementally
the Tornado system can optimize the implementation of
the objects. So depending on the usage pattern,
it can make a determination that I used
to have a single replica, it is now
accessed on multiple nodes. Maybe I should really
replicate it on multiple nodes. So that's a decision that can be taken
during the running of the system on the usage pattern of the different objects.