We have already said that a resource binding with a higher priority (higher number) is a request to prefer re-use of such a resource instance. But how are these preferences actually calculated?
Suppose our application requires resource classes
with re-use priority
, ...,
. Then
a resource handle (i.e. one previously used and still contracted
to us, but not currently in use by one of our netlets) gets a score
of
where each
is
a weighting as follows:
Beatrix does not try to split up old resource handles to create a new one with a possibly higher score, nor does it try any resource handles beyond the first one it finds. But whatever happens we get a resource handle with resource instances from all the resource classes we described, whether they are new instances or not.
For example, suppose our application requires disk with priority
8 and net with priority 10, and Beatrix has a resource handle
potentially for use on nodes N1, N2 and N3. N1 needs a new disk instance,
but the net instance is connected to that node. It gets score
.
N2 has the old disk space still connected on that node, but the net
instance could be moved back from N1. It gets score
.
Node N3 has none of the old disk or net instances, which need to be
created anew. It gets score
. Node N2 wins the
resource handle.
Nik Silver 2002-03-09