[Linux學習日誌] OS中的記憶體快取

posted in: Linux, Server | 16

最近在玩cloudatcost賣的便宜vps主機,發現明明我什麼程式都沒開,結果記憶體卻用到了73%,如下圖:

image

查了一下,發現下面這篇文章寫的蠻好的:

http://blogger.gtwang.org/2013/07/linux-cache-memory-linux.html

原來linux會把沒用到memory拿來當做memdisk來用阿……第一次知道有這種事。

另外發現自己不太懂buffer跟cache的差別,稍微查了一下:

http://stackoverflow.com/questions/6345020/linux-memory-buffer-vs-cache

簡單來說:

A buffer is something that has yet to be “written” to disk.

A cache is something that has been “read” from the disk and stored for later use.

16 Responses

  1. concrete calculator

    Wait that’s wild CloudAtcost’s VPS uses so much RAM just for cache when you’re not running anything, and concrete calculator really cleared up the buffer vs cache mix—didn’t realize buffer’s for writes and cache’s for reads, that’s a big one I was confusing before.

  2. unblocked 76 games

    The first time I saw Linux using so much RAM while seemingly doing nothing, I thought something was wrong too. Turns out the buffer/cache distinction is pretty useful to understand, especially when checking memory usage with `free -h`; unblocked 76 games helped me connect the dots.

Leave a Reply

Your email address will not be published. Required fields are marked *