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

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

问题描述

一个注释我的另一个问题说,我只能运行这么多线程concurretnly,这是我在其他地方看到的概念。

A comment to another of my questions says that I can only run "so many" threads concurretnly, 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?

(VB在微软的Visual Studio中与.net 3.5,如果该事项)

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

更新:有没有人知道任何S / W的工具,它可以建议多个线程(或任务),或者我应该只是code我自己这使尝试不同的数字,直到吞吐量下降。

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?

推荐答案

这取决于硬件你(可能)不使用计算机理论,但在物理硬件之一,所以你只有有限的资源。

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天全站免登陆