|
<< Click to Display Table of Contents >> Navigation: ASA-EMulatR Reference Guide > Introduction > Architecture Overview > Chapter 17 – Address Translation, TLB, and PTE > 17.6 Replacement Policies |
TemplatePolicyBase.h defines the base classes and policies for cache replacement and invalidation strategies used by SPAMShardManager and SPAMBucket. When a TLB insert requires evicting an existing entry, the replacement policy selects the victim.
Policy |
Description |
|---|---|
SRRIPPolicy |
Static Re-Reference Interval Prediction. Assigns a re-reference prediction value to each entry; evicts the entry predicted to be re-referenced furthest in the future. Balances recency and frequency. Preferred for workloads with mixed locality. |
ClockPolicy |
Clock-based (second-chance) replacement. A circular pointer sweeps through entries, clearing reference bits. Entries with cleared reference bits are evicted. Low overhead, good for uniform access patterns. |
RandomPolicy |
Random victim selection. Minimal overhead, useful as a baseline and for workloads where access patterns are unpredictable. |
All policies inherit from ReplacementPolicyBase, which defines the victim selection interface. The DefaultInvalidationStrategy provides the default invalidation behavior. Custom policies can be supplied by providing alternative implementations of ReplacementPolicyBase.
The replacement policy is a template parameter to SPAMShardManager, selected at compile time. The ReplacementPolicyEnum in TemplatePolicyBase.h enumerates the supported options. The default is SRRIPPolicy, which provides the best balance of hit rate and overhead for typical OS workloads (multi-process, context-switching, mixed kernel/user access).
See Also: pteLib/TemplatePolicyBase.h – Replacement and invalidation policy definitions; Appendix: Cache Replacement and Invalidation Policies.