Java / JVM Architecture (Java21) Interview questions
What is the PC (Program Counter) Register?
The PC Register is a small, per-thread register that holds the address of the JVM instruction the thread is currently executing.
As a thread steps through bytecode, the PC Register is updated after every instruction so execution can resume at the right place, which matters particularly when a thread is paused and later scheduled again.
If the currently executing method is native (not Java bytecode), the value of the PC Register is undefined, since native code execution is not tracked by JVM bytecode addresses.
More Related questions...