last edited May 17, 1983 12:25 pm by Paul Rovner
DIRECTORY
PrincOps USING[PsbIndex],
Process USING[GetCurrent],
RTRefCounts USING[InternalReclaim];
RTStorageAccounting: DEFINITIONS
IMPORTS Process, RTRefCounts
TYPES
PSBIMap:
TYPE =
RECORD[elements: SEQUENCE maxLength: [0..LAST[PrincOps.PsbIndex]+1] OF CellCount];
CellCount: TYPE = RECORD[total, current: LONG INTEGER];
CONSTANTS
defaultCollectionInterval: LONG CARDINAL = 40000B;
VARIABLES
nWordsRequested: LONG CARDINAL;
nWordsAllocated: LONG CARDINAL;
SUMnWordsAllocated: LONG CARDINAL;
nObjectsCreated: LONG CARDINAL;
MapPsbiToWordsAllocated: LONG POINTER TO PSBIMap;
CollectionInterval: LONG INTEGER;
SuspensionThreshold: LONG INTEGER;
PROCS
ResetNWordsAllocated: PROC;
ResetTotalNWordsAllocatedOnly: PROC;
ConsiderCollection: PROC[requestedWords, suppliedWords: LONG CARDINAL] =
INLINE {
psbi: PrincOps.PsbIndex = LOOPHOLE[Process.GetCurrent[]];
nw: LONG INTEGER ← MapPsbiToWordsAllocated.elements[psbi].current + suppliedWords;
MapPsbiToWordsAllocated.elements[psbi].current ← nw;
nWordsAllocated ← nWordsAllocated + suppliedWords;
total count for all processes since the last colection
nWordsRequested ← nWordsRequested + requestedWords; -- total count for all processes
IF
LOOPHOLE[nWordsAllocated,
INT] >= CollectionInterval
THEN RTRefCounts.InternalReclaim[allocationInterval, nw > SuspensionThreshold];
};
END.