Java – how to print “Hello world” Complete life cycle
I studied compiler, operating system and computer architecture in graduate school But I want to see these concepts (less theoretical) in a simple but real example For simple examples, HelloWorld is a good choice
Not only is the life cycle of this applet interesting, but understanding how JVM, OS and architecture work can help us become better programmers
In short, my question is: did I describe these steps correctly and completely?
For details, I need your help, including the following:
>I'm sure I missed a lot of valuable ideas, so please add any meaningful ideas to the life cycle
What I want to know is how HelloWorld traverses each layer and returns from it Suppose this program runs on an Intel CPU with Ubuntu
I will update this article by combining good answers until I finally accept an answer
The following is the HelloWorld plan as we all know it
It is compiled into bytecode, as shown below
The bytecode is not readable, but we can use javap - classpath- C HelloWorld sees the following mnemonic
It is then loaded, linked, and initialized in the JVM
Since it has only one thread, we assume that it is the left thread in the following JVM runtime data area
The JVM thread is a user - level thread, so it maps to the kernel In Ubuntu, it is a one-to-one mapping, as follows:
Now the JVM makes x86 instructions? (Updated)
What is the role of the operating system for this particular program?
What is the next step in architecture?
Acquire instructions, decode, execute, access memory, and write back in 5 steps MIPs
reference:
> OS basics > Diagrams
This can be a very difficult problem Unlike the question of how to use an API, this requires almost everything
Solution
http://en.wikipedia.org/wiki/Java_virtual_machine
Pictures provided by Wikipedia: