• Tidak ada hasil yang ditemukan

Maintaining Locality Among Object References

Dalam dokumen Homogeneous, Concurrent Architecture (Halaman 166-170)

Chapter 5: A Localized, Virtual Object Environment

5.2 Maintaining Locality Among Object References

The most immediate need for moving objects from one processor to another occurs when objects are being created in one processor and it exhausts its heap area. We assume here that objects are always created in the same processing node as their creator but may be subsequently moved.

When a processing node runs out of some resource, such as memory, it mu8t be able to send excess objects to another processor. Some of the objects

may be garbage but cannot be presumed garbage until the garbage collection algoritb.Jil completes its current cycle.

If objects cannot be moved between processors. there can be_ little opportunity for concurrency, since the objects will have to share a single processor. A message from an object that requires no response cannot cause real concurrent behavior unless the source and destination objects are in different processors. If, on the other hand, two objects consistently communicate with messages requiring a response, then it is desirable to place the objects in the same processor to minimize communication costs.

The motion of other objects and reference variables in the system may result in excessive communication costs between objects. If several closely related objects reside in distant processing nodes, there will be a longer communication delay between them and more message traffic generated than if the objects were resident in neighboring processors.

In data flow programs the objects or operators of the program are fixed and communicate with each other by a fixed topology. For such systems, a resource assignment can be worked out in advance of the program execution to assign the operators to various processors in such a way as to minimize the cost of communication i.n the program. The work of [WuBO] presents an algorithm for this purpose.

In the object-oriented environment, the topology of the communication changes as new objects are created, as old objects are removed and as reference pointers are exchanged between objects. This dynamic behavior requires a dynamic, run-time means of preserving some level of locality between related objects. To make decisions concerning which objects to move and where to move them, some measure of communication costs must

be accumulated for each object. Storing and updating such data will, of course. consume resources.

Each object can have associated Vvith it a quantity for each port of the processing node. Each port can be thought of as a direction in N-space. If the quantity is constantly updated to reflect the amount of message traffic to the object in each direction, a determination can be made of whether the object should be moved. If one or more of the directional costs becomes sufficiently larger than the others, it is an indication that a closely related object resides in the associated direction. The object can then be moved to the neighboring node in that direction, placing it closer to the source of the message traffic.

Many heuristic schemes can be developed to make selections based on such data. Here we present a simple scheme using several controlling constants to regulate the policy of the decisions. With each object there is

a

list of logN

+

1 variables. The additional quantity is associated Y•ith traffic within the object's processor, the other quantities are each associated with a commUi.J.ication port.

where d

=

log2(num,ber

of

processors)

As the machine runs, the quantities are updated in the following manner. This task could be done by the communication processor or by special purpose hardware to avoid unnecessary load on the the object processor.

Far a Message an Part j

MsgLength

Xj (-- x; + Rate

Rate is a constant controlling how quickly xi responds to message traffic. A large value will reduce the effect recent traffic might have on the value of xi.

As execution proceeds, xi will rise -vvith message traffic. If resources are needed, or other factors warrant it, the objects may be tested in the following manner to find candidates to be moved. A threshold value T is first computed.

T - Resist~

- LJ:i;

d i=O

Resist is a constant controlling how strongly objects resist motion. Resist would usually be greater than 1. with larger values causing objects to move less frequently for identical message traffic. The quantity T is a threshold against which the individual xi are tested. If any xi exceeds T then the object vvill be moved. The largest xi selects the direction in which the object is to be moved. The object is sent to the neighboring node connected to tb'e port associated with the xi and when it arrives all its xi are set to zero.

To accommodate the needs of concurrency, a modification of this procedure will push concurrent objects away from each other and attract non-concurrent objects. If x0 is incremented only when the message does not require a response, then x0 will become a measure of lost opportunities for concurrency. Thus, if x0 both exceeds the threshold and is the largest xi then it indicates the object should be moved out of the processor it now resides in and moved to one close by to take advantage of concurrency. If x1

is incremented only for messages that require a response, then concurrently executing objects will not generally be moved into the same processor.

To prevent instabilities in the system, such as, objects chasing each other or oscillating between processors, they must be given inertia. A simple

th"Ile-of-day stamp on the object, made each time the object is moved, would prevent the object from again being moved until a specific period of time had elapsed. The period of time could be computed based on past behavior or could be a constant. Too rapid movement of objects would consume excessive communication bandwidth and adversely affect the ability of the system to locate specific objects.

Variations in the controlling constants and in the details of the procedure permit it to be adapted to a range of object environments. Before machines of the type described here are built and programmed. it will be very difficult to predict the effectiveness of heuristic methods such as these.

However, it is clear that tl-iis method is one that could dynamically preserve the locality of reference in such a system. Since it makes its decisions on purely local data it will scale well in progressively larger machines.

Dalam dokumen Homogeneous, Concurrent Architecture (Halaman 166-170)