limitiation on memory allocation

Ivan Voras ivoras at fer.hr
Sat Mar 10 19:43:58 UTC 2007


Dima Sorkin wrote:
> Hi.
> I've read some pages about 'kern.maxusers', 'kern.maxdsize'.
> I have questions:
> 1)
> After I reduce 'maxusers' to some reasonable amount for that computer
> (say 10),

maxusers is somewhat badly named because of historical reasons. Today it
means something like "how many big processes will the machine probably
run", where a "big process" is something like an apache or postgresql
instance, or any of the big desktop applications. It doesn't matter much
if you set it (or it automatically gets set) too high.

> and enlarge 'maxdsize', will a user process be able to allocate
> arrays that are considerably bigger than the physical memory size ?
> This is what I really need. I run processes in which it can come to
> 1.5x-2x ratio.

Yes, upto kernel limits...

> 
> 2) Following the
> http://www.opennet.ru/openforum/vsluhforumID1/40543.html#1
> Should I put   maxdsize == phys mem size, or should I put it lower
> (by how much) ?

Put is as large as you want. It's taken from combined virtual+physical
memory.

> 3) On Intel pentium 4 machine with 2GB phys memory,
> during installation where almost all options were taken as defaults,
> should I worry that kernel is not configured to use PAE ?
> Installation program by default allocated 4GB swap,
> so totally it is 6GB. How do I check this ?

No, swap space is completely separate from the rest of the equation. Put
as much swap space as you like, it's not limited to 4GB total. You
should only consider PAE if you want to use more than about 3.5 GB of
physical memory (why not 4GB? because some address space is dedicated to
PCI and other hardware) AND you want to keep the kernel 32-bit. You can
think of PAE as something like an in-memory "swap" space (but so fast
you can't distinguish it from "normal" memory).

If the kernel is 32-bit, any single process cannot allocate more than 4
GB of memory total (for obvious reasons). This means that the kernel
memory (which is shared between processes, but takes the same amount of
address space in each process individually) + the process' own memory
cannot exceed 4 GB. Kernel address space is mostly 1 GB (there's a knob
for this somewhere), so that leaves you maximum 3 GB (virtual or
physical, doesn't matter) that your program can allocate if maxdsiz
allows it.

If you expand available virtual memory through swap or PAE, you can have
multiple processes which allocate 4 GB each (upto available virtual
space), but still each process individually cannot exceed 4 GB.

If you switch to a 64-bit kernel, than all of this complexity vanishes
because of expanded address space and your program is only limited by
maxdsiz and available virtual (e.g. physical+swap) memory.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 250 bytes
Desc: OpenPGP digital signature
Url : http://lists.freebsd.org/pipermail/freebsd-questions/attachments/20070310/6b66ce35/signature.pgp


More information about the freebsd-questions mailing list