2

Which OS (or distributions) comes with 64-bit kernels (x86_64, SPARC64, PPC64, ..smth else?..) and 32-bit userland?

I want all small userspace programs (like ls, cat, etc) to be 32-bit, because they really no needs to be 64-bit. But OS kernel must be 64bit for using >=3 Gb of RAM. Also database programs (when using a lot of memory) can be 64bit.

64bit mode can hurt some programs, makes them bigger, eating (wasting) memory on pointers (especially in big abstract datatypes like list, tree, etc).

64 bit programss WASTES twice memory on EACH Pointer. I don't want it.

And the Question is not "Are the 32-bit programs needed when 64-bit porcessor is available". Question is "What OS comes with 32 bit userspace and kernels in 32/64 bit mode". Examples of such OS includes: Solaris/SPARC64, MACOSX/X86_64 (10.5)/....

11
  • 2
    The question is why? "I want all small userspace programs (like ls, cat, etc) to be 32-bit, because they really no needs to be 64-bit." makes little to no sense to me.
    – shylent
    Feb 6, 2010 at 14:30
  • 8
    @osgx You greatly overestimate the "negative" impact of 64-bit programs.
    – phoebus
    Feb 6, 2010 at 16:00
  • 1
    @osgx depending on the processor and kernel the CPU is most likely thunking your 32 bit code into 64 bits becaue that's what the processor instruction set is. 32 bit programs can be slower on 64 bit processors (including the OS)
    – Jim B
    Feb 6, 2010 at 16:41
  • 1
    @osgx - it's part of the intel optimization guide- first see Intel® 64 and IA-32 Architectures Software Developer's Manual Volume 1: Basic Architecture then see section 9.2 x64 optimization guide intel.com/products/processor/manuals Now there are some processors that have better performance under 32 bit mode rather than 64 but that only applies to pre-core archtecture processors. In that case you would want to run a 32 bit OS rather than 64 ..cont below
    – Jim B
    Feb 6, 2010 at 19:02
  • 2
    you chopped off the relevent bit from section 9 ( and which is mentioned in the basic architecture guide all over the place "The default operand size for most instructions is 32 bits. The behavior of those instructions is to make the upper 32 bits all zeros." you do save an instruction byte but not any memory. They show you an example with the 64 bit and 3 bit instructions doing the same thing, and below that they mention once again "To access the data in registers R9-R15, the REX prefix is required. Using the 32-bit form there does not reduce code size." cont...
    – Jim B
    Feb 7, 2010 at 0:47

4 Answers 4

6

Current consensus seems to be that you are worrying needlessly. 64-bit is fine, and do not take up much more space than 32-bit to be of any significance. On a couple of my systems here:

What    64-bit Size 32-bit Size
/bin/ls        101K         91K
/lib/libc.so   1.4M        1.3M
/usr/bin/php5  5.5M        5.1M

See – not that significant. Also, 64-bit pointers are more useful than you might think.

3
  • 64bit pointer is wasting of memory, of cache lines, of memory bandwidth. It is overkill, because only 40-50 bits of memory addressing is really implemented in hardware, and because I don't allow each program to use >=3-4 GB of RAM. I want allow computer (and OS) to have >=3-4GB of RAM and use 64bit mode for selected applications.
    – osgx
    Feb 6, 2010 at 17:00
  • In linux and many other unixes there is a mmap64 system call to using >4 GB mmaped files. Yes, such files can't be mmaped entire file at once, but THERE ARE a little number of programs which really needs such files to be mmaped. "cat", "dd", "bash", even "gcc" does not have to be 64-bit.
    – osgx
    Feb 6, 2010 at 17:07
  • 1
    GCC may need to be 64-bit if you're building large applications. I know Firefox has run into some issues with being too big for a 32-bit compiler when using certain optimization settings.
    – Wyzard
    Jul 6, 2012 at 2:32
3

I could almost buy that you would benefit from a 64-bit kernel and 32-bit userspace more than you'll lose time discussing it. Which can, of course, sometimes be true (I do that for a redis server).

But if you want to start mixing 64-bit and 32-bit binaries as you mentioned in a comment, you're really looking for trouble. That would mean that a lot of libraries would be mapped twice in memory, which would be quite inefficient. No distribution offers that (even the Debian multiarch project doesn't cover binaries).

You refer to binaries like "cat", "dd", "bash", even "gcc" as not needing 64 bits, but those are typical examples of programs where using 32-bit pointers instead of 64-bit ones will not save "anything". You already lost more time typing cat in your message than you could ever save by running a 32-bit version of it instead of 64-bit.

Not to mention that x86_64 doesn't only have bigger pointers, it also has twice as many generic registers, and compilers can make as many assumptions about available extensions as with i686 (which is more than i586, in turn more than i486, in turn more than i386). Performance can end up being measurably better.

If you want to use both 64-bit and 32-bit binaries, my personal recommendation would be to run the (likely very few) pointer-intensive applications needing less than 4GB of RAM and for which you truly care about performance in a 32-bit chroot (or any container). Unless they're running on a Java stack, in which case you'll probably be better off sticking to a 64-bit userspace and use a hybrid JVM (with compressed pointers).

If you really want a 64-bit kernel and a 32-bit userspace, and not only because you read somewhere that it'd have a better performance, you can always take the kernel from the 64-bit packages of your distribution and squeeze it on a 32-bit install.

2
  • +1 Please forgive my ignorance, how do pointers affect the decision? Jul 6, 2012 at 0:41
  • If you do have a lot of pointers, they are double the size and will end up taking quite some memory. What your apps allocate you'll lose in filesystem cache, you'll also get get more cache misses (quite expensive), worse NUMA balancing (I'm fetching quite far here he he). Jul 6, 2012 at 1:09
2

There's a new X32 ABI in the works which is aimed at exactly what you're looking for: 32-bit userspace with a 64-bit kernel on AMD64 hardware. The advantage of X32 over the traditional i386 ABI is that programs can take advantage of other features of the AMD64 architecture, such as new instructions and additional CPU registers.

However, X32 isn't ready for use yet, so your best bet at the moment is to install a 32-bit distro that has a 64-bit kernel available. In Debian, for example, you'd install linux-image-2.6-amd64 (or linux-image-amd64 if you're running wheezy, which isn't released yet, but uses a 3.x kernel).

1

I'm running an 64bit KVM server, which is hosting several virtual servers (debian/woody - debian/sqeeze and Windows XP). the virtual linux-server have 32bit Userland and an 64bit kernel (aptitude install linux-image-2.6-amd64).

So I think you can install every current linux distro and run an 64bit kernel on it - I have no problem with this setup.

2
  • Hmm. Do you install entire 32-bit os? Can you use gcc for 64-bit mode? Is there 64 and 32 bit libc for large programs which must be 64bit, like multi-gb database?
    – osgx
    Feb 6, 2010 at 17:51
  • 1
    Yes, I install pure 32bit OS and afterthat I install the 64bit kerneö (which has no dependencies under debian!). I haven't used compilers in those VMs - sry.
    – ThorstenS
    Feb 7, 2010 at 13:31

Not the answer you're looking for? Browse other questions tagged .