Very Basic Compilation Issues - please help!
(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!!
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.
Again, it depends on the CPU. The vast majority (all the ones I know of) will run their own machine code.
The OS provides a method to run your applications and provides support services to those applications.
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.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.
精彩评论