Cached memory refers to both cached memory (that is currently usable) and used memory (that was previous cached)?

Question

Hi all I was trying to confirm my understanding of “standby list” and “modified list” as stated in this article.

Is it true that “Cached memory” (as shown in the image below) refers to memory that is currently cached (available for use), and memory that was previous cached (previously available for use), but currently used (now not available for use) ?

So if x = “Cached memory” (1184), y = “modified cache pages”, z = “cached and were modified”,

x = y + z holds true ?

enter image description here

Asked by Pacerier

Answer

“Cached” memory is not memory that is cached, but memory that is used for cache. In all cases, cache is used as a means of speeding up access to slower medium by storing it temporarily in a faster medium.

In this instance, the cache is for speeding up access to disk based data. An example of this is where you open a file repeatedly, instead of read it from disk, it is stored in memory automatically by the OS so that subsequent reads do not require disk access.

Cached memory consumes “spare” RAM. Ie memory that is not directly used by applications or OS. In fact, it is more complex than that, as if an application is in memory but idle for some time, it might be swapped out to disk so that the memory it is using can be used for other applications, or cache.

If there are applications that require memory, and there is not enough free memory available, and there aren’t any candidates for swapping out of RAM, then cache memory will be sacrificed. So it is always available for use, but optimum system performance requires some memory to be available for caching.

Update

Cached memory can include data that has been read from a disk, but also data that is intended to be written to a disk. For example, where a file is read from a disk, cached in memory, and then the file is modified by an application, the OS may choose to write these changes back to disk at a later time. Clearly, these “modified” cache pages cannot be discarded as the represent data that needs to ultimately get to a disk to be stored.

As such this ram is not available, and so doesn’t form part of the “Available” memory in the Windows memory usage dialog.

Answered by Paul