Find out if you have a 32bit or 64bit system

From Linuxintro
Revision as of 09:31, 19 December 2012 by imported>ThorstenStaerk

When installing software you usually have the choice between i386 binaries and x86_64 (also called X64) ones. The reason for this is that there are two types of processors: 32bit processors and 64bit processors. 32 bit processors will allow you to address 232 bytes of RAM (4 GB) while 64bit processors are laid out to address 264 bytes of RAM.

The X64 architecture is the X86_32 architecture plus some extensions to stay backwards compatible. In other words, you can run 32 bit software on X64 computers.

If you have a "normal" PC it may be a 32bit one or a 64bit one. For more information, please refer to the excellent articles on wikipedia.

This article is only about X86_32 and X86_64 computers. Itanium computers are always based on 64bit. Power Processors are a separate story.

In for a process to address more than 4 GB of RAM (and use the extended registers), the following conditions must be met:

  • the hardware must support the 64bit extensions
  • the operating system must support the 64bit extensions
  • the application must be compiled to support the 64bit extensions

A 64 bit application can only run on a 64 bit operating system and a 64 bit operating system can only run on 64 bit hardware.

Hardware

You can find out if your hardware support the X64 extensions by looking at the lm flag of your processor:

computer:~ # hwinfo --cpu
01: None 00.0: 10103 CPU
  [Created at cpu.301]
  Unique ID: rdCR.j8NaKXDZtZ6
  Hardware Class: cpu
  Arch: X86-64
  Vendor: "GenuineIntel"
  Model: 6.2.3 "QEMU Virtual CPU version 0.12.3"
  Features: fpu,de,pse,tsc,msr,pae,mce,cx8,apic,sep,mtrr,pge,mca,cmov,pat,pse36,clflush,mmx,fxsr,sse,sse2,syscall,lm,rep_good,nopl,pni,cx16,lahf_lm
  Clock: 2659 MHz
  BogoMips: 5319.60
  Cache: 4096 kb
  Config Status: cfg=new, avail=yes, need=no, active=unknown
[...]

Operating System

On a LINUX operating system the size of the base machine can be obtained using the uname command.

uname -p

will return an appropriate string defining the processor. x86_64 means that the machine is a 64-bit intel-style processor. i686 means that the machine CPU is a 32-bit intel instruction set processor.

Application

A program that is compiled for the X64 extensions can be detected with the file command:

# file /bin/bash
/bin/bash: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), for GNU/Linux 2.6.4, dynamically linked (uses shared libs), stripped

See also