A runtime system, program product and method for determining a mode of
operation for a software component, comprises steps of a) running in a
first implementation mode; b) determining a first cost associated with
running in the first implementation mode; c) determining a second cost
associated with switching to a second implementation and running in the
second implementation mode; and d) comparing the first cost with the
second cost; and e) providing a recommendation to switch to the second
mode based on the comparison of the first cost with the second cost.
According to another embodiment a deterministic 3-competitive algorithm
is used to solve this problem. We also show that this matches the lower
bound, as any deterministic algorithm cannot be better than
3-competitive. According to another embodiment a probabilistic algorithm
is also used to solve this problem as well.