From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ryan Moore Subject: Re: 32 bit processors / 64 bit processors Date: Wed, 21 Oct 2009 00:36:51 -0600 Message-ID: References: <7783925d0910202002ubcd5328nd8c82bb11e5f84ea@mail.gmail.com> <9b0a5b990910202239u7423e88du4786700f79a4bda9@mail.gmail.com> <49FAB6BD-25CD-484D-AC5D-4731D083E075@gmail.com> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=001485f6d0003802f304766c346c Return-path: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type; bh=RDmnKC2TaIe0NlMg0SqvMbfm4ppYSuiV9SEvY60548g=; b=Ws/CSQh3Ww2rDDl9kKqIaMhf7VGKEnaaGnO0di94dEuEowoLeM4YR+uvNx2wHTuLsO Ytfk6bOMtPDgUORNG68yzYLP5UVpRHIO3nbqMri/WrW7aeFZGSP//TbynlY/glGJ9RkP w1K9wJNEdRpFXMEgoykXegc9ku25ccGaHEaUU= In-Reply-To: <49FAB6BD-25CD-484D-AC5D-4731D083E075@gmail.com> Sender: kernelnewbies-bounce@nl.linux.org Errors-to: kernelnewbies-bounce@nl.linux.org List-help: List-unsubscribe: List-software: Ecartis version 1.0.0 List-Id: List-subscribe: List-owner: List-post: List-archive: To: =?UTF-8?B?55uK54mZ?= Cc: Siddu , Rick Brown , kernelnewbies , linux-newbie@vger.kernel.org --001485f6d0003802f304766c346c Content-Type: text/plain; charset=Big5 Content-Transfer-Encoding: quoted-printable On Wed, Oct 21, 2009 at 12:02 AM, =AFq=A4=FA wrote: > > On Oct 21, 2009, at 1:39 PM, Siddu wrote: > > >> >> On Wed, Oct 21, 2009 at 8:32 AM, Rick Brown >> wrote: >> Hi, >> >> Firstly, I'm trying to understand what exactly characterizes a >> procesor or an operating system as 32bit / 64 bit. I've read that it >> means the "native word size" of a machine. But what exactly is that? >> Register size? Address bus size? Anything else? >> >> >> When they say its 32/64 bit machine its the capability of the system or >> processor to process so many bits at once ! >> > > I had an understanding of this being how many bits you have to address yo= ur > RAM. > >> >> This is true, but it is also your instruction size. So the native machine code can be 64 bits on a 64bit processor. - Show quoted text - > >> Secondly, I'm trying to understand what exactly does a sizeof(int) >> depend on when we say it is "platform specific". Is it dependent of >> compiler being 32bit / 64 bit? Or the OS being 32bit / 64 bit? Or the >> processor being 32 / 64 bit? >> >> its dependent on processor being 32/64 bit >> > > Just did a comparison test but it tells me otherwise. But I'm not sure if > the test case if correct, can someone improve it? > On a 64bit CentOS: > [root@yyan ~]# more test.c > #include > > int main () > { > printf ("%d\n", sizeof(int)); > return 0; > } > [root@yyan ~]# gcc test.c > [root@yyan ~]# ./a.out > 4 > [root@yyan ~]# uname -a > Linux yyan.pmlab.com 2.6.18-128.el5 #1 SMP Wed Jan 21 10:41:14 EST 2009 > x86_64 x86_64 x86_64 GNU/Linux > [root@yyan ~]# > > On my Leopard: (Hopefully it's a 32bit OS as it shows) > simonmac:coding yansimon$ cat test.c > #include > > int main () > { > printf ("%d\n", sizeof(int)); > return 0; > } > simonmac:coding yansimon$ gcc test.c > simonmac:coding yansimon$ ./a.out > 4 > simonmac:coding yansimon$ uname -a > Darwin simonmac.local 9.8.0 Darwin Kernel Version 9.8.0: Wed Jul 15 > 16:55:01 PDT 2009; root:xnu-1228.15.4~1/RELEASE_I386 i386 > simonmac:coding yansimon$ > > > >> Lastly, How are "sizes" of compiler / OS / processor inter related? >> Here is my understanding. A 32 bit processor can only be running a 32 >> bit OS. >> >> No ... 32 bit OS can run anything <=3D 32 bit >> >> A 64 bit processor may run a 32 or a 64 bit OS. >> >> yes thats right ! >> >> A 32 bit >> compiler genrates code only to be run on a 32 bit OS; ditto for 64 >> bit. >> >> Not sure about this let others have their say ! >> Is this right? >> >> This is dependent on the compiler, or at least the compiler options. This is due to the machine code that the compiler generates. ie. The difference between x86 machine code and ia64 machine code. > >> Please correct me if i am wrong ! >> TIA, >> >> Rick >> >> -- >> To unsubscribe from this list: send an email with >> "unsubscribe kernelnewbies" to ecartis@nl.linux.org >> Please read the FAQ at http://kernelnewbies.org/FAQ >> >> >> >> >> -- >> Regards, >> ~Sid~ >> I have never met a man so ignorant that i couldn't learn something from >> him >> >> > -- > =AFq=A4=FA > > http://www.google.com/profiles/simonyanix > > > -- > To unsubscribe from this list: send an email with > "unsubscribe kernelnewbies" to ecartis@nl.linux.org > Please read the FAQ at http://kernelnewbies.org/FAQ > > --001485f6d0003802f304766c346c Content-Type: text/html; charset=Big5 Content-Transfer-Encoding: quoted-printable
On Wed, Oct 21, 2009 at 12:02 = AM, =AFq=A4=FA <simonyanix@gmail.com> wrote:

On Oct 21, 2009, at 1:39 PM, Siddu wrote:



On Wed, Oct 21, 2009 at 8:32 AM, Rick Brown <rick.brown.3@gmail.com> wrote:
Hi,

Firstly, I'm trying to understand what exactly characterizes a
procesor or an operating system as 32bit / 64 bit. I've read that it means the "native word size" of a machine. But what exactly is th= at?
Register size? Address bus size? Anything else?


When they say its 32/64 bit machine its the capability of the system or pro= cessor to process so many bits at once !

I had an understanding of this being how many bits you have to address your= RAM.


This is true, but it is = also your instruction size.  So the native machine code can be 64 bits= on a 64bit processor.
- Show quoted text -

Secondly, I'm trying to understand what exactly does a sizeof(int)
depend on when we say it is "platform specific". Is it dependent = of
compiler being 32bit / 64 bit? Or the OS being 32bit / 64 bit? Or the
processor being 32 / 64 bit?

its dependent on processor being 32/64 bit

Just did a comparison test but it tells me otherwise. But I'm not sure = if the test case if correct, can someone improve it?
On a 64bit CentOS:
[root@yyan ~]# more test.c
#include <stdio.h>

int main ()
{
   printf ("%d\n", sizeof(int));
   return 0;
}
[root@yyan ~]# gcc test.c
[root@yyan ~]# ./a.out
4
[root@yyan ~]# uname -a
Linux yyan.pmlab.com 2.6.18-128.el5 #1 SMP Wed Jan 21 10:41:14 EST 2009 x86_64 x86_64 x86_64 = GNU/Linux
[root@yyan ~]#

On my Leopard: (Hopefully it's a 32bit OS as it shows)
simonmac:coding yansimon$ cat test.c
#include <stdio.h>

int main ()
{
   printf ("%d\n", sizeof(int));
   return 0;
}
simonmac:coding yansimon$ gcc test.c
simonmac:coding yansimon$ ./a.out
4
simonmac:coding yansimon$ uname -a
Darwin simonmac.local 9.8.0 Darwin Kernel Version 9.8.0: Wed Jul 15 16:55:0= 1 PDT 2009; root:xnu-1228.15.4~1/RELEASE_I386 i386
simonmac:coding yansimon$




Lastly, How are "sizes" of compiler / OS / processor inter relate= d?
Here is my understanding. A 32 bit processor can only be running a 32
bit OS.

No ... 32 bit OS can run anything <=3D 32 bit

A 64 bit processor may run a 32 or a 64 bit OS.

yes thats right !

A 32 bit
compiler genrates code only to be run on a 32 bit OS; ditto for 64
bit.

Not sure about this let others have their say !
Is this right?


Please correct me if i am wrong !
TIA,

Rick

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to
ecartis@nl.linux.org
Please read the FAQ at http://kernelnewbies.org/FAQ




--
Regards,
~Sid~
I have never met a man so ignorant that i couldn't learn something from= him


--
=AFq=A4=FA

htt= p://www.google.com/profiles/simonyanix



--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@nl.linux.org
Please read the FAQ at http://kernelnewbies.org/FAQ

--001485f6d0003802f304766c346c-- -- To unsubscribe from this list: send an email with "unsubscribe kernelnewbies" to ecartis@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ