On Models for Object Lifetime Distributions (Short Paper)

On Models for Object Lifetime Distributions (Short Paper)

On Models for Object Lifetime Distributions (short paper) Darko Stefanovi´c Kathryn S. McKinley J. Eliot B. Moss g [email protected] fmckinley,moss @cs.umass.edu Department of Electrical Engineering Department of Computer Science Princeton University University of Massachusetts Princeton,NJ08544 Amherst,MA01003 Abstract. Analytical models of object lifetimes are ap- rive at a discrete distribution. Most performance-related pealing because they would enable mathematical analysis or propositions have dealt with mortality, which is a deriva- fast simulation of the memory management behavior of pro- tive form; since obtaining a derivative of a discrete ob- grams. In this paper, we investigate models for object-oriented served function involves inherently arbitrary smoothing programs such as Java and Smalltalk. We present analyti- decisions, it has been difficult to characterize the mor- cal models and compare them with observed lifetimes for 58 tality of observed distributions, let alone to match it to Smalltalk and Java programs. We find that observed lifetime an analytical model. The extremely fast decay of ob- distributions do not match previously proposed object lifetime jects exacerbates the situation: most models developed in models, but do agree in salient shape characteristics with the other domains are for much more slowly decaying pop- gamma distribution family used in statistical survival analysis ulations. for general populations. If we knew which distribution family describes typi- cal object behaviors, we could fit observed lifetimes to 1 Introduction the model of that family, and find the best matching in- stance (i.e., its parameters). In fact, a running program If we can develop accurate analytical models for object could recognize the lifetime distribution of objects allo- lifetimes in object-oriented programs, they would enable cated (overall, or at a particular allocation site) and adjust faster and more thorough exploration of memory man- collection policies accordingly. But it is not yet known agement techniques. For instance, given a model of ob- which family this may be. ject lifetimes, we could compute an estimate of copying In the following, we first briefly introduce terms and costs of a generational or some other garbage collector. notation related to lifetime distributions (with more de- If distribution models and garbage collector models are tails in the Appendix), then review what assumptions simple enough, we may even arrive at closed-form an- have been made implicitly (or stated explicitly) in the alytical descriptions; but even if both are quite compli- past research in garbage collection. We develop models cated, we can use the lifetime distributions to drive sim- based on a plausible qualitative characterization of life- ulations of a proposed garbage collector scheme. times; namely, that past lifetime is a strong predictor of Lifetime models are not sufficient for exploring future lifetime. Lastly, we put the models to the test of garbage collection, because they do not account for heap empirical evidence against actual lifetime distributions pointer structure effects: the direct cost of pointer main- from object-oriented programs. tenance (including write barriers), and the copying cost increase owing to the excess retention of objects, both present in generational schemes. Nevertheless, they could be useful as a tool for preliminary evaluation (and 2 Background material understanding) of collector performance. Observed object lifetime behaviors are inherently dis- The lifetime of an object is defined as the amount of al- crete; we measure the lifetime of each object and ar- location that occurs between the allocation of the object and its demise.1 We view object lifetime as a random derstanding of his statement of the weak generational variable. Future studies may look at object lifetimes as hypothesis is this: newly created objects have a much stochastic processes, and in this context, distinguish each higher mortality than objects that are older. His state- allocation site as generating different processes. Here, ment of the strong generational hypothesis (which he in we do not attempt such fine distinctions. fact introduces) is that even if the objects in question are Actual object lifetimes are natural numbers, thus dis- not newly created, the relatively younger objects have a crete probability distributions are the obvious represen- higher mortality than the relatively older objects, or sim- µ tation. However, continuous models are used for math- ply, that m´t is an everywhere decreasing function. ematical ease and convenience. Below we review some Baker clearly pointed out that an exponential distri- µ definitions and symbols from probability theory as they bution of lifetimes, with m´t constant, cannot be fa- apply to survival analysis; further details appear in the vorable to generational collection (as opposed to whole- µ Appendix along with a summary of properties of com- heap collection), and that instead m´t should be de- monly used analytical distribution families. creasing [Bak93]. Nevertheless, the exponential distri- The survival function of a random variable L is bution has a unique cachet among survival distributions: µ ℘f > g sL ´t L t . For object lifetimes, it expresses what its mathematical simplicity and the property of “lack of fraction of original allocation volume is still live at age t. memory”. In a garbage collector this property assures We usually drop the subscript L. The survivor function that an object just discovered live by the collector has is a monotone non-increasing function. The probability the same residual lifetime as the lifetime of a newly al- ¼ ´ µ µ density function is f ´t s t . Occasionally we also located object, and this greatly simplifies the analysis. µ ´ µ use the cumulative distribution function F ´t 1 s t . Thus, the exponential distribution was used by Clinger µ f ´t d µ ´ µ The mortality function is m´t logs t , and and Hansen in the analysis (and to inspire the design) of µ s´t dt it expresses the age-specific death rate. Mortality is also a non-predictive collector, outside the generational realm µ known as the hazard function (and written h´t ) in the [CH97]. In our examination of a generalized form of that literature on lifetime analysis [CO84]. collector [SMM98], we decided to use not only the expo- ρ t µ nential distribution s´t e , but also a variation with Ô ρ t µ decreasing mortality s´t e as being in agreement 3 Previous statements about object with the strong generational hypothesis, as well as a vari- 2 ´ρ µ t µ lifetime distributions and their in- ation with increasing mortality s´t e for control. In fact, these three are instances of the Weibull distribu- c ´ρ µ fluence on garbage collection perfor- t µ tion s´t e [Wei61, Lem82]. mance Object lifetime distributions have been of interest to re- 4 Models derived from the qualitative searchers of garbage collection, especially generational assertion that “past is like the fu- collection: the success of a particular garbage collector ture” organization or promotion policy depends on how well it is matched to the behavior of typical user programs. In A multitude of models can be developed that have de- fact, claims have been made about lifetimes. creasing mortality. But developing them ex vacuo, just Hayes introduced a distinction between a “weak” and for the simplicity of their mathematical formulation (or a “strong” generational hypothesis [Hay91].2 Our un- their use in other domains) is not satisfactory. We can 1The actual point of demise depends on the accuracy of the mem- base models on a broad experimental study, and in Sec- ory management scheme. In the empirical data reported here, that tion 5 we make a first attempt at that. But, our un- scheme is an accurate-roots garbage collector performing full-heap derstanding would be aided more if distribution models collection at each object allocation. Thus, demise is detected pre- could be derived from certain principles that we expect cisely at the point when the object becomes unreachable from the to be naturally associated with program behavior. In this global roots. 2Unfortunately, the paper could be easily misinterpreted, since vein, Appel suggested that plausible object lifetime dis- the term “survival rate” was used both for “the reciprocal of mortal- tributions should satisfy the following: ity” and “the amount copied from a generation”, depending on the context. (1) An object’s future expected lifetime is pro- 2 portional to its current age. [App97] so that β λ Thus, past lifetime is a strong predictor of the future 1 µ ´ · τµ ; s´t t (residual) lifetime. This stands in stark contrast with the λ 1 exponential distribution. where λ > 2. Normalization: µ An object’s future expected lifetime C ´x is the differ- ence between its expected lifetime and its current age. β λ τ1 ´ µ The expected lifetime (once we know its current age) 1 s 0 λ 1 is the conditional expected value [Pap91] of the lifetime j > ℄ random variable L, E L L x , where x is the current gives age. It is calculated as: =´ λµ Z ∞ 1 1 λ 1 : τ j > ℄ ´ j > µ E L L x t f t t x dt β 0 Ê ∞ µ x t f ´t dt Ê ∞ We find µ x f ´t dt Ê ∞ µ x t f ´t dt 1 1 λ λ : 2 1 µ β ´ · τµ τβ ´ · τµ : G´x x x µ s´x λ λ 2 1 µ j > ℄ Thus C ´x E L L x x, and statement (1) is: Expected value ´9ψ > µ´8 > µ ´ µ ψ ; λ 0 x 0 C x x 2 λ 1 1 λ 1 ℄ ´ µ β : E L G 0 λ µ´λ µ β with ψ a proportionality constant between the current ´ 2 1 µ age x and the future expected lifetime C ´x .

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    8 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us