some summary of basic linux

来源:互联网 发布:打码兔软件下载 编辑:程序博客网 时间:2024/05/01 18:19

The memory allocation of a user process address space can be displayed with thepmap command.

You can take a look at how much memory is considered as active and inactive using thevmstat -a command

kswapd also follows another principle. The pages are used mainly for two purposes: page cache and process address space. The page cache is pages mapped to a file on disk. The pages that belong to a process address space (called anonymous memory because it is not mapped to any files, and it has no name) are used for heap and stack

When kswapd reclaims pages, it would rather shrink the page cache than page out (or swap out) the pages owned by processes

Page out and swap out: The phrases “page out” and “swap out” are sometimes confusing. The phrase “page out” means take some pages (a part of entire address space) into swap space while “swap out” means taking entire address space into swap space.They are sometimes used interchangeably

A large proportion of page cache that is reclaimed and process address space that is reclaimed might depend on the usage scenario and will affect performance. You can take some control of this behavior by using /proc/sys/vm/swappiness

virtual memory is composed of both physical memory and the disk subsystem or the swap partition

The synchronization process for a dirty buffer is called flush. In the Linux kernel 2.6 implementation, pdflush kernel thread is responsible for flushing data to the disk. The flush occurs on a regular basis (kupdate) and when the proportion of dirty buffers in memory exceeds a certain threshold (bdflush). The threshold is configurable in the/proc/sys/vm/dirty_background_ratio file

As we stated before, the kernel uses buffers to send and receive data. Figure 1-24 shows configurable buffers which can be used for networking. They can be tuned through files in/proc/sys/net.
/proc/sys/net/core/rmem_max
/proc/sys/net/core/rmem_default
/proc/sys/net/core/wmem_max
/proc/sys/net/core/wmem_default
/proc/sys/net/ipv4/tcp_mem
/proc/sys/net/ipv4/tcp_rmem
/proc/sys/net/ipv4/tcp_wmem

You can also change some of the timeout thresholds through files under /proc/sys/net