From: SMTP%"MACRO32%WKUVX1.BITNET@uu7.psi.com" 10-AUG-1993 08:41:00.44 To: EVERHART CC: Subj: RMS Global Buffer Replacement Strategy X-Listname: "VMS Internals, MACRO, & BLISS Discussions" Warnings-To: <> Errors-To: MacroMan%WKUVX1.BITNET@uu7.psi.com Sender: MacroMan%WKUVX1.BITNET@uu7.psi.com Date: Tue, 10 Aug 1993 10:30:13 EDT From: Franz Schoenbauer Reply-To: MACRO32%WKUVX1.BITNET@uu7.psi.com To: MACRO32@WKUVX1.BITNET Cc: system@EIMONI.TUWIEN.AC.AT Message-Id: <00970CF1.CD2C6740.3893@EIMONI.TUWIEN.AC.AT> Subject: RMS Global Buffer Replacement Strategy Has anybody taken a look at the algorithm that transfers RMS Buckets into and out of the global buffer list ? As far as i can determine for VMS 5.5-2, the replacement strategy is as follows: The Global Buffer Section is divided into 3 segements: - the global buffer header (GBH) - the global buffer descriptors (sp ?) (GBD) - the Buckets themselves (called GB) The GBDs are organised as a double linked list sorted by VBN of the bucket. Each GBD contains e.g. forward and backward pointers to other GBDs, a pointer to the Bucket, a CACHEVAL that is initialized with that buckets index depth (in our case a number between 0 (Data Bucket or SIDR Bucket) and 2-3 for the root bucket for a given RMS-Key, the key number, the VBN of its Bucket etc. The GBDs are contiguous within the Global Buffer section and have a fixed size. The GBH contains a pointer to the first GBD. If a new bucket with VBN XXX is requested, the GBD list is scanned sequentially in sort order from the start, until the VBN in the GBD is greater than XXX, or the end of the list has been reached. If a GBD with VBN XXX was found, the bucket is used. Otherwise the bucket with VBN XXX has to be read in from disk, into a GB. If there are free GBDs, one of them and its associated GB are used, otherwise a victim must be chosen to make room for the new bucket. Victim selection: The GBD list is treated as an array, without regard to the order by VBN imposed by the foreward/backward pointers. A pointer into the GBD array is maintained (called RP), initialized with the first element in the array. RP is where the victim search starts. The GBD pointed to by RP and the 7 following GBDs (wrapping around to the beginning of the array) are examined. If a CACHEVAL of 0 is found (meaning a Data Bucket or a SIDR Bucket), that GBD and its GB are used). If no CACHEVAL 0 is found, the GBD with the lowest CACHEVAL is used. In both cases the CACHEVAL of the GBD pointed to by RP is decremented by one if not alreay Zero. (NOTE: this is of course useless if the GBD pointed to by RP is the Victim, as its field will be initialized later) Then RP is updated to point to the next GBD (not in sort order, but next in virtual Memory). (NOTE: this is quite strange when the victim was the 2nd GBD examined, as this bucket is the first replacement candidate next time). Summary: the replacement algorithm is essentially round-robin. Question: (1) Does anybody know WHY this algorithm was chosen ? It seems to me that something like least recently used would be more desireable, especially when many global buffers (several hundred and up) are allocated to a file. (2) Has this algorithm changed with VMS 6.0 ? Thanks for any comment Franz Schoenbauer, Tech. Univ. Vienna, : system@eimoni.tuwien.ac.at Resselg. 3/188 A-1040, Vienna, Austria : +43(1)58801 ext. 4126