Wiley Ubuntu Linux Secrets 978-0-470-39508-0 User Manual

Product codes
978-0-470-39508-0
Page of 24
  6 
Part 1: Starting Out with Ubuntu
Virtual Memory
PhysicalMemory
Swap Space
The Kernel
Figure 1-2:
 The Linux system memory usage.
The memory locations are grouped into blocks called pages. The kernel locates each page 
of memory in either the physical memory or the swap space. It then maintains a table of 
the memory pages that indicates which pages are in physical memory and which pages 
are swapped out to disk.
The kernel keeps track of which memory pages are in use and automatically copies 
memory pages that have not been accessed for a period of time to the swap space area 
(called swapping out). When a program wants to access a memory page that has been 
swapped out, the kernel must make room for it in physical memory by swapping out a 
different memory page and swap in the required page from the swap space. Obviously, 
this process takes time, and it can slow down a running process. The process of swapping 
out memory pages for running applications continues for as long as the Linux system is 
running.
You can see the current status of the memory on a Ubuntu system by using the System 
Monitor utility, as shown in Figure 1-3.
The Memory graph shows that this Linux system has 380.5 MB of physical memory. It also 
shows that about 148.3 MB is currently being used. The next line shows that there is about 
235.3 MB of swap space memory available on this system, with none in use at the time.
By default, each process running on the Linux system has its own private memory pages. 
One process cannot access memory pages being used by another process.
The kernel maintains its own memory areas. For security purposes, no processes can 
access memory used by the kernel processes. Each individual user on the system also has 
a private memory area used for handling any applications the user starts.
Often, however, related applications run that must communicate with each other. One 
way to do this is through data sharing. To facilitate data sharing, you can create shared 
memory pages.
95080c01.indd   6
3/5/09   12:15:37 AM