VB中MP支持的未来 [英] The future of MP support in VB

查看:92
本文介绍了VB中MP支持的未来的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人知道是否有计划在VB中为多核

处理器添加改进的支持?在VB中的新线程上启动一个进程很容易,但在实际应用程序中,它需要花费相当大的力气来管理

线程。例如,如果你循环遍历一个1000x1000数组,那么它可以很好地在自己的线程上运行每一行。但是,你不想创建1000个线程,因为这样做会大大降低性能。

因此,为了进行优化,你需要添加一个大量的

代码,这样每个CPU一次只执行一个线程。在我看来,像OpenMP这样的
将是一个理想的解决方案。 VB就是为了让事情变得轻松而OpenMP就是为了让多线程变得简单(或者至少比b $ b更容易)。对我来说听起来很不错。


感谢您的任何反馈。

Lance

Does anybody know if there are plans to add improved support for multi-core
processors in VB? It is easy to launch a process on a new thread in VB, but
in a real world application it can take a considerable effort to manage the
threads. For example, if you are looping through a 1000x1000 array, then it
would be nice to run each row on its own thread. But, you don''t want to
create 1000 threads because doing so will dramatically reduce performance.
So, in order to be optimized, you would need to add a considerable amount of
code so that only one thread per CPU executes at a time. It seems to me that
something like OpenMP would be an ideal solution. VB is all about making
things easy and OpenMP is all about making multithreading easy (or at least
easier). Sounds like a good match to me.

Thanks for any feedback.
Lance

推荐答案

Lance,


忙于多处理很长时间,我已经认识到

多处理通常是一个希望不是在计算机上实现

直接用户通信(多处理/编程在

批处理或多层操作中很棒)。你看到的链接不再多了

关于乐观的多处理和类似的东西。


只有当进程不是

相互依赖(并行处理)。非常昂贵的

处理器已经很久以前开始测试,乐观的处理是b
。 (杀死进程,因为它变得依赖于另一个进程)。 AFAIK

是尚未结束的测试。


多处理的一种方法是使用管道或多线程。


从NT4开始,它将进程划分为不同的物理处理器,这是每次在每个新版本的每个新版本中都优化的。

NT。


但是这个过程绝对不能相互依赖,否则你的处理器可能只计算依赖是否为
没有发生。


我希望这能给出一些想法'


Cor
Lance,

Being busy with multiprocessing very long, I have recognised that
multiprocessing is often a wish that not is to realize on computers with
direct user communication (Multiprocessing/programming is great to do in
batch processes or in multitier operations). You see not much links anymore
about optimistic multiprocessing and things like that.

Multiprocessing from one task, is only possible if the processes are not
depending from each other (parallel processing). On very expensive
processors is already a long time ago started tests with optimistic
processing. (Killing the process as it becomes depended from another). AFAIK
are those tests still not ended.

A way to do multiprocessing is using pipes or multithreading.

From the start of NT4 it divides processes over the different physical
processors, this is everytime optimized by Microsoft in every new version of
NT.

However the process should be in no way dependable from each other,
otherwise your processors are probably only calculating if the dependency is
not happened.

I hope this gives some idea''s,

Cor


Lance ,

为什么要将OpenMP功能限制在VB?


我希望框架本身能够从OpenMP中受益,允许C#,

管理C ++甚至Fortran.NET都可以从这些功能中受益。


虽然我没有使用OpenMP,但我同意简化多线程是

总是一个好处。

话虽如此,h你看过System.Threading.ThreadPool吗?


..NET 2.0将SetMaxThreads添加到ThreadPool,以允许你限制线程的最大数量。

http ://msdn2.microsoft.com/en-us/lib...axthreads.aspx


授权ThreadPool在您的应用程序中共享&你需要知道

更改它的参数。

..NET 2.0还引入了一个BackgroundWorker对象,它简化了创建

a后台线程,主要是适用于Windows应用程序。

http: //msdn2.microsoft.com/en-us/library/8xs8549b.aspx

http://msdn2.microsoft.com/en-us/lib...US,VS.80).aspx

我在Outlook的VSTO示例中使用了BackgroundWorker:

http://www.tsbradley.net/Samples/VST...rt.Sample.aspx


-

希望这有帮助

Jay [MVP - Outlook]

..NET应用程序架构师,爱好者,&福音传教士

T.S.布拉德利 - http://www.tsbradley.net

" ; ljlevend2" < LJ ******* @ nospam.nospam>在消息中写道

新闻:F0 ********************************** @ microsof t.com ...
Lance,
Why limit OpenMP features to VB?

I would expect the Framework itself to benefit from OpenMP, allowing C#,
managed C++ and even Fortran.NET to benefit from the features.

Although I have not used OpenMP, I do agree simplifying multi-threading is
always a benefit.
Having said that, have you looked at System.Threading.ThreadPool?

..NET 2.0 add SetMaxThreads to ThreadPool to allow you to limit the maximum
number of threads.

http://msdn2.microsoft.com/en-us/lib...axthreads.aspx

Granted ThreadPool is shared within your application & you need to be aware
of changing its parameters.
..NET 2.0 also introduces a BackgroundWorker object that simplifies creating
a background thread, primarily for Windows applications.

http://msdn2.microsoft.com/en-us/library/8xs8549b.aspx

http://msdn2.microsoft.com/en-us/lib...US,VS.80).aspx
I''ve used the BackgroundWorker in a VSTO sample for Outlook:

http://www.tsbradley.net/Samples/VST...rt.Sample.aspx

--
Hope this helps
Jay [MVP - Outlook]
..NET Application Architect, Enthusiast, & Evangelist
T.S. Bradley - http://www.tsbradley.net
"ljlevend2" <lj*******@nospam.nospam> wrote in message
news:F0**********************************@microsof t.com...
有人知道是否有计划在VB中为
多核处理器添加改进的支持?在VB中的新线程上启动一个进程很容易,但在实际的应用程序中,管理
线程可能需要相当大的努力。例如,如果你循环遍历1000x1000数组,那么
它会很好地在自己的线程上运行每一行。但是,你不想创建1000个线程,因为这样做会大大降低性能。
因此,为了进行优化,你需要增加相当数量的 br />代码,以便每个CPU一次只执行一个线程。在我看来,像OpenMP这样的东西将是一个理想的解决方案。 VB就是让事情变得简单而OpenMP就是让多线程变得简单(或者更容易)。听起来像是一个很好的匹配。

感谢您的任何反馈。
Lance
Does anybody know if there are plans to add improved support for
multi-core
processors in VB? It is easy to launch a process on a new thread in VB,
but
in a real world application it can take a considerable effort to manage
the
threads. For example, if you are looping through a 1000x1000 array, then
it
would be nice to run each row on its own thread. But, you don''t want to
create 1000 threads because doing so will dramatically reduce performance.
So, in order to be optimized, you would need to add a considerable amount
of
code so that only one thread per CPU executes at a time. It seems to me
that
something like OpenMP would be an ideal solution. VB is all about making
things easy and OpenMP is all about making multithreading easy (or at
least
easier). Sounds like a good match to me.

Thanks for any feedback.
Lance



Hi Jay,


非常感谢您的想法。我已经研究过BackgroundWorker,但是它很难用于b $ b。对于复杂的多线程情况,我需要比BackgroundWorker提供的更多的灵活性和b
和控制。另一方面,

在我的应用程序中实现数百个简单的循环,在多线程提供一个
$ b $的时候,实现BackWorker将非常​​耗费时间。 b多核系统的性能提升。


Visual C ++ 2005支持OpenMP,如2005年10月的b $ b MSDN杂志中所述。我发现这篇文章非常令人沮丧,因为我问自己的问题非常类似于你提出的问题。在多线程快速成为必需品的时候,为什么要将OpenMP限制为
C ++?如果没有一个能够大大简化编程中最容易出错的b $ b b复杂和容易出错的任务的功能,VB是否会更好?我认为VB完全是为了让事情变得简单和程序员友好。我猜那个VB团队确定我的价格比MP更重要:(


Lance

" Jay B. Harlow [MVP - Outlook]"写道:
Hi Jay,

Thanks a lot for the ideas. I have looked into BackgroundWorker but it is
hardly useful. For complex multithreading situations I need more flexibility
and control than what BackgroundWorker provides. On the other hand,
BackgroundWorker would be prohibitively time consuming to implement in the
hundreds of simple loops within my app where multithreading would provide a
performance boost on multicore systems.

Visual C++ 2005 supports OpenMP as described in the October 2005 issue of
MSDN Magazine. I found this article very frustrating because I was asking
myself questions very similar to those that you raised. Why limit OpenMP to
C++ at a time when multithreading is quickly becoming a necessity? Is VB
better off without a feature that would dramatically simplify one of the most
complex and error prone tasks in programming? I thought that VB was all
about making things as easy and programmer friendly as possible. I guess the
VB team decided that MY was more important than MP :(

Lance
"Jay B. Harlow [MVP - Outlook]" wrote:
Lance,
为什么要将OpenMP功能限制在VB?

我希望框架本身能够受益来自OpenMP,允许C#,
托管C ++甚至Fortran.NET从这些功能中受益。

虽然我没有使用OpenMP,但我同意简化多线程是
总是有利。

话虽如此,你看过System.Threading.ThreadPool吗?

.. NET 2.0将SetMaxThreads添加到ThreadPool以允许你限制最大值
线程数。

http://msdn2.microsoft.com/en-us/lib...axthreads.aspx

授权的ThreadPool在您的应用程序和您之间共享需要注意
o改变它的参数。

..NET 2.0还引入了一个BackgroundWorker对象,它简化了后台线程的创建,主要用于Windows应用程序。

http://msdn2.microsoft.com/en-us/library/8xs8549b。 aspx
http://msdn2.microsoft.com/en-us/lib...US,VS.80).aspx

我已经在Outlook的VSTO示例中使用了BackgroundWorker:

http://www.tsbradley.net/Samples/VST...rt.Sample.aspx

- 希望这有助于
.. NET应用架构师,爱好者,&福音传道者
T.S.布拉德利 - http://www.tsbradley.net

" ; ljlevend2" < LJ ******* @ nospam.nospam>在消息中写道
新闻:F0 ********************************** @ microsof t.com。 ..
Lance,
Why limit OpenMP features to VB?

I would expect the Framework itself to benefit from OpenMP, allowing C#,
managed C++ and even Fortran.NET to benefit from the features.

Although I have not used OpenMP, I do agree simplifying multi-threading is
always a benefit.
Having said that, have you looked at System.Threading.ThreadPool?

..NET 2.0 add SetMaxThreads to ThreadPool to allow you to limit the maximum
number of threads.

http://msdn2.microsoft.com/en-us/lib...axthreads.aspx

Granted ThreadPool is shared within your application & you need to be aware
of changing its parameters.
..NET 2.0 also introduces a BackgroundWorker object that simplifies creating
a background thread, primarily for Windows applications.

http://msdn2.microsoft.com/en-us/library/8xs8549b.aspx

http://msdn2.microsoft.com/en-us/lib...US,VS.80).aspx
I''ve used the BackgroundWorker in a VSTO sample for Outlook:

http://www.tsbradley.net/Samples/VST...rt.Sample.aspx

--
Hope this helps
Jay [MVP - Outlook]
..NET Application Architect, Enthusiast, & Evangelist
T.S. Bradley - http://www.tsbradley.net
"ljlevend2" <lj*******@nospam.nospam> wrote in message
news:F0**********************************@microsof t.com...
有没有人知道是否有计划在VB中添加对多核处理器的改进支持?在VB中的新线程上启动一个进程很容易,但在实际的应用程序中,管理
线程可能需要相当大的努力。例如,如果你循环遍历1000x1000数组,那么
它会很好地在自己的线程上运行每一行。但是,你不想创建1000个线程,因为这样做会大大降低性能。
因此,为了进行优化,你需要增加相当数量的 br />代码,以便每个CPU一次只执行一个线程。在我看来,像OpenMP这样的东西将是一个理想的解决方案。 VB就是让事情变得简单而OpenMP就是让多线程变得简单(或者更容易)。听起来很像我。

感谢您的反馈。
Lance
Does anybody know if there are plans to add improved support for
multi-core
processors in VB? It is easy to launch a process on a new thread in VB,
but
in a real world application it can take a considerable effort to manage
the
threads. For example, if you are looping through a 1000x1000 array, then
it
would be nice to run each row on its own thread. But, you don''t want to
create 1000 threads because doing so will dramatically reduce performance.
So, in order to be optimized, you would need to add a considerable amount
of
code so that only one thread per CPU executes at a time. It seems to me
that
something like OpenMP would be an ideal solution. VB is all about making
things easy and OpenMP is all about making multithreading easy (or at
least
easier). Sounds like a good match to me.

Thanks for any feedback.
Lance




这篇关于VB中MP支持的未来的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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