The compiler book(The dragon book) explains that value types are created on the stack, and reference types are created on the heap.
For Java, JVM also contains heap and stack in runtime data area. Objects and arrays are created on heap, method frames are pushed to stack. One heap is shared by all threads, while each thread has its own stack. The following diagram shows this:
More about Java run-time data areas.
What I don't understand is that since JVM is essentially a software, how are those JVM heap, stack and threads mapped to physical machine?
I would appreciate it if someone can compare those concept between Java and C++. Because Java runs on JVM, but C++ does not.
To make this question more precise, I want to know the following:
- Comparing with Java, What does C++ run-time data area look like? A picture would be helpful, I can't find a good picture like the JVM one above.
- How the JVM heap, stack, registers and threads are mapped to operating system? or I should ask how they are mapped to physical machine?
- Is it true that each JVM threads is simply a user thread and gets mapped to kernal in some way? (user thread vs kernel thread)
Update:
I draw a picture for runtime physical memory of a process.