# 32 vs. 64 bit

## haimat

Hi all,

finally I got my new computer, including an Intel Core2 duo CPU (e6850). Because I bought 4gb RAM for it, I decided to use MS Vista 64 bit for playing some games. Of course I want to continue to work under Gentoo Linux, but now I am not sure if I need a special version of the gentoo-sources kernel or even the whole distribution.

My question now: do I "need" a special 64 bit version as with Windows, at least to address the full 4gb RAM? Are there special versions of Gentoo for this purpose? What are the differences between 32 bit and 64 bit under Linux?

I hope you can give me some hints, so that I can decide which version of Gentoo I should choose. Or is there no special version -- can I use the generic Gentoo Live CD with the latest portage tree and gentoo-sources?

And: what compiler (gcc) options should I use in make.conf?

Thanks in advance!

Kind regards, Matthias

----------

## ShinyThings

Use the amd64 livecd and amd64 stage file.

----------

## Coelacanth

You should be able to use 4 GB of RAM with 32bit, but no more than that.

----------

## Mantaar

Well, that's not entirely true, depending on your mainboard. The thing is, Video card memory and all other PCI card's memories are usually addressed somewhere from 3G-4G, depriving you of your last Gig of RAM. Well not all that much, but you'll use at least the memory your video card has + some one hundred megabytes on top for other stuff.

Some mainboards help you with that problem as they map out some address space beyond the 4 Gig line, so your OS can actually see it. You may need special tweaks for that, I have no idea. I'm still on my 1Gig ram and I'm using my swap partition only in cases I want to install some new experimental/minimal OS on it. Seriously, if you're not running a server, there's no need for 4 Gigs in Linux. With two you should be fine, so you may choose to go for 32 bit as it's more stable.

I would go 64bit, but that's only because I like testing stuff  :Very Happy: .

----------

## Cyker

You can access 4GB of 'actual' RAM (As opposed to merely address space) in 32-bit Linux by adding the 64GB kernel option.

However, it is slow and sucky.

Setting up Gentoo for 64-bits is very similar to setting up 32-bit - You just need to use the right LiveCD as mentioned above.

The biggest choice is whether or not to use the multilib profile, which will allow you to run 32-bit stuff under 64-bit Gentoo. 32-bits under 64-bit Linux mostly works, but can also be a giant PITA. 64/32-bit interoperability is not optimal atm, but it kinda works.

If you stick to source-based stuff and avoid 32-bit binaries like the plague, 64-bit Linux feels almost identical to 32-bit Linux, except you can access more RAM without EMS-style paging tricks (Which are slow and sucky!).

----------

## wxqc11h

in my opinion going 64bit is worthless but have a try, then come back to 32 as i did yesterday  :Wink: 

----------

## Babali

By the way is 64bit/no-multilib worth ?

----------

## haimat

thanks for all your reply.

I think I will stick with my 32bit version for now  :Smile: 

----------

## star882

 *wxqc11h wrote:*   

> in my opinion going 64bit is worthless but have a try, then come back to 32 as i did yesterday 

 

Except 64 bits offers more precision for floating point and hardware support for 64 bit calculations. It can easily make for a significant performance boost if your applications work with 64 bit data types. Why waste clock cycles on emulating 64 bit math when you already have hardware that can natively process 64 bit math?

----------

## wxqc11h

I tought that i ll see the boost in emerging packages, but it didnt happen. + no flash support which is a problem for me and i dont want to install lots of necessary packages just to watch youtube  :Smile: 

edit: there should be UNnecessary instead of necessary...Last edited by wxqc11h on Sat Sep 22, 2007 10:44 pm; edited 2 times in total

----------

## star882

 *wxqc11h wrote:*   

> I tought that i ll see the boost in emerging packages, but it didnt happen. + no flash support which is a problem for me and i dont want to install lots of necessary packages just to watch youtube 

 

I don't know for sure, but I don't think gcc uses much 64 bit math itself so you shouldn't see much improvement.

I do know that emulating 64 bit math takes a lot of clock cycles.

----------

## pa1983

I have been runing 64 bit gentoo sens it was beta in 2003 on dual opterons and it hade its problems back then but to day I would say its as stable as 32bit. Shure if you are going multilib so you get 32bit support there maybe som hickupse some times but I cant remember when I hade a problem whit32bit software like cedega or anything else 32bit native. I would defenetly go 64bit if I hade a athlon64 or a core 2 duo.

I also have a 32bit gentoo machine (VIA C3) so I can say that gong 64bit i sent really difficult in any way. maybe good thing to stay away from as a beginner but if you have experience whit linux before I cant see any problems going 64bit and if you are going to use it as a desktop i would sugest going multilib because havening 32bit firefox is much easier if you want flash because its 32bit only.

----------

## Cyker

Well that's the tradeoffs - It basically boils down to 32-bit for binary compatibility and 64-bit for more specialist stuff (Crunching big numbers or accessing doing massive amounts of RAM).

If you don't use 32-bit binaries AT ALL (No NWN, no RAR, no Opera, no Flash plugins, no commercial binary-only stuff) then your 64-bit experience will be nearly identical to 32-bit.

If you do, IMHO 32-bit is less hassle. You *can* get a lot of 32-bit binaries to work; The Gentoo AMD64 guys have done a stellar job with the emul libraries, but there will always be problems - It's like trying to run x86 Windows code in Linux; You can with the right libraries and setup, but it won't be perfect.

If you need to use >4GB RAM, or do lots of big-number crunching (e.g. Crypto benefits massively from 64-bit) then 64-bit is the way to go - The performance improvement is stunning. Most academia loves 64-bit for this.

If neither applies, then it's horses for courses  :Smile: 

----------

## Akkara

Wow, surprising to read so many vigorous comments against 64-bits.

I've been running 64-bits since sometime in 2005.  It was somewhat rocky back then but these days it doesn't feel as if I'm missing anything.  Even flash works, although it is possible there's a few gotchas I'm not seeing because I'm not really a big user of fancy flash and javascript websites.  Yoo-toob works fine, as does cnn's videos (except for the insane bandwidth cnn requires - iti s a con st an t str ea m o f stutt er in g.)

It didn't seem hard to set up - I had jumped right in to 64-bits when I first started using Gentoo and aside from several apps that didn't work back in 2005, I don't recall any particular difficulty.

 *Quote:*   

> if you're not running a server, there's no need for 4 Gigs in Linux.

 

A while ago I upgraded to 8GB and it is *sweet*!  Almost everything stays in buffercache and responsiveness is near-instantaneous for almost everything.  It is great to be able to work on a large audio project and have all the files right there for immediate editing without waiting the 10-15 seconds each time for them to be read in.

So I'd recommend 64-bits.  Especially in your case where you have a windows partition as a fallback in case you run into some flash or java site that doesn't work.

But again, it all depends on what you'll be doing - what do you plan to use your gentoo for?

----------

## Mantaar

 *star882 wrote:*   

>  *wxqc11h wrote:*   in my opinion going 64bit is worthless but have a try, then come back to 32 as i did yesterday  
> 
> Except 64 bits offers more precision for floating point and hardware support for 64 bit calculations. It can easily make for a significant performance boost if your applications work with 64 bit data types. Why waste clock cycles on emulating 64 bit math when you already have hardware that can natively process 64 bit math?

 

And that happens exactly when? Sorry, floating point calculations or that large integer calculations don't happen all that much on in everyday (desktop) life. Transcoding videos, yes. Transcoding audio, probably. Networking, no. Playing games, no. Compilations, are you kidding? No. Anything else? Well, you may have bought Maple 11. Or not.

There is no real gain for the desktop systems - not yet, and let's see, if there will ever be one. For now, flash doesn't work and you don't have some fancy binaries running natively. To every desktop user, I'd still recommend 32bit for the ease of use. If you wanna get to testing stuff, now that's a totally different thing.

----------

## i92guboj

I won't comment on the main topic, since this thread is more than duplicated. We already have enough of this, and no one is going to change opinion, it doesn't matter what people say here. Just use the search function and look at the dates of the thread to make sure it is actual info. No need to use a new thread for the same thing again.

I will just comment one thing:

 *Cyker wrote:*   

> 
> 
> If you do, IMHO 32-bit is less hassle. You *can* get a lot of 32-bit binaries to work; The Gentoo AMD64 guys have done a stellar job with the emul libraries, but there will always be problems - It's like trying to run x86 Windows code in Linux; You can with the right libraries and setup, but it won't be perfect.
> 
> 

 

That is quote is not too accurate. To start with, amd64 chips can natively run 32 bit x86 code if your kernel supports so. As far as I know, there is no emulation involved, at least, at software level (I don't know how things are implemented at cpu level). You just need the libs, and the 32 bit program to be able to run it. There are no compatibility problems, there are only missing libs, and you can always solve that, even if the distro doesn't provide a method to do it.

To run window code on linux is a completely different topic, since that requires -indeed- emulation, virtualization, or a complete re-implementation of the windows api in top of x and the linux kernel, which is what wine does (no, wine is not an emulator either, at least not in the traditional meaning of that word). 

Definitely, that comparison was not fair. 

And for the poster about flash: if flash was the main reason you are on 32 bits, then you are lazy, lazy, lazy. There are lots of ways to use flash 32 on 64 bits. Like just using firefox-bin, opera, or even nspluginwrapper under any 64 bit browser. Nothing else is needed. Just use the search in the forums.

Just wanted to clarify that a bit.

----------

## haimat

ok, short question, I can't find anything on google or on Gentoo forums on this -- how can I just stay with 32 bit at the installation? When I run menuconfig for the gentoo-sources and save my changes there, I see that I get these settings in .config file in any case:

```
CONFIG_X86_64=y

CONFIG_64BIT=y

CONFIG_X86=y
```

So, how can i force the system to use a 32bit version of the kernel, even if it is a 64bit processor (Core2 Duo)? Where can I set this in menuconfig? I wanted to use my old 32bit installation (from my previous P4 machine), but when i chroot into this installation from a LiveCD, I get this error after kernel configuration:

```
ubuntu linux # make && make modules_install

  CHK     include/linux/version.h

  CHK     include/linux/utsrelease.h

  CC      arch/x86_64/kernel/asm-offsets.s

arch/x86_64/kernel/asm-offsets.c:1: error: code model 'kernel' not supported in the 32 bit mode

arch/x86_64/kernel/asm-offsets.c:1: sorry, unimplemented: 64-bit mode not compiled in

make[1]: *** [arch/x86_64/kernel/asm-offsets.s] Error 1

make: *** [prepare0] Error 2
```

Any ideas what is going wrong here?

Is it not possible to use my old 32bit installation with a new kernel on a Core2 Duo?

Thanks in advance!

Kind Regards, Matthias

----------

## i92guboj

 *haimat wrote:*   

> ok, short question, I can't find anything on google or on Gentoo forums on this -- how can I just stay with 32 bit at the installation? When I run menuconfig for the gentoo-sources and save my changes there, I see that I get these settings in .config file in any case:
> 
> ```
> CONFIG_X86_64=y
> 
> ...

 

Use a correct x86 32 bits kernel to boot from.

menuconfig will detect your current settings and mask some options consequently. So, if you boot on an amd64 kernel you will only see 64bit related options. The same way, that when you boot on x86 and you make menuconfig, you can't see 64 bits cpus. You are probably booting from the wrong media.

----------

## star882

 *Mantaar wrote:*   

>  *star882 wrote:*    *wxqc11h wrote:*   in my opinion going 64bit is worthless but have a try, then come back to 32 as i did yesterday  
> 
> Except 64 bits offers more precision for floating point and hardware support for 64 bit calculations. It can easily make for a significant performance boost if your applications work with 64 bit data types. Why waste clock cycles on emulating 64 bit math when you already have hardware that can natively process 64 bit math? 
> 
> And that happens exactly when? Sorry, floating point calculations or that large integer calculations don't happen all that much on in everyday (desktop) life. Transcoding videos, yes. Transcoding audio, probably. Networking, no. Playing games, no. Compilations, are you kidding? No. Anything else? Well, you may have bought Maple 11. Or not.
> ...

 

On a 64 bit machine, D2X-XL compiled for 64 bits is a fair amount faster than D2X-XL compiled for 32 bits. (100 as opposed to 80 FPS with the same settings.) I looked through the source code and there were several doubles (64 bit floating point variables) in the rendering code. I'm not sure exactly how a 32 bit CPU emulates 64 bit math but I can realize how it can at least double the clock cycles necessary. From my understanding, 64 bit multiplication and division would take lots of clock cycles to emulate.

Also note that distributed.net RC5-72 easily runs over twice as fast on 64 bits.

Even something as simple as MP3 makes use of doubles.

So the speed benefits would occur every time a double is used. And I'm sure a lot of programs are coded to use doubles. That includes games and video.

----------

## Akkara

 *Quote:*   

> [ongoing sub-discussion about 64-bit double being faster on x86_64 than on due 32-bit x86 due to the 32-bit x86 code having to emulate the 64-bit operation]

 

This is not quite correct.

As far as I know, the actual double floating-point arithmetic is carried out in the same logic unit regardless of whether you're using 64 bit x86_64, or the 32-bit subset.  Even the older 32-bit only processors had 64-bit floating-point units.

Integer 64-bit operations can be faster, because when restricted to 32-bits, the compiler generates the equivalent of "add lo32bit parts" followed by "add-with-carry hi32bit parts".  (And 64-bit integer multiplication is even worse).  Of course memory fetches are 32-bits at a time as well, and so requires two of them for a 64-bit integer op.

x86_64 adds several things to the old x86 architecture:

- Native 64-bit integer operations and 64-bit integer registers (the FP registers always were 64-bits, or 80 if you count the exponent).

- More registers (and newer opcodes that use them).

The second point, "more registers", is what allows some codes to run faster even if such codes never do a 64-bit operation.  But to use these extra registers, they need to use the newer opcodes, hence, x86_64.

----------

