Re: Allocation Memory

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

 



On Tue, May 13, 2008 at 10: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?

difficult per process....but per component inside each process is possible:

eg. for the process pid: 2978

cat /proc/2978/smaps:

003ed000-00408000 r-xp 00000000 08:05 262713     /lib/ld-2.6.so
Size:                108 kB
Rss:                  92 kB
Pss:                   1 kB
Shared_Clean:         92 kB
Shared_Dirty:          0 kB
Private_Clean:         0 kB
Private_Dirty:         0 kB
Referenced:           92 kB
00408000-00409000 r--p 0001a000 08:05 262713     /lib/ld-2.6.so
Size:                  4 kB
Rss:                   4 kB
Pss:                   4 kB
Shared_Clean:          0 kB
Shared_Dirty:          0 kB
Private_Clean:         0 kB
Private_Dirty:         4 kB
Referenced:            4 kB
00409000-0040a000 rw-p 0001b000 08:05 262713     /lib/ld-2.6.so
Size:                  4 kB
Rss:                   4 kB
Pss:                   4 kB
Shared_Clean:          0 kB
Shared_Dirty:          0 kB
Private_Clean:         0 kB
Private_Dirty:         4 kB
Referenced:            4 kB

Size=>just the virtual size, just malloc() only, but necessary
page-allocated yet (ie, page fault may result when accessed).
RSS=> this is the physical mem size that actually allocated, but then
again it may be shared with other process, eg, like common libraries.

as for PSS here is the comment (which I don't quite understand)
(fs/proc/task_mmu.c)

/*
 * Proportional Set Size(PSS): my share of RSS.
 *
 * PSS of a process is the count of pages it has in memory, where each
 * page is divided by the number of processes sharing it.  So if a
 * process has 1000 pages all to itself, and 1000 shared with one other
 * process, its PSS will be 1500.
 *

but I think is its importance is insignificance.

In include/linux/taskstats.h - highwater_rss and highwater_vm is used
for statistical collection on the two parameters.

> In other words, how much of the initial memory is given to this brand new
> process? How do I calculate this initial amount?
>
> For example:
>  When I execute firefox application, how much of the initial memory is
> allocate?
>
> I received in response virtual memory that is allocated to the bin of my
> application in question. And that physical allocation is done on demand.
>
>  This is in fs / binfmt_elf.c
>
>
> My questions are:

Not sure of your questions....but hopefully u can figure out....

>
>  - The amount of memory for the bin is specified when the creation of the
> process? Who does that?
>
>  - Initial amount of memory that is flexible?
>
>  - These things are defined only in fs /?
>
>  - Someone has some additional information relevant?
>
>  - some reference about subject?
>
>
> []'s
>
> --
> Eduardo Júnior
> GNU/Linux user #423272
>
> :wq



-- 
Regards,
Peter Teoh

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