Slashdot Mirror


Effect of Using 64-bit Pointers?

An anonymous reader queries: "Most 64-bit processors provide a 32-bit mode for compatibility, but 64-bit pointers are becoming essential as systems move beyond 4GB of RAM. Also, the large virtual address space is very useful for several reasons - allowing large files to be memory-mapped, and allowing pages of memory to be remapped without ever requiring the virtual address space to be defragmented. However, 64-bit pointers take up twice as much memory, which immediately affects memory footprint. This is especially an issue on embedded platforms where RAM is at a premium, but even on systems where RAM is plentiful and cheap the extra memory footprint reduces cache performance. Have Slashdot readers done any research into the actual effect of using 64-bit pointers in a 'typical' application? What proportion of a real program's data is actually pointers?"

11 of 164 comments (clear)

  1. easy... by edrugtrader · · Score: 5, Funny

    Have Slashdot readers done any research into the actual effect of using 64-bit pointers in a 'typical' application?

    none whatsoever.

    What proportion of a real program's data is actually pointers?

    none whatsoever.

    oh... i use java.

    --
    MARIJUANA, SHROOMS, X: ONLINE?! - E
    1. Re:easy... by El · · Score: 5, Funny

      Does Java handle datasets larger than 4GBytes, or does it run so slowly that nobody has been able to find out whether or not it handles them? In the underlying implementation, isn't EVERY object actually a pointer?

      --

      "Freedom means freedom for everybody" -- Dick Cheney

    2. Re:easy... by gl4ss · · Score: 5, Insightful

      every object(which is everything apart from your basic int & etc) is a reference, which pretty much is a pointer with a fancy name. as to handling 4gbytes I really don't see why it couldn't, it's just a matter of the vm supporting it anyways(afaik the design, nor the bytecode, limits it).

      however, can you think of any system where you had objects, sets of data, and they weren't (at least underneath) pointers to memory?

      and as to the original subject one poster already said it best: if you really have the need for that extra effort of going 64bit pointers you will probably have the memory to spare, no? anyways it will only be a problem if if the the pointers are big enough in comparision to what they're pointing to.. in which case you should rethink what you're doing anyways probably if you care a squat about memory footprint.. bringing the embedded devices to the discussion at this point is totally pointless but of course cool sounding and slashdot editor catchy.

      bleh I'm no expert anyways.

      --
      world was created 5 seconds before this post as it is.
    3. Re:easy... by Waffle+Iron · · Score: 5, Insightful
      oh... i use java.

      If you'd pay proper attention to Sun's marketing machine, you'd remember that Java uses a just-in-time compiler. What does a compiler do? It turns all of your "object-oriented is the only valid programming paradigm" source code into a big bucket of CPU-specific opcodes, numbers and *pointers*.

      In fact, it will probably have more pointers than the corresponding C or C++ program would have, due to the plethora of tiny objects you're encouraged to spawn. Naturally, the pointer size would match the CPU architecture on which the program is being run and would consume a corresponding number of cache bytes.

    4. Re:easy... by jstarr · · Score: 5, Informative

      Java does not care about memory limits, the JVM does. The stock Sun JVM for x86 machines will address a maximum of 3-4 GiB (dependent on operating system). However, the IBM JVM on an AIX machine has no practical limit and can easily access >16 GiB memory, if available. If a JVM is so designed, there is no reason a Java program can access as much memory as a program written in C.

      I run very large simulations on various platforms, and some of my simulations have to be run on a 64-bit machine because of the memory requirements. Sun's Java forums have several posts asking for various maximum heap (maximum memory accessable) for various platforms and you can find more exact numbers for specific platforms and operating systems there.

      An object is an object, not a pointer. However, objects are accessed through a reference, which in implementation, is typically a pointer.

  2. Don't use 64-bit pointers on such systems. by Green+Light · · Score: 5, Insightful
    However, 64-bit pointers take up twice as much memory, which immediately affects memory footprint. This is especially an issue on embedded platforms where RAM is at a premium

    Huh? On systems where RAM is at a premium, I don't see the point of using or having 64-bit pointers.
    --
    "Send an Instant Karma to me" - Yes
  3. Re:Embedded platforms?!? by MerlynEmrys67 · · Score: 5, Insightful
    Worked on a Xeon based embedded platform that could have 16 GB of Ram on the system board... You forgot that Intel provides a segmented architecture didn't you ?

    By the way, the limit was from physical slots - 8 and a 2GByte DIMM memory limit, increase either of those and guess what.

    Now each "process" on our box could only address 4 Gbyte of that memory, but that was a completely different question (and in fact limited by the libraries that were used - again a different story)

    I remember these conversations when the 32 bit world came around - what do you mean I have to put 4 bytes into the processor. End result is that the code is a little larger, and a little slower - and Moore's law marches on and we don't even notice

    --
    I have mod points and I am not afraid to use them
  4. Re:Embedded 64-Bit by PenguinOpus · · Score: 5, Insightful

    You missed a good point in the original question. Even if you have tons of RAM, cache size is not growing as quickly and you will thrash your data cache far more quickly if all your pointers double in size. I don't know if immediate mode addressing instructions are common for 64bit operands but if they are, it could thrash your icache sooner as well.

    Bandwidth from memory to cache will also be used by these larger pointers.

    OTOH, other than disk controller caches (?), what kind of embedded systems need more than 4GB online simultaneously ?

  5. Probably not as big a deal as you think. by Anonymous Coward · · Score: 5, Interesting

    With modern processors it's not uncommon to require 64-bit or 128-bit memory alignment on data structures to get the best performance. There are even some instructions that *require* such data alignments in order for them to work at all (for example: MMX or SIMD).

    Because of these existing data alignment issues, going from 32-bit to 64-bit pointers may have absolutely no impact on a program's memory usage and cache performance. It is highly likely you're already using 64-bit alignment when you enable the compiler's optmizations.

    Unless you're building massive linked lists of stuff in a scientific / simulation environment this is probably something not worth worrying about. The efficiency and volume of your actual data will still be the biggest waste of space - and it's not like you won't be able to attach more physical memory onto your new system than the old one.

    If it does effect you... you probably already know what you're doing or you've been making very bad assumptions about the size of your variable types.

  6. Re:Who cares? by peter · · Score: 5, Informative

    It's not that 32bit processors are a problem, it's that their virtual address space is not very big. 64bit processors can mmap anything you want, even block devices >> a few terabytes. (So if the HURD ever gets ported to AMD64, they can support filesystems > 2GiB, which they don't last I checked because they mmap the device, and the HURD only runs on i386!)

    Being able to mmap anything you want is something you just plain can't do on a 32bit CPU. If you want to write programs that don't worry about address space limitations, you need 64bit. Anything that simplifies programming is good, since programmer time is valuable.

    Besides that, even if you have 1GB of RAM on i386, Linux needs highmem support to use it all. (It reserves 3GB of virtual address space for user space, and the kernel maps as much RAM as it can with the address space that's left over after mapping PCI and AGP space. So 64bit is useful even on good desktop machines right now. (using highmem slows the kernel down, so might not even be worth it to map the last ~100MiB if you have 1GiB installed.)

    Stupid crap like highmem is exactly why we should be using 64bit CPUs.

    --
    #define X(x,y) x##y
    Peter Cordes ; e-mail: X(peter@cordes , .ca)
  7. Re:Embedded 64-Bit by Pseudonym · · Score: 5, Informative
    OTOH, other than disk controller caches (?), what kind of embedded systems need more than 4GB online simultaneously?

    There's a lot of modern medical equipment which can definitely use the 4GB. MRI machines, CT scanners, ultrasound machines ("sonographs" if you prefer the term) and so on do tend to chew up memory. Particularly the first two, because you often need to hold whole voxel sets in memory while you compute a bunch of cross-sections at odd angles.

    --
    sub f{($f)=@_;print"$f(q{$f});";}f(q{sub f{($f)=@_;print"$f(q{$f});";}f});