Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

is it possible to run 64 bit code in a machine with 32 bit processor?

I have searched around to get the answers for these questions. but not much luck.

  1. Is it possible to run 32-bit code in a machine with 64-bit processor?

    The answer seems to be yes. but there is a debate on performance issues, since 32-bits are left unused on the processor.

  2. Now my question is vice-versa, Is it possible to run 64-bit code in a machine with 32-bit processor?

    from my little understanding, the answer is NO, because the code designed to run on 64-bit will be using 64-process registars but the 32-bit machine offers only 32.

On the otherhand, I found this link. According this, it is possible to compile 64-bit code on a 32-bit machine. But I am not clear on how this is done plus if compiling on a 32-bit machine will also guarantee execution on the same.

Thanks for helping out

like image 387
brain storm Avatar asked Dec 20 '22 19:12

brain storm


1 Answers

Is it possible to run 32-bit code in a machine with 64-bit processor?

Yes. This is handled in Windows via WOW64, for example.

Now my question is vice-versa, Is it possible to run 64-bit code in a machine with 32-bit processor?

No. 64bit code would require a 64 bit instruction set, which won't be available on a 32 bit processor.

According this, it is possible to compile 64-bit code on a 32-bit machine.

You can compile code for other architectures, but not execute it. This lets you build code for different platforms than the currently executing platform, but executing it will not work.

like image 184
Reed Copsey Avatar answered Feb 12 '23 20:02

Reed Copsey