我可以同时运行多少个线程? [英] How many threads can I run concurrently?

查看:50
本文介绍了我可以同时运行多少个线程?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的另一个问题的评论说我只能同时运行这么多"线程,这是我在别处见过的概念.

A comment to another of my questions says that I can only run "so many" threads concurrently, a notion which I have seen elsewhere.

作为线程新手,如何确定使用的最大线程数?或者这是一个一段字符串有多长"的问题?它取决于什么?硬件配置还是什么?

As a threading novice, how can I determine the maximum number of threads to use? Or is this a "how long is a piece of string" question? What does it depends on? Hardware config or what?

(带有 .Net 3.5 的 MS Visual Studio 中的 VB,如果这很重要)

(VB in MS Visual Studio with .Net 3.5, if that matters)

更新:是否有人知道任何可以建议多个线程(或任务)的软件工具,或者我应该自己编写代码,不断尝试不同的数字直到吞吐量下降?

Update: is anyone aware of any s/w tool which could suggest a number of threads (or tasks), or should I just code my own which keeps trying different numbers until throughput drops?

[更新日期] 将近七年后 &我们现在有一个软件推荐网站,所以我询问是否有工具可以帮助解决此问题.

[Upperdate] Almost seven years later & we now have a software recommendations site, so I asked if there is a tool to help with this.

推荐答案

这取决于硬件,因为您(可能)使用的不是理论计算机而是物理硬件,因此您的资源有限.

It depends on hardware as you're (probably) not using a theoretical computer but a physical hardware one, so you have limited resources.

阅读:Windows 是否有 2000 个线程的限制每个进程?

此外,即使您可以运行 5000 多个线程(取决于您的硬件),其运行速度也可能比 10 线程等效程序慢得多.我认为你应该看看线程池.

Furthermore, even if you could run 5000+ threads, depending on your hardware, that could run much slower than a 10 thread equivalent program. I think you should take a look at thread pooling.

这篇关于我可以同时运行多少个线程?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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