Log in

No account? Create an account
Is it a 32 bit or 64 bit cpu? - Nick [entries|archive|friends|userinfo]

[ website | gagravarr.org ]
[ userinfo | livejournal userinfo ]
[ archive | journal archive ]

Is it a 32 bit or 64 bit cpu? [Jul. 28th, 2009|02:15 pm]
One might expect that a good sysadmin will always know the answer to this question, but I've found myself asking the question quite a bit lately. Sometimes it's on a machine that's not been used in a bit, or sometimes on a machine that we're thinking of re-purposing. Sometimes, you've just been given a login to someone else's box to install some software for them. Or, in the case of my new mythtv machine, simply because I didn't believe what the internet suggested...!

So, we have two questions we actually want an answer to - does this machine support 64 bit (or only 32 bit), and is the running linux kernel support 64 bit (or is it only a 32 bit kernel)?

For the first question, cat /proc/cpuinfo will tell you all you need to know, albeit somewhat cryptically. Check the flags on your processor, you're looking for lm . If you see lm in that list (lm = Long Mode), then your cpu supports 64 bits, and you can run a 64 bit kernel if you'd like to. If doesn't have lm, but it supports cmov (Conditional move instruction), then it's only a 32 bit cpu, but you can run a i686 kernel. If you don't even see cmov, then it's a fairly old / basic cpu (eg an older low power via), and you'll need to run an i386 / i486 kernel

If we do find the lm flag, then how do we tell if the running kernel is 32 bit or 64 bit? Possibly uname -a will give us a hint, but alas not always (look for x86_64 in the output for 64 bit, or i686 for 32 bit). If that isn't conclusive, then run getconf LONG_BIT - that should return either 64 or 32, that being your answer.

If you're on 32 bit, then there's also the question of if your machine has PAE (Physical Address Extension) turned on. While turning on PAE won't let you get past the 4gb per process memory limit that drives so many Java users to 64 bit, it will at least let you have multiple 4gb chunks of memory, and use up to 64gb.

The easiest thing to check is uname -a - if you get an answer back like 2.6.18-128.2.1.el5PAE then it's fairly clear :) Next up, if your distro ships the config file used to build the kernel, then check for CONFIG_HIGHMEM64G=y - if you see that, you've got PAE. Failing that, try running "free" - if it reports more than about 3.75gb, you're on PAE! Finally, if it reports under that, run dmidecode and add up all the memory it detects. If it shows 4gb or more and you don't see that with free, then you don't have PAE. If dmidecode reports you have under about 3.5gb of real memory installed, then it doesn't really matter either way!

(note - all of the above is only applicable for x86 / x64 cpus, and won't apply to sparc, arm etc)