Re: Virtual Memory Doubt

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I'll try to help....

On Mon, Nov 2, 2009 at 4:56 PM, Shameem Ahamed <shameem.ahamed@xxxxxxxxx> wrote:
> Hi,
>
> I know that "When a process is created virtual address is allocated for the process, and the virtual addresses will be dynamically created upon request."
>

I think it's not the virtual address that is created, but the Virtual
Memory Area. Then, addresses are assigned to this VMA. Whether the VMA
contains page frame or not, that's another case.

> How this virtual memory is allocated by kernel. Is it random ?. Can two process have same virtual memory addresses?.

Depends on how it is requested. For example, if the VMA is created
with MAP_FIXED flags, then the kernel with create the VMA with the
start address exactly like you requested. Of course, if another VMA
exists at the the same address, it will fail.

Other than that, most likely for anonymous mapping, it is random.
However, if you take a look very carefully, it would be somewhere
between 0x08000000 and slightly below bottom of stack (0xc000000 minus
something).

For file backed mapping, especially code segment and library, kernel
will get a clue from the dynamic loader. If you analyze a binary,
let's say /bin/cat using readelf -S, you'll see that ELF denotes where
those parts of code need to be loaded and mapped in virtual memory

Hopefully it will give you better picture...

-- 
regards,

Mulyadi Santosa
Freelance Linux trainer and consultant

blog: the-hydra.blogspot.com
training: mulyaditraining.blogspot.com

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux