IBM REDP-4285-00 Manual De Usuario

Descargar
Página de 170
Chapter 1. Understanding the Linux operating system 
13
Draft Document for Review May 4, 2007 11:35 am
4285ch01.fm
1.2.2  Virtual memory manager
The physical memory architecture of an operating system usually is hidden to the application 
and the user because operating systems map any memory into virtual memory. If we want to 
understand the tuning possibilities within the Linux operating system, we have to understand 
how Linux handles virtual memory. As explained in 1.2.1, “Physical and virtual memory” on 
page 11
, applications do not allocate physical memory, but request a memory map of a 
certain size at the Linux kernel and in exchange receive a map in virtual memory. As you can 
see in Figure 1-12 on page 13, virtual memory does not necessarily have to be mapped into 
physical memory. If your application allocates a large amount of memory, some of it might be 
mapped to the swap file on the disk subsystem.
Another enlightening fact that can be taken from Figure 1-12 on page 13 is that applications 
usually do not write directly to the disk subsystem, but into cache or buffers. The 
pdflush
 
kernel threads then flushes out data in cache/buffers to the disk whenever it has time to do so 
(or, of course, if a file size exceeds the buffer cache). Refer to “Flushing dirty buffer” on 
page 22
Figure 1-12   The Linux virtual memory manager
Closely connected to the way the Linux kernel handles writes to the physical disk subsystem 
is the way the Linux kernel manages disk cache. While other operating systems allocate only 
a certain portion of memory as disk cache, Linux handles the memory resource far more 
efficiently. The default configuration of the virtual memory manager allocates all available free 
memory space as disk cache. Hence it is not unusual to see productive Linux systems that 
boast gigabytes of memory but only have 20 MB of that memory free. 
In the same context, Linux also handles swap space very efficiently. The fact that swap space 
is being used does not mean a memory bottleneck but rather proves how efficiently Linux 
handles system resources. See “Page frame reclaiming” on page 14 for more detail.
Standard
C Library
(glibc)
Kernel
Subsystems
sh
httpd
mozilla
kswapd
bdflush
Slab Allocator
zoned
buddy
allocator
MMU
VM Subsystem
Disk Driver
User Space
Processes
Disk
Physical
Memory