Is there utility program for Page replacement algorithm simulation in Java?
No.
Java abstracts away the concrete memory management, so there should seldom be a need for this.
Edit:
Think some more seconds. No, there is no such algorithm in the standart libraries.
If you mean 'Page replacement' as in virtual memory management, I cannot see there would be something like that. I mean the JVM does a lot of work to hide that from developers and provide a consistent memory model (with varying degrees of success).
Finally I developed-
https://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=5924&lngWId=2
Check out it
If you just want to experiment with different algorithms and learn how they work, then you may want to have a look at custard-cache -- this is an embryonic open-source implementation of some of the most common page replacement algorithms, along with an adapter for those algorithms to be used in JBoss Cache and a very small test suite to let you run different cache algorithms over our own sample data to judge hit ratio + effectiveness.
Now, a disclaimer: I wrote it this code. It was developed as an experimental exercise at my employer, where we were trying to maximise the efficacy of a cache and wanted to know if a different algorithm would help us. We didn't end up changing algorithms, but we figured someone else might have a use for it so open-sourced it. Nothing much has been done with it since but please take a look and see if it's useful.
Paging algorithms implemented are:
- Direct-mapped (associative)
- FIFO
- LRU
- LFU
- Adaptive Replacement Cache (and Fixed Replacement Cache)
- Multi-Queue Replacement
- Johnson and Shasha's 2Q algorithm
There are others I'd like to implement (the Clock family, LRU-K, CAR) but haven't got around to it.
Hope it's helpful!