Information Technology Reference
In-Depth Information
paging mechanism to implement a conventional
demand-paged, virtual-memory system and to
isolate the memory spaces of user processes
(IA-32, 2005).
Paging is a technique of mapping small fixed
size regions of a process address space into chunks
of real, physical memory called page frames. The
size of the page is constant, e.g. IA-32 machines
use 4KB of physical memory.
In point of fact, IA-32 machine support also
large pages of 4MB. Linux (and Windows) do
not use this ability of large pages (also called
super-pages) and actually the 4KB page support
fulfills the needs for the implementation of Linux
(Winwood et al., 2002).
Linux enables each process to have its own
virtual address space. It defines the range of ad-
dresses within this space that the process is allowed
to use. The addresses are segmented into isolated
section of code, data and stack modules.
Linux provides processes a mechanism for
requesting, accessing and freeing memory (Bovet
and Cesati, 2003), (Love, 2003). Allocations are
made to contiguous, virtual addresses by arranging
the page table to map physical pages. Processes,
through the kernel, can dynamically add and re-
move memory areas to its address space. Memory
areas have attributes such as the start address in
the virtual address space, length and access rights.
User threads share the process memory areas of
the process that has spawned them; therefore,
threads are regular processes that share certain
resources. The Linux facility known as “kernel
threads” are scheduled as user processes but lack
any per-process memory space and can only ac-
cess global kernel memory.
Unlike user mode execution, kernel mode does
not have a process address space. If a process ex-
ecutes a system call, kernel mode will be invoked
and the memory space of the caller remains valid.
Linux gives the kernel a virtual address range of
3GB to 4GB, whereas the processes use the virtual
address range of 0 to 3GB. Therefore, there will
be no conflict between the virtual addresses of
the kernel and the virtual addresses of whichever
process.
In addition, a globally defined kernel address
space becomes accessible which is not process
unique but is global to all processes running in
kernel mode. If kernel mode has been entered not
via a system call but rather via a hardware inter-
rupt, a process address space is defined but it is
irrelevant to the current kernel execution.
Virtual memory
In yesteryears, when a computer program was
too big and there was no way to load the entire
program into the memory, the overlays technique
was used. The programmer had to split the pro-
gram into several portions that the memory could
contain and that can be executed independently.
The programmer also was in charge of putting
system calls that could replace the portions in
the switching time.
With the aim of making the programming
work easier and exempting the programmer from
managing the portions of the memory, the vir-
tual memory systems have been created. Virtual
memory systems automatically load the memory
portions that are necessary for the program ex-
ecution into the memory. Other portions of the
memory that are not currently needed are saved
in a second memory and will be loaded into the
memory only if there is a need to use them.
Virtual memory enables the execution of a
program that its size can be up to the virtual ad-
dress space. This address space is set according
to the size of the registers that are used by CPU
to access the memory addresses. E. g. by using a
processor with 32 bits, we will be able to address
4GB, whereas by using a 64 bits processor, we
will be able to address 16 Exabytes. In addition
to the address space increase, since, when an
operating system uses a virtual memory scheme
there is no need to load the entire program, there
will be a possibility to load more programs and to
Search WWH ::




Custom Search