Resource management (i.e., accounting and controlling the consumption of resources, such as CPU and memory) is extremely useful for monitoring deployed software. Run-time monitoring of server systems is important to quickly detect performance problems and to tune the system according to the workload. Resource management also is a prerequisite to prevent malicious or accidental resource overuse, such as denial-of-service attacks, in extensible middleware that allows hosting of foreign, untrusted software components. In commercial application servers, providers may charge their clients for the resources consumed by executed software components; the corresponding contracts should then state the maximal quantities of computing resources that the client is allowed to use, preferably in terms of platform-independent metrics such as the number of executed bytecodes. In emerging agent-oriented, context-aware software systems, self-tuning abilities are expected; these will in turn require awareness of resource availability and usage policies. Lastly, in resource-constrained embedded systems, software has to be aware of resource restrictions in order to prevent abnormal termination.
Currently, predominant programming languages and environments, such as Java [19] and the Java Virtual Machine (JVM) [26], lack standardized resource management mechanisms. Whereas some prototypes have been proposed to address this lack (see the related work section), they are unfortunately all dependent on substantial amounts of native code, and thus prevent the deployment of resource-managed or resource-aware systems throughout widely heterogeneous networks. Therefore, we propose portable resource management with the aid of program transformations. We call our approach J-RAF2 (Java Resource Accounting Framework, 2nd edition) [4, 7, 21], which has been implemented in a tool with the same name.1 J-RAF2 is independent of any particular JVM and underlying operating system. It works with standard Java runtime systems and may be integrated into existing server and mobile object environments. Furthermore, this approach enables resource control within embedded systems based on Java processors, which provide a JVM implemented in hardware that cannot be easily modified [8].