These are my doubts about the internal working of programs. If somebody can clear it please do that.
When we are building an executable file actually we are converting the code to the instructions to the microprocessor. This binary conversion is the duty of the compiler and it will convert the code to instructions for a specific microprocessor. Now how can it work in other microprocessors? I will tell you an example. Consider if the compiler converted the code for Pentium 4, and suppose there are some SSE2 instructions. Now how can I run this executable file in an Athlon XP which is not supporting SSE2?One explanation is usage of an emulator which is inside the processor which is emulating the Pentium 4 instructions. Is there such kind of thing in all processors? But how an executable build with a modern compiler (the code contains SSE2 instructions) is working even the oldest X86 processor which is not even supporting SSE? Does the compiler have to build various branches for various processors?
When we are building an executable file actually we are converting the code to the instructions to the microprocessor. This binary conversion is the duty of the compiler and it will convert the code to instructions for a specific microprocessor. Now how can it work in other microprocessors? I will tell you an example. Consider if the compiler converted the code for Pentium 4, and suppose there are some SSE2 instructions. Now how can I run this executable file in an Athlon XP which is not supporting SSE2?One explanation is usage of an emulator which is inside the processor which is emulating the Pentium 4 instructions. Is there such kind of thing in all processors? But how an executable build with a modern compiler (the code contains SSE2 instructions) is working even the oldest X86 processor which is not even supporting SSE? Does the compiler have to build various branches for various processors?