buffer 與cache 的區別

2021-05-21 21:22:57 字數 903 閱讀 3932

buffer 與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.

對linux記憶體的理解:

[root@nonamelinux ~]# free

total used free shared buffers cached

mem: 386024 377116 8908 0 21280 155468

-/+ buffers/cache: 200368 185656

swap: 393552 0 393552

下面是對這些數值的解釋:

第二行(mem):

total:總計物理記憶體的大小。

used:已使用多大。

free:可用有多少。

shared:多個程序共享的記憶體總額。

buffers/cached:磁碟快取的大小。

第三行(-/+ buffers/cached):

used:已使用多大。

free:可用有多少。

第四行就不多解釋了。

區別:

第二行(mem)的used/free與第三行(-/+ buffers/cache) used/free的區別。

第三行所指的是從應用程式角度來看,對於應用程式來說,buffers/cached 是等於可用的,因為buffer/cached是為了提高檔案讀取的效能,當應用程式需在用到記憶體的時候,buffer/cached會很快地被**。

所以從應用程式的角度來說,可用記憶體=系統free memory+buffers+cached.

buffer 與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.cach...

buffer 與cache 的區別

一 free命令 root xen 202 12 free m total used free shared buffers cached mem 3072 2459 612 0 207 1803 buffers cache 447 2624 swap 1913 0 1913 第2行 total 記...

Cache和Buffer的區別

1.cache 快取區,是快取記憶體,是位於cpu和主記憶體之間的容量較小但速度很快的儲存器,因為cpu的速度遠遠高於主記憶體的速度,cpu從記憶體中讀取資料需等待很長的時間,而 cache儲存著cpu剛用過的資料或迴圈使用的部分資料,這時從cache中讀取資料會更快,減少了cpu等待的時間,提高了...