> and as long as Chrome doesn't lock the memory range, the OS will swap it to disk anyway
Swapping in/out is random access and is very slow (< 1 Mb/sec) compared to linear reading/writing unless you have SSD.
Of course if you're actively using a program, it will swap out other processes, that's the whole idea.
I've noticed you've said this twice in this thread like it's a bad thing. This is exactly the behaviour I'd expect and want.
If I'm watching a video I'd want the system to do everything possible to make it as smooth as possible.
Firefox doesn't need all that much page/object cache, and videos usually seem to be streamed with transient buffering.
That's what drives me up a wall whenever people use the "free RAM is wasted RAM" argument; the assumption that RAM unused by your software is unused by me.
A good litmus test here is what you expect to happen if the machine reboots. For video, I think it's reasonable to lose all video cache, but I think downloads should be resumable. If it shouldn't be there on a reboot, use RAM. If it should, use disk.
There are certainly exceptions, but I think the general rule of thumb is useful.
And I imagine most systems programmers could define an api if they wanted to.
I think this is definitely a case where apps need to be antisocial and operating systems need to peg them in. The age of cooperative multitasking is over. Let the OS decide.
Repeat after me: high data locality reduces the amount of cache misses, which drastically reduces memory latency, and is only achievable through systematic memory usage conservativism.
Hardware has been around to selectively put banks into low power saving mode, but I've never heard of any commodity OS that supported anything like that. It'd require active organization of physical pages to take advantage of, if common controllers even supported it
Edit: Originally said "zero effect on memory usage", which makes very little sense!
My assumption here is that the media cache is mainly used for uninterrupted playback in case my network is briefly unavailable (e.g. when on a mobile network).