[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: VMA
kernel_learner wrote:
> Is a VMA of a process same as the segments (BSS, Data,
> Text seg.. etc.) of that process?
A VMA (Virtual Memory Area) is an abstraction that represents
part of a process's address space. All memory mapped by a
process is represented by some VMA (exactly one VMA, I
believe); a single process might have many
VMAs covering its address space, but the address
ranges represented by those VMAs do not overlap.
It's *possible*, but not necessary, that the different
segments of a process would be mapped to different
VMAs. Basically, what a VMA does is to provide the
code to handle page faults for a particular address
range. Different kinds of memory objects require
different fault handling, so they would be
represented by different VMAs. For example, the
.text segment of a file would be represented by
a VMS whose fault behavior is to page in the
proper page from the executable file; but
an anonymous (malloc()'d) address range
would be represented by a VMA whose fault
behavior is to allocate a new anonymous page.
> Also could someone please explain the concepts of
> segments (BSS, Data, Text etc.)? My OS Fundamentals
> are weak about that...and I have never had a
> satisfying explaination of it's significance.
That kind of segment is just a tool for organizing
files. You can more-or-less arbitraily name sections
of files with segment names. For example, the Linux
kernel puts code that is only used at boot time into
a segment called ".init", and discards the .init segment
after boot to reclaim the memory. The only reason
.init exists is to provide a home for those memory
objects the kernel knows it won't need after boot.
The other kind of segment is the hardware memory
segment, which is supported by Intel processors
and, I imagine, others, though in different
ways. On Intel, segmentation is a memory
abstraction mechanism that sits on top of the
paging mechanism and allows a program to
map arbitrary contiguous regions of virtual
memory using segment descriptors. Linux doesn't
use that kind of segment - it just sets up the
Intel hardware in such a way that it can use
a flat 32-bit virtual address space and ignore
the hardware segmentation.
Cheers,
-- Joe
--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive: http://mail.nl.linux.org/kernelnewbies/
FAQ: http://kernelnewbies.org/faq/
- References:
- VMA
- From: kernel_learner <kernel_learner@yahoo.com>