Difference between quot;call stackquot; and quot;thread stackquot;(“调用堆栈和“调用堆栈之间的区别和“线程堆栈)
问题描述
在 Java 多线程中,call stack
和 thread stack
这两个术语在语义上有区别吗?
Is there a semantic difference between the terms call stack
and thread stack
, in Java multithreading?
推荐答案
每个线程都有自己的调用栈,调用栈"和线程堆栈"是一回事.称其为线程堆栈".只是强调调用堆栈是特定于线程的.
Each thread has its own call stack, "call stack" and "thread stack" are the same thing. Calling it a "thread stack" just emphasizes that the call stack is specific to the thread.
Bill Venners 将此称为 Java 堆栈:
当一个新线程启动时,Java 虚拟机会为该线程创建一个新的 Java 堆栈.如前所述,Java 堆栈将线程的状态存储在离散帧中.Java 虚拟机只在 Java Stacks 上直接执行两个操作:压入和弹出帧.
When a new thread is launched, the Java virtual machine creates a new Java stack for the thread. As mentioned earlier, a Java stack stores a thread's state in discrete frames. The Java virtual machine only performs two operations directly on Java Stacks: it pushes and pops frames.
线程当前正在执行的方法是线程的当前方法.当前方法的堆栈帧是当前帧.定义当前方法的类称为当前类,当前类的常量池就是当前常量池.在执行方法时,Java 虚拟机跟踪当前类和当前常量池.当虚拟机遇到对堆栈帧中存储的数据进行操作的指令时,它会在当前帧上执行这些操作.
The method that is currently being executed by a thread is the thread's current method. The stack frame for the current method is the current frame. The class in which the current method is defined is called the current class, and the current class's constant pool is the current constant pool. As it executes a method, the Java virtual machine keeps track of the current class and current constant pool. When the virtual machine encounters instructions that operate on data stored in the stack frame, it performs those operations on the current frame.
当线程调用 Java 方法时,虚拟机会创建一个新帧并将其推送到线程的 Java 堆栈中.然后这个新帧成为当前帧.当方法执行时,它使用框架来存储参数、局部变量、中间计算和其他数据.
When a thread invokes a Java method, the virtual machine creates and pushes a new frame onto the thread's Java stack. This new frame then becomes the current frame. As the method executes, it uses the frame to store parameters, local variables, intermediate computations, and other data.
这篇关于“调用堆栈"和“调用堆栈"之间的区别和“线程堆栈"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:“调用堆栈"和“调用堆栈"之间的区别和“线程堆栈"
基础教程推荐
- 如何使用 Stream 在集合中拆分奇数和偶数以及两者的总和 2022-01-01
- 由于对所需库 rt.jar 的限制,对类的访问限制? 2022-01-01
- 如何强制对超级方法进行多态调用? 2022-01-01
- 如何在不安装整个 WTP 包的情况下将 Tomcat 8 添加到 Eclipse Kepler 2022-01-01
- Java 中保存最后 N 个元素的大小受限队列 2022-01-01
- 在螺旋中写一个字符串 2022-01-01
- 如何对 HashSet 进行排序? 2022-01-01
- 如何使用 Eclipse 检查调试符号状态? 2022-01-01
- 首次使用 Hadoop,MapReduce Job 不运行 Reduce Phase 2022-01-01
- Spring Boot Freemarker从2.2.0升级失败 2022-01-01