如果程序中有两个方法,那么在运行时会创建多少个堆栈? [英] If there are two methods in a program then how many stacks are created while it is running ?

查看:55
本文介绍了如果程序中有两个方法,那么在运行时会创建多少个堆栈?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

它们是如何创建的?

推荐答案

这取决于您使用的线程数量。每个线程都有一个堆栈。

It depends on how much threads you're using. There is one stack for each thread.

如果您的代码没有创建线程,答案将是一个。如果你的两个函数中的任何一个创建了新的线程(比如,第一个函数创建线程来运行第二个函数),它可以是数百个甚至数千个。

If your code do not create thread, the answer will be one. If any of your two function creates new thread (say, the first function creates thread to run the second function on it), it can be hundreds or even thousands.


这篇关于如果程序中有两个方法,那么在运行时会创建多少个堆栈?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆