0

This might sound a bit naive, but, I'm unable to find an appropriate answer to the question in my mind.

Let's say there is an algorithm X, which is implemented in 10 different programming languages. After the bootstrap stage for every program, each program executes the algorithm over and over again. My question is that Would there be any difference from the hardware-level when they all execute on the same CPU?

What I understand is that the set of hardware resources (register, etc.) on each CPU are limited. Hence, executing a core algorithm should follow a similar (if not identical) pattern from the "fetch–decode–execute" cycle.

Andy_Jake
  • 134
  • 1
  • 11
  • ***Would there be any difference from the hardware-level when they all execute on the same CPU?*** Yes. The different languages will not compile to the same assembly language. Will not have the same optimization rules.. Some will have garbage collection.. To summarize, you most likely will not execute the exact same program at the hardware / machine code level. If you did they would be the same. – drescherjm Jul 31 '18 at 19:44
  • Thanks for the prompt response. Would it be the same scenario if they all execute the same algorithm in an infinite loop? – Andy_Jake Jul 31 '18 at 19:54
  • Does not matter how you execute it. Different compilers (even the same compiler that supports more than one language) will likely produce different machine language as output. – drescherjm Jul 31 '18 at 20:25

0 Answers0