.NET 应用程序中的最大线程数? [英] Maximum number of threads in a .NET app?

查看:53
本文介绍了.NET 应用程序中的最大线程数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您可以在 C# 应用程序中创建的最大线程数是多少?当你达到这个限制时会发生什么?是否抛出某种异常?

What is the maximum number of threads you can create in a C# application? And what happens when you reach this limit? Is an exception of some kind thrown?

推荐答案

没有固有限制.最大线程数由可用物理资源量决定.请参阅这篇Raymond Chen 的文章了解详情.

There is no inherent limit. The maximum number of threads is determined by the amount of physical resources available. See this article by Raymond Chen for specifics.

如果您需要询问最大线程数是多少,您可能做错了什么.

If you need to ask what the maximum number of threads is, you are probably doing something wrong.

[更新:只是出于兴趣:.NET 线程池默认线程数:

[Update: Just out of interest: .NET Thread Pool default numbers of threads:

  • Framework 4.0 中的 1023(32 位环境)
  • Framework 4.0(64 位环境)中的 32767
  • Framework 3.5 中每个内核 250 个
  • Framework 2.0 中每个内核 25 个

(这些数字可能因硬件和操作系统而异)]

(These numbers may vary depending upon the hardware and OS)]

这篇关于.NET 应用程序中的最大线程数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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