Re: size_t or int for malloc-type functions?



"Randy Howard" <randyhoward@xxxxxxxxxxxxxxxxx> wrote in message news:0001HW.C1C034C90338CB3CF0203648@xxxxxxxxxxxxxxxxxxx
On Tue, 2 Jan 2007 15:49:03 -0600, christian.bau wrote
(in article <1167774543.858326.104530@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>):
And most 32 bit systems have limit at 3GB or 3.5GB.

Actually it's usually 2GB, due to splitting of address space between
the kernel and user space. Some go as high as 3GB with special boot
options.

RedHat has a special Linux kernel that gives just under 4GB of user address space; a bit of kernel space is still required to keep syscalls working, but it's pretty small. It's mainly used by database folks, who should be moving to AMD64 now anyways (with its 2^51 bytes of user space, currently).

However, there are hacks (outside of malloc) that allow for
what Intel calls "Physical Address Extension" (PAE) to allow
systems with Intel 32-bit processors to see memory above 4GB, sort
of like the old extended/expanded memory hacks in the DOS days.
Again, proprietary, and different APIs to use the memory from what
standard C supports.

A single process will never see more than 32 bits of memory at a time, since both the virtual and linear address spaces are limited to that size. What PAE does is allow the OS to map those 32 bits of per-process linear address space into 36 bits of physical address space. That means you still can't have more than 4GB in a single app, but you could run sixteen apps that each have their own 4GB without conflict.

Some OSes may provide a way for processes to "see" different parts of the 36-bit space at various times, similar to how EMS allowed 16-bit apps to "see" different 1MB chunks of a 16MB physical address space. Obviously that requires a lot of non-portable trickery to ensure the right memory chunk is in place when you dereference a pointer.

S

--
Stephen Sprunk "God does not play dice." --Albert Einstein
CCIE #3723 "God is an inveterate gambler, and He throws the
K5SSS dice at every possible opportunity." --Stephen Hawking


--
Posted via a free Usenet account from http://www.teranews.com

.



Relevant Pages

  • Re: [swsusp] separate snapshot functionality to separate file
    ... >> Split does not prevent you from doing the cleanups. ... Kernel needs to use get_user, ... > memory directly from the used space. ... > not be visible to the user space at all. ...
    (Linux-Kernel)
  • Re: Virtual memory - user space kernel space
    ... It depends upon the total size of kernel code and static data. ... 1G/3G division in virutal memory is nothing but a set of pointers to ... User space pointers has to go via MMU to get the location in physical ... you bumble virtual and physical memory. ...
    (comp.os.linux.development.system)
  • Re: user_to_phys() without mmap?
    ... |> |> |> into user space is causing large latencies and unsightly artifacts. ... |> |> |> fact being copied into kernel space. ... the hardware when that console was switched to be the one displayed. ...
    (comp.os.linux.development.system)
  • Re: [swsusp] separate snapshot functionality to separate file
    ... Kernel needs to use get_user, ... >> memory directly from the used space. ... >> not be visible to the user space at all. ... send the line "unsubscribe linux-kernel" in ...
    (Linux-Kernel)
  • [UNIX] Linux Kernel do_brk() Vulnerablility (Explained)
    ... Get your security news from a reliable source. ... A critical security bug has been found in the Linux kernel 2.4.22 (and ... earlier) memory management subsystem. ... for the code working at the lowest privilege level. ...
    (Securiteam)