线程池。为什么为什么如此难以设置最大尺寸? :( [英] ThreadPool. Why why why is so difficult to set the max size? :(

查看:99
本文介绍了线程池。为什么为什么如此难以设置最大尺寸? :(的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么微软会如此努力地改变最大游泳池大小?


我真的需要将它改为50,因为我正在使用代表与

BeginInvoke,我看到他们(代理人)使用ThreadPool,但我也看到了

,这对于改变ThreadPool大小非常复杂,如果我想要,我

需要使用非管理资源

http://www.csharpfriends.com/Article...?articleID=201


如果我使用非管理资源,我的应用程序将无法移植到其他操作系统


所以,有人知道另一种方式或者知道一些我不会的事情。
非常感谢


AA

解决方案

滚动你自己。 50个线程或其他任何东西的简单数组:D


对我有一个更大的控制权很好,在我看来,这是他们的一半努力再次。


" AA" < aa@personal.net.py>在消息中写道

新闻:#B ************** @ TK2MSFTNGP12.phx.gbl ...

为什么微软会如此难以改变最大池大小?

我真的需要将它改为50,因为我正在使用带有
BeginInvoke的代表,我看到他们(代理人)使用ThreadPool ,但是我也看到了
,改变ThreadPool大小非常复杂,如果我想,我需要使用非管理资源

http://www.csharpfriends.com/Article...?articleID=201

如果我使用非管理资源,我的应用程序将无法移植给其他人
OS
所以,有人知道另一种方式或知道我不知道的事情
非常感谢

AA



改变最大尺寸这么难的原因是因为

线程池已经优化为han将机器上运行的进程与

中的进程数相结合。

这个想法是,如果你有这么多线程,你实际上开始

在上下文切换中浪费时间拍摄自己的脚。


我建议原样使用ThreadPool。


希望这会有所帮助。


-

- Nicholas Paldino [.NET / C#MVP]

- < a href =mailto:mv*@spam.guard.caspershouse.com> mv*@spam.guard.caspershouse.com

" AA" < aa@personal.net.py>在消息中写道

新闻:%2 **************** @ TK2MSFTNGP12.phx.gbl ...

为什么选择微软如此难以改变最大池大小?

我真的需要将它改为50,因为我正在使用带有
BeginInvoke的代表,我看到他们(代表)使用ThreadPool,但是我也看到
改变ThreadPool大小非常复杂,如果我想,我需要使用非管理资源

http://www.csharpfriends.com/Article...?articleID=201

如果我使用非管理资源我的应用程序将无法移植到其他人
OS
所以,有人知道另一种方式或知道我不知道的事情

非常感谢

AA



如果你需要特定的保证,我不推荐使用线程池。


Nicholas Pal dino [.NET / C#MVP]" < mv*@spam.guard.caspershouse.com>写在

消息新闻:#y ************* @ TK2MSFTNGP11.phx.gbl ...

原因是很难改变最大尺寸是因为
线程池已经过优化,可以处理与机器上运行的进程相结合的进程数。

这个想法是如果你有这么多线程,你实际上开始在上下文切换中浪费时间拍摄自己。

我建议按原样使用ThreadPool。

希望这会有所帮助。

-
- Nicholas Paldino [.NET / C#MVP]
- mv*@spam.guard.caspershouse.com

" AA" < aa@personal.net.py>在消息中写道
新闻:%2 **************** @ TK2MSFTNGP12.phx.gbl ...

为什么微软如此努力更改最大池大小??

我真的需要将它更改为50,因为我正在使用带有
BeginInvoke的委托,我看到他们(委托)使用ThreadPool,但是I
也看到了改变ThreadPool大小非常复杂,如果我想,
我需要使用unmanage资源

http://www.csharpfriends.com/Article...?articleID=201

如果我使用unmanage资源我的应用程序将无法移植


其他操作系统


所以,有人知道另一种方式或知道我的事情不要

非常感谢

blockquote>



Why microsoft make so hard to change the max Pool Size??

I really need to change it to 50, because I''m using delegates with
BeginInvoke and I saw that they (delegates) use the ThreadPool, but I saw
too that is very complicate to change the ThreadPool size and if I want, I
need to use unmanage resources

http://www.csharpfriends.com/Article...?articleID=201

If I use unmanage resources my application will not be portable to others OS

So, somebody know another way or know something that I don''t

Thanks a lot

AA

解决方案

Roll yer own. Simple array of 50 threads or whatever :D

Would be nice to have some greater control over this, in my view its a half
assed effort from them again.


"AA" <aa@personal.net.py> wrote in message
news:#B**************@TK2MSFTNGP12.phx.gbl...

Why microsoft make so hard to change the max Pool Size??

I really need to change it to 50, because I''m using delegates with
BeginInvoke and I saw that they (delegates) use the ThreadPool, but I saw
too that is very complicate to change the ThreadPool size and if I want, I
need to use unmanage resources

http://www.csharpfriends.com/Article...?articleID=201

If I use unmanage resources my application will not be portable to others OS
So, somebody know another way or know something that I don''t

Thanks a lot

AA



The reason that it is so hard to change the max size is because the
thread pool has been optimized to handle the number of processes in
conjunction with the processes running on the machine.

The idea is that if you have so many threads, you actually start to
shoot yourself in the foot with the time wasted in context switches.

I would recommend using the ThreadPool as is.

Hope this helps.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com
"AA" <aa@personal.net.py> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...

Why microsoft make so hard to change the max Pool Size??

I really need to change it to 50, because I''m using delegates with
BeginInvoke and I saw that they (delegates) use the ThreadPool, but I saw
too that is very complicate to change the ThreadPool size and if I want, I
need to use unmanage resources

http://www.csharpfriends.com/Article...?articleID=201

If I use unmanage resources my application will not be portable to others OS
So, somebody know another way or know something that I don''t

Thanks a lot

AA



If you need specific gurantees, i dont recommend using the threadpool.


"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in
message news:#y*************@TK2MSFTNGP11.phx.gbl...

The reason that it is so hard to change the max size is because the
thread pool has been optimized to handle the number of processes in
conjunction with the processes running on the machine.

The idea is that if you have so many threads, you actually start to
shoot yourself in the foot with the time wasted in context switches.

I would recommend using the ThreadPool as is.

Hope this helps.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com
"AA" <aa@personal.net.py> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...

Why microsoft make so hard to change the max Pool Size??

I really need to change it to 50, because I''m using delegates with
BeginInvoke and I saw that they (delegates) use the ThreadPool, but I saw too that is very complicate to change the ThreadPool size and if I want, I need to use unmanage resources

http://www.csharpfriends.com/Article...?articleID=201

If I use unmanage resources my application will not be portable to

others OS


So, somebody know another way or know something that I don''t

Thanks a lot

AA




这篇关于线程池。为什么为什么如此难以设置最大尺寸? :(的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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