author: | Dennis Windhouwer |
title: | The Modularity of the Resource Utilization Model in Python |
keywords: | |
topics: | |
committee: |
Mehmet Akşit
, Pim van den Broek , Christoph Bockisch , Steven te Brinke |
end: | December 2014 |
Description
Achieving green software by reducing its energy consumption is becoming more and more
important. One proposed method for achieving greener software is the resource
utilization model (RUM) [9], which aims to extend the software with energy optimizers. But, as one of the main problems software is facing today is complexity [16], the impact of these energy optimizers on the complexity of the software must be minimized. To reduce the
impact on the complexity of the software, the RUM method aims to modularize the
energy optimizers from the rest of the software, separating the functional concerns from the optimization concerns.
The RUM style distinguishes among three types of components. Functional components,
which each implement part of the functionality of the system. User components,
which represent usage scenarios for the system. And optimizer components, which
optimize the resource behavior. Functional and optimizer components need to
have suitable interfaces to each other, so that the optimizer components can
gather the information necessary to optimize the energy consumption, and so the
optimizer component can take the necessary actions to optimize the energy
consumption.
A functional component has a RUM, which represents the relations between the
services provided by the component and the resources which it requires. This
RUM has the form of a state transition diagram. A state transition diagram
consists of one or more states and the transitions between them. The RUM’s
states are annotated with resource behavior, describing how many resources they
consume and produce. Different states have different behaviors, switching
between these states thus modifies the resource behavior of the system.
Transitions between states can then occur after the invocation of one of a
component’s services. To ensure the separation of the functional concerns from
the optimization concerns, the RUM of a functional component needs to be
capable of intercepting these service invocations, allowing the RUM to execute
state transitions automatically, when applicable.
An optimizer needs to analyze the states, the resource consumption, and provided
services of a RUM in order to optimize the software and minimize the energy
consumption. The optimizer also needs to introspect the state transitions of a
RUM to determine which services it must invoke, so it can change the state of a
RUM from its current state, to another more desired state. These optimizer
components need to be interjected between other components at runtime. By
interjecting the optimizers at runtime, the separation of the functional
concerns from the optimization concerns can be ensured.
An implementation of the RUM style had not yet been realized, thus how modular a
program could actually be when it was implemented in this style, and the impact
of modularizing the energy optimizers from the rest of the software, was still
unclear. An investigation into suitable programming mechanisms and languages,
for the required functionality of a development environment for the RUM style, had
already been done [18]. One of the investigated languages was Python [6]. Python is a dynamically typed languages, which offers many options for meta-programming [1], and offers a lot of options for introspection and intercession. Python was found to offer suitable mechanisms for a development environment for the RUM Style.
Our goal is to investigate how modular a program can be when it is implemented in the RUM
style. In order to investigate this, we created a Python library for the RUM
style, using the mechanics which were found suitable in the previous
investigation. This library is capable of intercepting service invocations, so
a RUM’s state transitions can be executed automatically. Optimizer components
can also be interjected between any two components seamlessly, and the
optimizers can determine how they can trigger desired state transitions in
order to change the state of a RUM to a state with a more desired resource
behavior.
In order to investigate the modularity of the RUM style, we first implemented an example program in the object-oriented style, using design patterns [11]. A functionally similar program was then also implemented in the RUM style, using the created library. These programs were then compared on their modularity.