Associating a Java program with an operating system

I am wondering how this happens: as a Java program mapped to an OS process (like the one below for Linux):
borrowed from: linuxjournal.com

In C, this is a simple association in how the program is written and how the entire call stack continues in the OS. I was wondering how display in Java is achieved? Is the meth () method used by the object: obj used, just translate it to look for the address obj.meth () and then use the stack to use it like it is in C?

Thanks in advance!

Edit: I would also be interested to know the model that other OOP languages ​​use (C ++, Python, etc.).

+4
source share
2 answers

This is a rather difficult problem. Here is a pretty good article about this topic. In short, Java got two runtime modes that greatly affect memory layout.

  • Some code is executed by intepreter
  • Some codes are compiled into native code to improve performance.

See this wiki page: http://en.wikipedia.org/wiki/Just-in-time_compilation .

And the JVM got more of a type of memory area, like perm-gen, memory for JIT, etc.

This is well discussed in other threads:

+4
source

Most Java JVMs are simple C programs. Thus, the picture will be the same as the first class file that is interpreted / executed.

After that, it depends on the implementation of the JVM. Usually they use the stack store to track information such as control, for example, which classes are loaded, which threads are started, etc. For real “software” storage, the interpreter and garbage collector will use a simple “malloc” / “mfree” to allocate and free memory, plus some fairly complex management structures to allow the garbage collector to function.

+1
source

Source: https://habr.com/ru/post/1412685/


All Articles