How is it that an executable can work on both AMD and Intel systems? Aren't AMD's and Intel's instruction sets different? How does the executable work on both? How exactly do they compile the files to work like that? And what exactly is the role of the OS in all this?
The only real difference between AMD and Intel at a given processor iteration is their implementation of the instruction sets they support. x86 (32 bit) and x64 (64 bit) are the two most common instruction sets for Intel and AMD processors.
The differences come in when Intel and AMD implement the instruction sets in their chips, but these implementations shouldn't have any effect on the instruction sets themselves. So if a program was compiled for an x64 processor, it can run on any processor that implements the x64 instruction set, which almost all modern Intel and AMD processors implement.
A great example of an implementation difference is the way that Intel likes to hyperthread cores whereas AMD likes to just add more cores. They do this for a multitude of reasons, such as power consumption and better concurrent processing, but it doesn't really impact if programs run because it doesn't change the instruction set. Another difference between Intel and AMD is the number of pipeline stages, which can affect speed.
Huge complexities come into play when operating systems are considered. Windows has huge libraries that programs have to use if they want to run on Windows. The same goes for Linux and Mac OS X. Since these libraries aren't shared between operating systems, programs written on one operating system probably won't run on another.
Essentially these days, compilation is done for the OS, not for hardware. As most hardware have universal protocols and/or tech, as mentioned in Seth Rachwitz's answer, x86 or x64 machine code/opcodes/instruction sets, some programmers do make software designed to run better on certain hardware, i.e., optimized for AMD or Intel, etc.
But they still have other versions for other hardware. Mainly due to the OS, you need to worry about bit length. And/or running an OS, most compilers or software makers tend to compile out to shared machine code instead of manufacturer specific.
It should be remembered different people use the same things in a different way. The guys at MIT may decide to code their own OS for their needs and may want to use advanced specific features of Intel's instruction set. And some people fully redo their own Androids, etc.
I feel like we should point out that Intel and AMD designs x86 processors, meaning their processors are designed to run the x86 instruction set. So if you write a program that targets the x86 instruction set, that program will run on any x86 processor but it won't run on a snapdraggon processor because those processors are designed to run the ARM instruction set.
© 2022 - 2024 — McMap. All rights reserved.