In the automatic memory allocation of Java, we see a sentence:
If the thread is executing a Java method, this counter records the address of the virtual machine bytecode instruction being executed, and if the native method is being executed, the counter value is empty (undefined);
Problem:
We know that the program counter is used to hold the byte code instruction address, through this address, the virtual machine can know where to execute, and how to execute, can call the native method, the value becomes empty, then the machine does not directly crash?
Explain:
The reference to C + + understanding is that when a thread calls the native method, it restarts a new thread , and the new thread's counter is empty without affecting the current thread's counters, independent of each other.
Problem:
If it is a newly started thread, will it not be possible to control the order of execution because of the thread async problem?
Explain:
The current thread should be blocked , knowing that another thread has finished executing. For example: To control congestion through a dead loop (of course the dead cycle is too inefficient, here is just an example)
The JVM executes the native method, the counter is empty (undefined), and how does the Java code continue to execute the problem?