Re: Allocation Memory

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

 



Hi Eduardo...

On Tue, May 13, 2008 at 9:01 AM, Eduardo Júnior <ihtraum18@xxxxxxxxx> wrote:
>
> Hello,
>
>
> I asked this once in irc, but I think that I was not clear
> I wanna know how does memory allocation for brand new processes work?

I hope it can give you the answer,although not point per point.

In essence, when you do fork() or clone(), Copy on Write mechanism is
used. That means, it starts with nothing more than just the process
metadata such as task_struct, mm_struct, opened file and so on.

When it tries to allocate something, page fault kicks in. It could
lead simply to reading page cache, or reading directly to disk (hard
page fault). Most likely, if it's something like shared library, it's
already cached in RAM thus page cache is hit.

Thing is a bit different when deals with exec() family. COW no longer
works here because you're forking based on whole new binary. But
still, demand paging works. It starts with very minimal allocated
pages (process metadata, some elf info but not all). I remind you that
process is not an identical copy of the whole ELF image. Things like
ELF header....AFAIK..is not copied to RAM. Section can be mapped into
overlapped region...and so on

I hope it gives another point of view...

regards,

Mulyadi.

--
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