Ravenbrook / Projects / Memory Pool System / Master Product Sources / Design Documents
This document describes the design of a set of MPS message classes. The messages from these classes are emitted according to various important phases in a GC cycle; collectively they are called GC Messages.
The current classes are:
(new in gcgenmsg branch) These messages are generated once per GC at the start of a GC.
These messages are generated once per GC at the end of a GC.
The intended readership is project staff.
This document is not confidential.
This needs filling in. Taken as read and understood for now.
Note that some of the implementation (of mps_message_type_gc) pre-dates this design; it may not be documented accurately (or at all) here.
The primary requirement is:
MPS staff must be able to tell what collections are happening in order to be able to introspect about the overall MPS process.
This is so that bugs can be diagnosed and general MPS behaviour can be reasoned about. A typical problem is that a customer reports "Why when this collection happens doesn't this 20 MB of garbage get collected?". At a minimum we need to know what was condemned in any particular collection; it useful to know what is going to happen to survivors.
We meet part of that requirement by implementing a message that is generated per collection (mps_message_type_gc_start).
We have the following requirements on per GC messages:
Must be able to tell why we are starting a collection. See job000666 for why we start collections.
Messages in this class support:
Being able to tell why a collection is starting.
As well as TraceMessageStruct (for mps_message_type_gc) there will be a TraceStartMessageStruct. Could this be rolled into TraceMessageStruct? Not really (maybe with a redesign) as TraceMessageStruct is dynamically allocated as the message is posted to the arena queue (at the end of the trace).
int mps_message_type_gc_start()
Public interface. Returns the MPS message type.
const char *mps_message_gc_start_why(mps_arena_t,
mps_message_t)
Public interface. Returns a pointer to a string that is a textual explanation of why this collection is starting.
The contents of the string must not be modified by the client. The
string and the pointer are only valid as long as the message has not
been discarded (with mps_message_discard
).
amcss already collects and reports mps_message_type_gc. It should be simple to extend it to mps_message_type_gc_start and mps_message_type_gc_generation.
Using amcss might not give a very good coverage. In particular not all the available reasons will appear. Perhaps a more dedicated test should be written.
This section for historical interest only.
A proposal to more fully meet the primary requirement by implementing a message that is generated per generation per collection (mps_message_type_gc_generation) has not been implemented, but the requirements have been retained here:
We would have the following requirements on per generation messages:
Must be able to tell for any generation whether it is condemned for each collection that occurs. In practise, due to the flexible nature of the MPS, a generation might not be either all-condemned or all-foundation for any particular collection. In particular the commonest sort of collection (collections driven by allocation in the nursery generations) will condemn a particular set of zones. There may be generations which have some object in one zone and some objects in another; they may have only some of their objects condemned by a per zone condemnation strategy.
For each generation for each collection we would like to know the following:
Number of bytes condemned in this generation.
Number of bytes occupied by objects and not condemned.
Where survivors are going (that is, what generation are survivors are being promoted to.
(Not essential) Other byte counts for this generation: How much free space there is, how much overhead there is.
2003-02-17 | DRJ | Created. |
2006-12-07 | RHSK | Remove mps_message_type_gc_generation (not implemented). |
2007-02-08 | RHSK | Move historically interesting requirements for mps_message_type_gc_generation (not implemented) to the end of the doc. |
This document is copyright © 1995-2002, 2006-2007 Ravenbrook Limited. All rights reserved. This is an open source license. Contact Ravenbrook for commercial licensing options.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
This software is provided by the copyright holders and contributors "as is" and any express or implied warranties, including, but not limited to, the implied warranties of merchantability, fitness for a particular purpose, or non-infringement, are disclaimed. In no event shall the copyright holders and contributors be liable for any direct, indirect, incidental, special, exemplary, or consequential damages (including, but not limited to, procurement of substitute goods or services; loss of use, data, or profits; or business interruption) however caused and on any theory of liability, whether in contract, strict liability, or tort (including negligence or otherwise) arising in any way out of the use of this software, even if advised of the possibility of such damage.
$Id: //info.ravenbrook.com/project/mps/branch/2003-02-17/gcgenmsg/design/message/index.html#1 $
Ravenbrook / Projects / Memory Pool System / Master Product Sources / Design Documents