linux虚拟内存参数

linux虚拟内存参数

本文介绍了linux虚拟内存参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

谁能告诉我Linux VM可调参数中dirty_bytes和dirty_background_bytes的工作情况.

Can anyone tell me the working of dirty_bytes and dirty_background_bytes in the Linux VM tunable parameters.

我推断dirty_bytes指定了内存量,在此内存量之后,应用程序在进行写操作后便开始直接写到磁盘.是否正确,或者如果分配的内存量用完,该部分首先传输到磁盘,然后新数据再次存储在内存中.例如.假设我想将1 GB的文件传输到磁盘,并且将dirty_bytes设置为100 MB,那么一旦将100 MB写入内存,执行写入操作的应用程序现在就开始将数据直接写入磁盘,或者将100 MB传输到磁盘.磁盘,然后再次将100 MB写入内存,然后再传输到磁盘,依此类推?

I infer that dirty_bytes specifies the amount of memory after which the application doing a write, starts writing directly to disk. Is it correct or if the amount of memory allocated is used up, that portion is first transferred to disk and then new data is again stored in memory. eg. suppose I want to transfer a 1 GB file to disk and I set dirty_bytes to be 100 MB then once 100 MB have been written to memory, the application doing the writing now starts writing the data directly to disk or the 100 MB is transferred to the disk and then again 100 MB is written to memory and then transferred to disk and so on?

在dirty_background_bytes 的情况下,当脏内存的部分超过此值时,pdflush 在后台将脏数据写回磁盘.

And in case of dirty_background_bytes, when the portion of dirty memory exceeds this then pdflush writes the dirty data back to disk in the background.

我对这两个参数的理解正确吗?

Is my understanding correct for these 2 parameters?

推荐答案

不,超过 dirty_bytes (或 dirty_ratio )不会导致进程开始直接写入磁盘.

No, exceeding dirty_bytes (or dirty_ratio) does not cause processes to start writing directly to disk.

相反,当某个进程弄脏了超出限制的页面时,该进程将用于执行一些脏页面的同步写出-确切地说,哪些页面仍由通常的启发式方法决定.它们甚至不一定是最初被该特定过程弄脏的页面.

Instead, when a process dirties a page in excess of the limit, that process is used to perform synchronous writeout of some dirty pages - exactly which ones is still decided by the usual heuristics. They may not necessarily even be pages that were originally dirtied by that particular process.

有效地,该进程看到其写操作(可能只是内存写操作)被挂起,直到发生某些写出操作为止.

Effectively, the process sees its write (which may just be a memory write) suspended until some writeout has occurred.

您对 dirty_background _ * 是正确的.超过后台限制时,将启动异步写出,但允许用户空间进程继续进行.

You are correct about dirty_background_*. When the background limit is exceeded, asynchronous writeout is started, but the userspace process is allowed to continue.

这篇关于linux虚拟内存参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-14 08:31