非常基本的编译问题 - 请帮忙!

发布于 2024-10-24 20:46:57 字数 255 浏览 1 评论 0原文

(1) 归根结底:要使程序在特定操作系统上可执行,需要做什么?机器代码,汇编语言?

(2) 它是否必须是机器可读的才能由某种 CPU 执行?

(3) 程序执行时操作系统扮演什么角色?它与帮助系统解释程序代码有什么关系吗?

(4) 对于Windows PC,是否所有程序都必须是.exe才能执行?为什么选择Java虚拟机?

(5) 反编译器是如何工作的?编译为机器代码和汇编语言的程序有什么区别?

非常感谢!!

(1) At the bottom line: what does it all have to take to in order to make a program executable on a specific operating system? machine code, assembly language?

(2) Does it have to be machine-readable in order to be executed by a CPU of some kind?

(3) What kind of role does operating system play when a program is being executed? Does it have anything to do with helping the system interpret the program code?

(4) And in light of Windows PC, is it necessary for all programs to be .exe in order to be executable? Why Java virtual machine?

(5) How does decompiler work? What's the difference between programs compiled to machine code and assembly language?

Many Thanks!!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

执手闯天涯 2024-10-31 20:46:57
  1. 这完全取决于操作系统。理论上,您可以拥有一个可以即时解释 COBOL 源代码的操作系统。但通常,您需要操作系统可以加载到内存并运行的特定格式的可执行文件。所以,它是机器代码。

  2. 同样,这取决于 CPU。绝大多数(我所知道的所有)都会运行自己的机器代码。

  3. 操作系统提供了一种运行应用程序的方法,并向这些应用程序提供支持服务。

  4. 没有。如果您希望执行它们,它们必须具有特定的格式,但这并不一定意味着 exe 扩展名。而且,尽管您认为您正在运行 Java 类文件,但实际上您正在运行 JVM,它是一个可执行文件。它只是恰好解释类文件(为了简单起见,忽略 JIT 内容,它将 Java 字节码转换为原始机器代码以提高效率。您可以“执行”Java 类文件、Powershell 脚本、cmd 脚本和等等。

  5. 反编译器会尝试将已编译的文件(EXE、类文件、Python 字节码等)转换为反编译器。 )返回其原始形式,或至少接近其原始形式。

  1. That depends entirely on the operating system. Theoretically, you could have an OS which interpreted COBOL source code on the fly. But generally, you'll need executable files of a specific format that the OS can load into memory and run. So, machine code it is.

  2. Again, it depends on the CPU. The vast majority (all the ones I know of) will run their own machine code.

  3. The OS provides a method to run your applications and provides support services to those applications.

  4. No. If you want them executed, they have to be of a specific format but that doesn't necessarily imply the exe extension. And, although you think you're running a Java class file, in reality you're running the JVM which is an executable file. It just happens to be interpreting the class file (ignoring the JIT stuff for simplicity, which turns Java bytecodes into raw machine code for efficiency. You can "execute" Java class files, Powershell scripts, cmd scripts and so on.

  5. A decompiler attempts to turn a compiled file (EXE, class file, Python bytecode, etc) back into its original form, or at least something close to that.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文