The present invention relates generally to home gateways, and more particularly, to an efficient method for managing application services in a limited memory environment, such as a home gateway.
With the widespread introduction of broadband to homes, the Internet is becoming more and more popular inside homes. The Internet is used not only for connecting computing devices, but also for accessing home appliances, such as TVs, DVDs, washing machines, etc. In the near future, it is expected that many home appliances will be connected to the Internet. Remote diagnosis and configuration of these appliances is one of the many advantages that the consumer can gain from Internet connectivity. Power companies are also keeping an eye on home networking because it will allow them to provide value-added services such as energy management, remote measurement, and better power balance that reduces the likelihood of blackout.
There are several initiatives to define a specification and protocol for networks residing in the home environment, including OSGi, HAVi, UPnP, Jini, and HomeRF, to name a few. It is expected that such home networking will inter-operate through a home gateway. The home gateway serves as a single point of connection between the Internet and the home. Services are implemented in software bundles that can be downloaded separately from the Internet and then executed in the gateway.
There is not consensus among the industry on whether the home gateway will be integrated into existing home appliances, distributed among several home appliances, or centralized in a separate computing device. In either case, the home gateway will more than likely have limited resources, especially main memory.
Conventional memory management techniques are not necessarily suitable for home gateways. For instance, the memory unit in a conventional computing environment is the disk page. Conventional memory management techniques typically assume that disk pages are independent.
In contrast, the services in a home gateway may not be independent, but rather can depend from each other. In other words, terminating a service will in effect terminate all of the services that depend on that service. Because of service dependencies, traditional memory management techniques are not suitable to the gateway environment.
Therefore, it is desirable to provide an efficient method for managing application services in a limited memory environment, such as a home gateway.
In accordance with the present invention, a method is provided for managing memory resources in a service gateway environment. The method includes: receiving a service request, the service request having an associated memory space requirement that exceeds total available memory space associated with the gateway environment; determining a number of dependent service instances for each service instance; determining an accumulative memory space requirement for each service instance; identifying a subset of service instance whose memory space requirement exceeds the memory space requirement of the service request, the subset having a minimal number of the service instances; and performing a memory resource management operation in relation to the identified subset of service instances.
For a more complete understanding of the invention, its objects and advantages, reference may be had to the following specification and to the accompanying drawings.
In a service gateway environment, applications are designed as a set of services (S), with each service (S) implementing a segment of the overall functionality. These services (S) and other extension services are then packaged into a software container called a bundle (B). In one example, the bundle (B) includes the service 12, which, for example may be any of the following services (S): a HTTP service (S), a Log service (S2), a device access (S3), a unified messaging (S4), a security monitor (S5), the extension services and/or other suitable services (S6), as illustrated in
To accommodate a new service, the gateway might need to free memory space associated with the gateway. Although the amount of memory required to execute a service is changing with time, the application service provider (or the author who provides the bundle) can give approximate estimates such as average and maximum amount of memory required to execute the services in a bundle. At this time, the framework has to pick a victim service instance or instances to terminate in order to fulfill the request. It is envisioned that the victim service instance might be the requesting service.
This memory resource problem is further illustrated by the example set forth in
A request is made for a third service. The third service is a home security 29 service which requires 100 memory units. Assume that the memory space requirement for the home security service exceeds the total available memory space associated with the gateway environment. Lets further assume that the home security service has a higher priority than the audio-on-demand service and the game service. Therefore, at least one of the services must be terminated to meet this request. In this example, the equalizer service 26 should be terminated because it fulfills the memory space requirement and minimizes the number of service instances that are terminated.
A formal description of the problem is set forth below. The set of service instances currently resident in gateway memory may be defined as S={si, . . . , sj}. A dependence graph may be used to model the dependencies among bundles, where one bundle imports a service provided by another bundle. For example, let G(S,E), be a directed acyclic graph with vertex set S and edge set E, describing the dependence among the service instances. There is a directed edge (si, sj)∈E if and only if si depends on sj. Since it is natural to assume that each application instantiates its own copy of a given service, the dependence graph will consist of a forest of rooted trees, where each tree represents the service instances instantiated by a given application. For a vertex v in G, let us denote by T(v) the set of vertices of the sub-tree of G rooted at v (including v itself), and for a subset of vertices V⊂S, let T(V):=Uv∈VT(v).
Given that a new service instance s, with a memory space requirement M(s), is to be created, it might be required to terminate some existing service instances in order to make room for the new instance. Assume that the additional memory required for this operation is Mi units, where Mt=M(s)−Mf, and Mf is the current amount of available memory space. When a service instance is terminated, all instances depending on it will also be terminated. Therefore, the objective is to reduce the number of terminated service instances. More precisely, it is desired to find a subset V⊂S of minimal number of dependants, whose termination, together with all its dependants, will make available a total memory space of at least Mt units. Letting M(S):=Σs∈S′M(s) for any S′⊂S, the problem can be formulated as of finding min{|T(V)|:V⊂S, M(T(V))≧Mt}. In other words, the problem is to identify a minimal number of service instances whose memory space requirement exceeds the memory space requirement of a service request.
Referring to
First, an accumulative memory space requirement, M(s*), is determined at step 34 for each service instance resident in the gateway environment. The accumulative memory space requirement for a given service instance accounts for the memory requirement for the given service instance and each of the service instances depending from it. Thus, accumulative memory space is computed by summing the memory space requirements for the given service instance with the memory space requirement for each of the service instance that depend from it.
Second, the number of dependent service instances, s*, is determined at step 36 for each service instance. A data store generally maintains dependency information for each of the service instances currently resident in the gateway environment. In an exemplary embodiment, the number of dependent services instances may be retrieved from a data store associated with the environment. For each service instance, the data store may include an identifier for a given service instance, the accumulative memory space requirement for the given service instance, and the number of service instances that depend from the given service instance. Although presently preferred, it is envisioned that other techniques may be employed for determining the accumulative memory space requirement and number of dependencies for each service instance.
Third, a ratio is computed for each service instance at step 38. The ratio is further defined as the accumulative memory space requirement for a given service instance divided by the number of dependent service instances for the given service instance. Maximizing this ratio tends to decrease the number of terminated service instances.
Lastly, a memory resource operation is then performed at step 39 in relation to the service instance having the largest ratio. Specifically, the service instance having the largest ratio and each of the services instances that depend from it are terminated. If two service instances have the same ratio, then the service instance having the fewest dependencies is selected for termination. One skilled in the art will readily recognize that the data store that maintains dependency information for each of the service instances is updated to account for the terminated service instances.
In some instance, the accumulative memory space requirement for the terminated service instance (and its dependents) may not exceed the requested memory space. In this case, the above-described process is repeated, thereby terminating additional service instances. On the other hand, once the total available memory space is equal to or exceeds the memory space requirement of the service request, the service request is satisfied.
There is also a natural generalization of problem set forth above. Suppose that different service instances differ in importance and, therefore, are assigned different priorities. In such a case, it is reasonable to assign a weight W(s) to each instance. Instances with large weights are considered more important. When it is necessary to eject some instances from memory, it is desirable to reduce the number of deleted high priority instances. Thus, the problem now becomes of finding min{W(T(V))/V⊂S, M(T(V))≧Mt}.
In the absence of dependencies, this problem is closely related to the well-known Knapsack problem. The Knapsack problem admits a pseudo polynomial algorithm which runs in O(n2W), where W is the maximum weight. Even in the case of dependencies among service instances, a similar result holds for this problem as shown below.
In view of the foregoing, an alternative method is presented for managing memory resources in a limited memory environment, such as a service gateway. Referring to
An accumulative memory space requirement, M(s*), is first determined at step 44 for each service instance resident in the gateway environment. Next, an order is determined at step 46 for traversing the service instances in the gateway environment. The service instances are preferably traversed recursively in a post-order. Specifically, let S=Sn={s1, . . . , sn} be the current set of service instances listed in post-order traversal (that is, recursively traverse the children from left to right then traverse the root). Consider incrementally the sets S1={s1}, S2={s1, s2}, S3={s1, s2, s3}, . . . , computing for each set the maximum amount of memory that can be achieved by deleting a subset of service instances at given number of dependents. In order to compute these maxima, compute for each node si, the largest index k∈{1, . . . , i−1} such that Sk is not a descendant of si. Let L(si) denote such an index. The procedure gives the post-order traversal of a given forest and computes the required indices L(si) for each i=1, . . . , n.
For instance, an exemplary procedure for post-order traversal of a given subtree of the dependence forest G rooted a v and an integer k, is as follows:
If the connected components of the forest G are C1, C2, . . . , Cr, then in order to compute the post-order traversal for G, the above procedure is called r times:
Returning to
The dynamic programming table is constructed such that each row of the table correlates to a subset of service instances in accordance with the post-order and each column correlates to a number of service instances that are to be deleted from the subset. Specifically, A(1, w) is known for every w∈{1, . . . , n}; whereas the other values of A(i, w) can be computed incrementally using the following recurrence: A(i+1, w)=max{A(i, w), M(si+1)+A(L(si+1), W−|T(Si−1)|)}, if |T(si+1)|<w and A(i+1, w)=A(i, w) otherwise. As a result, each entry in the table indicates a maximum amount of memory space that can be attained by deleting the corresponding number of service instances from the corresponding subset of service instances. An exemplary dynamic programming table is shown in
Lastly, one or more service instances are identified using the dynamic programming table at step 50. In particular, the service instances are identified by evaluating from left to right the bottom row of the table. The first table entry whose value (i.e., memory space) exceeds the memory space of the service request is selected, where the table entry correlates to a subset of service instances with with a number of service instances to be deleted. The corresponding subset of service instances are then deleted at step 52, thereby fulfilling the service request.
A more formal description of this alternative algorithm is as follows:
The foregoing discloses and describes merely exemplary embodiments of the present invention. One skilled in the art will readily recognize from such discussion, and from accompanying drawings and claims, that various changes, modifications, and variations can be made therein without departing from the spirit and scope of the present invention.
Number | Name | Date | Kind |
---|---|---|---|
5682530 | Shimamura | Oct 1997 | A |
6356978 | Kobayashi et al. | Mar 2002 | B1 |
20010034758 | Kikinis | Oct 2001 | A1 |
20010034759 | Chiles et al. | Oct 2001 | A1 |
20010036192 | Chiles et al. | Nov 2001 | A1 |
20020002608 | Aspromonte et al. | Jan 2002 | A1 |
20020099627 | Igi et al. | Jul 2002 | A1 |
20020120685 | Srivastava et al. | Aug 2002 | A1 |
20030154346 | Gruner et al. | Aug 2003 | A1 |
Number | Date | Country | |
---|---|---|---|
20030154356 A1 | Aug 2003 | US |