X hits on this document

PDF document

Program Transformations for Light-Weight CPU Accounting and Control in the Java Virtual Machine A ... - page 12 / 40





12 / 40


3.4. Aggregating CPU Consumption

Normally, each ThreadCPUAccount object refers to an implementation of CPUManager, which is shared between all threads belonging to a component. The CPUManager implementation is provided by the mid- dleware developer and implements the actual CPU accounting and control strategies, e.g., custom scheduling schemes. The methods of the CPUManager interface are invoked by the triggerConsume() method of ThreadCPUAccount. Figure 5 shows part of the CPUManager interface.

public interface CPUManager { public void consume(long c); public int getGranularity(); ...


Figure 5. Part of the CPUManager interface.

For resource-aware applications, the CPUManager implementation may provide application-specific interfaces to access information con- cerning the CPU consumption of components, to install notification callbacks to be triggered when the resource consumption reaches a certain threshold, or to modify resource control strategies. Here we focus only on the required CPUManager interface.

The intended semantics of consume(long c) has already been pre- sented. The getGranularity() method has to return the accounting granularity currently defined by the given CPUManager for the call- ing thread. The accounting granularity defines the frequency of the management activities, and may be adapted at run-time, e.g. to make low-priority threads check often enough if they should yield the CPU in favour of threads with imminent deadlines. The range of legal values the granularity may take is however also bounded by choices made during the code transformation, as explained in the next section.

Further details and examples concerning the management of CPUManager objects, and the association of ThreadCPUAccount objects with CPUManager objects can be found in our previous work [4].

3.5. Triggering Delay

The delay until a thread triggers the consume(long c) method of its CPUManager is affected by the following factors:

1. The current accounting granularity for the thread. It is pos- sible to allow the granularity to range all the way up to Integer.MAX VALUE, i.e., 231 1, but it may be further restrained

Document info
Document views156
Page views156
Page last viewedMon Jan 23 06:28:58 UTC 2017