Swap交換分區(qū)概念-創(chuàng)新互聯(lián)

轉(zhuǎn)載自瀟湘隱者
原文鏈接:/tupian/20230522/5246383.html />
什么是Linux swap space呢?我們先來(lái)看看下面兩段關(guān)于Linux swap space的英文介紹資料:

 

在海勃灣等地區(qū),都構(gòu)建了全面的區(qū)域性戰(zhàn)略布局,加強(qiáng)發(fā)展的系統(tǒng)性、市場(chǎng)前瞻性、產(chǎn)品創(chuàng)新能力,以專(zhuān)注、極致的服務(wù)理念,為客戶(hù)提供網(wǎng)站建設(shè)、成都網(wǎng)站設(shè)計(jì) 網(wǎng)站設(shè)計(jì)制作按需定制開(kāi)發(fā),公司網(wǎng)站建設(shè),企業(yè)網(wǎng)站建設(shè),成都品牌網(wǎng)站建設(shè),全網(wǎng)整合營(yíng)銷(xiāo)推廣,成都外貿(mào)網(wǎng)站制作,海勃灣網(wǎng)站建設(shè)費(fèi)用合理。

Linux divides its physical RAM (random access memory) into chucks of memory called pages. Swapping is the process whereby a page of memory is copied to the preconfigured space on the hard disk, called swap space, to free up that page of memory. The combined sizes of the physical memory and the swap space is the amount of virtual memory available.

Swap space in Linux is used when the amount of physical memory (RAM) is full. If the system needs more memory resources and the RAM is full, inactive pages in memory are moved to the swap space. While swap space can help machines with a small amount of RAM, it should not be considered a replacement for more RAM. Swap space is located on hard drives, which have a slower access time than physical memory.Swap space can be a dedicated swap partition (recommended), a swap file, or a combination of swap partitions and swap files.

 

Linux內(nèi)核為了提高讀寫(xiě)效率與速度,會(huì)將文件在內(nèi)存中進(jìn)行緩存,這部分內(nèi)存就是Cache Memory(緩存內(nèi)存)。即使你的程序運(yùn)行結(jié)束后,Cache Memory也不會(huì)自動(dòng)釋放。這就會(huì)導(dǎo)致你在Linux系統(tǒng)中程序頻繁讀寫(xiě)文件后,你會(huì)發(fā)現(xiàn)可用物理內(nèi)存變少。當(dāng)系統(tǒng)的物理內(nèi)存不夠用的時(shí)候,就需要將物理內(nèi)存中的一部分空間釋放出來(lái),以供當(dāng)前運(yùn)行的程序使用。那些被釋放的空間可能來(lái)自一些很長(zhǎng)時(shí)間沒(méi)有什么操作的程序,這些被釋放的空間被臨時(shí)保存到Swap空間中,等到那些程序要運(yùn)行時(shí),再?gòu)腟wap分區(qū)中恢復(fù)保存的數(shù)據(jù)到內(nèi)存中。這樣,系統(tǒng)總是在物理內(nèi)存不夠時(shí),才進(jìn)行Swap交換。

關(guān)于Swap分區(qū),其實(shí)我們有很多疑問(wèn),如果能弄清楚這些疑問(wèn),那么你對(duì)Swap的了解掌握就差不多了。如何查看Swap分區(qū)大?。?Swap分區(qū)大小應(yīng)該如何設(shè)置?系統(tǒng)在什么時(shí)候會(huì)使用Swap分區(qū)? 是否可以調(diào)整? 如何調(diào)整Swap分區(qū)的大小?Swap分區(qū)有什么優(yōu)劣和要注意的地方? Swap分區(qū)是否必要?那么我一個(gè)一個(gè)來(lái)看看這些疑問(wèn)吧!

 

查看Swap分區(qū)大小

 

查看Swap分區(qū)的大小以及使用情況,一般使用free命令即可,如下所示,Swap大小為2015M,目前沒(méi)有使用Swap分區(qū)

[root@DB-Server ~]# free -m
             total       used       free     shared    buffers     cached
Mem:          1000        855        145          0         28        296
-/+ buffers/cache:        530        470
Swap:         2015          0       2015

分享標(biāo)題:Swap交換分區(qū)概念-創(chuàng)新互聯(lián)
當(dāng)前鏈接:http://muchs.cn/article4/dhcdoe.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供域名注冊(cè)、軟件開(kāi)發(fā)、網(wǎng)頁(yè)設(shè)計(jì)公司全網(wǎng)營(yíng)銷(xiāo)推廣、ChatGPT、網(wǎng)站導(dǎo)航

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶(hù)投稿、用戶(hù)轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話(huà):028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)

商城網(wǎng)站建設(shè)