Linux?????????
????????? ???????[ 2016/11/4 11:00:59 ] ????????Linux ?????? ???
??????Windows??????????????????????????????????80%??????????д??????о?????????????????????????????????y??????????????????????????????????????????????????????free?????Linux?????????????????????????????????????????????????????ж??????????????Windows??Linux?????????????????????Linux????????????棨Linux ate my ram????????????????????????????
????free???????
????????????free??????????????????????????????????-m????????MB???λ??
????[root@archlab-server2 ~]# free -m
????total ????used ????free ????shared ????buffers ????cached
????Mem: ??????3920 ?? ??1938 ????1982 ???? 0 ???????? 497 ????????1235
????-/+ buffers/cache: 205 ????3714
????Swap: ???? 4095 ???? 0 ??????4095
????????????б????????????????
????Mem?? total????????= 3920MB??
????used????????= 1938MB??
????free?????У?= 1982MB??
????shared????????棩= 0MB??
????buffers = 497MB??
????cached = 1235MB
?????????????????????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.
??????buffer????????????????????????cache?????????????????д??????????????????????????????IO???????
?????????????б???????е??????-/+ buffers/cache??????
????– buffers/cache used = Mem used – buffers – cached = 1938MB – 497MB – 1235MB = 205MB
????+ buffers/cache free = Mem free + buffers + cached = 1982MB + 497MB + 1235MB = 3714MB
?????????????б???????????????????
????Swap??total????????= 4095MB
????used??????= 0MB
????free?????У?= 4095MB
???????????????滹????????δ??????????????
?????????????????????????????????У????????????????????????????????????buffer/cached??????????????????????????buffer/cached?????????????
???????????
????????????????????????????????????????????в???????
????Memory that isYou’d call itLinux calls it
????taken by applicationsUsedUsed
????available for applications?? and used for somethingFreeUsed
????not used for anythingFreeFree
?????????something?????????free??????”buffers/cached”????棬??????????????????????????????????????????????????????????????????????????????????????????????????
??????λ??free????????????????????????????????????????е?????????????????????????????????????????top????free???????????滹?????????????y???????????buffer/cached????棬?????????????е???檔
????buffers/cached???
????Linux ????????????????????????dentry???л??棨????VFS?????????·??????inode???????????????????????Cache?????Buffer Cache??Page Cache??????????????????IO???????????????豸??????????????????????У???????????????????????????????ó???????η???????????????????????????????????????????豸?????????????????????
??????Linux??????????Щ???е???棬?????????????л??????????????Щ????????′γ?????η?????Щ????????????????????????????????????????????????????y????????????????????????棬??????????????????á?
?????????????????buffers/cached??????????????????????????????????????????——Linux????棡????????Linux????г???????棬????δ??????????????????????????????????е?????????Linux ????????????????????????????????棡
??????????
????????????????????????????
??????????????????????????????ζ?????????
???????????????1G??????
????[root@archlab-server2 ~]# dd if=/dev/zero of=bigfile bs=1M count=1000
????1000+0 records in
????1000+0 records out
????1048576000 bytes (1.0 GB) copied?? 15.8598 s?? 66.1 MB/s
????[root@archlab-server2 ~]# du -h bigfile
????1001M bigfile
??????????
????[root@archlab-server2 ~]# free -m
????total used free shared buffers cached
????Mem: ???? 3920 154 3766 0 0 33
????-/+ buffers/cache: 120 3800
????Swap: 4095 0 4095
????????????????????????????
????[root@archlab-server2 ~]# time cat bigfile > /dev/null
????real 0m18.449s
????user 0m0.013s
????sys 0m0.617s
????[root@archlab-server2 ~]# free -m
????total used free shared buffers cached
????Mem: 3920 1159 2761 0 3 1035
????-/+ buffers/cache: 120 3800
????Swap: 4095 0 4095
??????ζ?????????????????????
????[root@archlab-server2 ~]# time cat bigfile > /dev/null
????real 0m0.310s
????user 0m0.005s
????sys 0m0.304s
?????????濴????????ζ????1G???????????18s???????????ζ??????????0.3s??????????60????
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11