How “Hello World” Gets Printed? – A Complete Life Cycle

I posted this question on Stack Overflow today because the complete life cycle of a simple program is interesting.

I will keep updating the post by using answers/comments to make it more complete and correct my mistake. I surely will up vote any answer/comment that makes sense. Please up vote or post answer/comment to help. Thanks a lot!

Question link: http://stackoverflow.com/q/16311867/127859

The following is THE HelloWorld program that everybody knows.

1

It is compiled to bytecode like the following.

2

The bytecode is not readable, but we can use javap -classpath . -c HelloWorld to see mnemonics like the following.

3

Then it gets loaded, linked and initialized in JVM.

4.

Since it has only one thread, let's assume it is the the left thread in the following JVM run-time data area.

5

JVM makes the x86 instructions.

JVM threads are user-level threads, so it will be mapped to kernel. In Ubuntu, it is one-to-one mapping like the following:

6

What is operating system's role for this particular program?

JVM is on top of gllibc, syscalls. io driver in os will be responsible for printing words in the console. io related syscalls should be implemented in io subsystem in os.

What is next in Architecture?

Fetch instruction, decode, execute, memory access, write back in 5-steps MIPS.

7

Category >> Java  
If you want someone to read your code, please put the code inside <pre><code> and </code></pre> tags. For example:
<pre><code> 
String foo = "bar";
</code></pre>