AMD64 I386 or X64 load?

James Gray james at grayonline.id.au
Mon Mar 27 05:18:11 UTC 2006


On Mon, 27 Mar 2006 04:02 pm, Matthew R. Dempsky wrote:
> On Mon, Mar 27, 2006 at 02:51:46PM +1100, James Gray wrote:
> > Really?  I tested it on an AMD64 machine with a 32bit and a 64bit kernel,
> > and on an Intel Centrino (32bit) system with that code and default
> > compiler options and it generated the correct results.
>
> Did you use the *exact* same compiler with both the 32-bit and 64-bit
> kernel?
>
> There are three possible combinations:
>
>     1. 32-bit userspace on 32-bit kernel (e.g. i386 port of Ubuntu)
>
>     2. 64-bit userspace on 64-bit kernel (e.g. amd64 port of Ubuntu)
>
>     3. 32-bit userspace on 64-bit kernel (e.g. 32-bit chroot for wine or
>        installing the i386 port but with an amd64 kernel)
>
> Your program's output will tell you how many bits the userspace is.  I
> *suspect* you tested #1 and #2, which lines up with the kernel you were
> using.  However, if the original poster has munged his system into state
> #3, it might give misleading information.

#3 wasn't even vaguely what I was testing against.  There's no easy way in 
that situation to create an accurate test without resorting low-level 
register frufru.  From what the OP said, the situation was a 64 bit CPU 
(Opteron/AMD64) running a 32 bit kernel and libs; ie #1.

> > If you've got a better idea I'm all for it.
>
> The most fullproof way would be to grab an amd64 Live CD and just see if
> it boots successfully.  If not, the system's probably i386.

Yeh - that's REALLY convienient! ;)  By the way, how can something that's 
"foolproof" give you results that are "probably" an answer?  You can't have 
it both ways. :P

> A quicker way might be checking /proc/cpuinfo.

And look for what exactly?  There's nothing in /proc/cpuinfo that will tell 
you ANYTHING about the type of kernel (32 or 64 bit) you are currently 
running.  It will tell you what sort of CPU you have, but as I've already 
said, it's the KERNEL that determines the alignment of various datatypes, not 
the CPU per se.

A 32 bit kernel on a 64bit CPU (eg AMD64) will have the same aligment of 
integers as a "pure" 32bit CPU.  A 64 bit kernel on a 64 bit CPU will have a 
larger address space....otherwise, what's the point of 64 bit computing.  My 
code simply checks the alignment of integers (coz they're easy) and works in 
situation #1 and #2 of your test cases.  #3 may as well be a virtual machine 
(VMware etc) for all I care - it's not a "native" environment for the running 
kernel.

Cheers,

James
-- 
The difference between a career and a job is about 20 hours a week.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <https://lists.ubuntu.com/archives/ubuntu-users/attachments/20060327/f4c5303d/attachment.pgp>


More information about the ubuntu-users mailing list