F From:	SMTP%"MACRO32%WKUVX1.BITNET@uu7.psi.com" 10-AUG-1993 08:41:00.44 To:	EVERHART CC:	, Subj:	RMS Global Buffer Replacement Strategy  O X-Listname: "VMS Internals, MACRO, & BLISS Discussions" <MACRO32@WKUVX1.BITNET>  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 4 From: Franz Schoenbauer <system@EIMONI.TUWIEN.AC.AT>+ Reply-To: MACRO32%WKUVX1.BITNET@uu7.psi.com  To: MACRO32@WKUVX1.BITNET  Cc: system@EIMONI.TUWIEN.AC.AT8 Message-Id: <00970CF1.CD2C6740.3893@EIMONI.TUWIEN.AC.AT>/ Subject: RMS Global Buffer Replacement Strategy   I Has anybody taken a look at the algorithm that transfers RMS Buckets into # and out of the global buffer list ? 8 As far as i can determine for VMS 5.5-2, the replacement strategy is as follows: 6 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)  K The GBDs are organised as a double linked list sorted by VBN of the bucket. M Each GBD contains e.g. forward and backward pointers to other GBDs, a pointer E to the Bucket, a CACHEVAL that is initialized with that buckets index N depth (in our case a number between 0 (Data Bucket or SIDR Bucket) and 2-3 forO the root bucket for a given RMS-Key, the key number, the VBN of its Bucket etc. O The GBDs are contiguous within the Global Buffer section and have a fixed size. , The GBH contains a pointer to the first GBD.  B If a new bucket with VBN XXX is requested, the GBD list is scannedF 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.I If a GBD with VBN XXX was found, the bucket is used. Otherwise the bucket L with VBN XXX has to be read in from disk, into a GB. If there are free GBDs,M one of them and its associated GB are used, otherwise a victim must be chosen   to make room for the new bucket.   Victim selection: O The GBD list is treated as an array, without regard to the order by VBN imposed M by the foreward/backward pointers. A pointer into the GBD array is maintained M (called RP), initialized with the first element in the array. RP is where the G victim search starts. The GBD pointed to by RP and the 7 following GBDs N (wrapping around to the beginning of the array) are examined. If a CACHEVAL ofL 0 is found (meaning a Data Bucket or a SIDR Bucket), that GBD and its GB areK used). If no CACHEVAL 0 is found, the GBD with the lowest CACHEVAL is used. H In both cases the CACHEVAL of the GBD pointed to by RP is decremented byN 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)K Then RP is updated to point to the next GBD (not in sort order, but next in M virtual Memory). (NOTE: this is quite strange when the victim was the 2nd GBD G examined, as this bucket is the first replacement candidate next time).     > Summary: the replacement algorithm is essentially round-robin.  	 Question: 5 (1) Does anybody know WHY this algorithm was chosen ? D It seems to me that something like least recently used would be moreH 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    G Franz Schoenbauer, Tech. Univ. Vienna,    :  system@eimoni.tuwien.ac.at B Resselg. 3/188  A-1040, Vienna, Austria   :  +43(1)58801 ext. 4126