.NET Framework 对多核硬件的支持
我的任务是编写一个在多核机器上运行的高性能、高可用性服务。
我是否需要利用任务并行库来真正利用多核服务器,或者如果我向其投入更多硬件(核心),服务会自动运行得更快吗? .NET 框架是否在幕后为我提供了魔力?
作为推论,对于不使用 TPL 的 .NET 应用程序,通过使用更多内核升级服务器(保持每个内核的规格相同)是否会带来性能提升?
根据我的理解(仔细阅读 Joe Duffy 的书和他的博客),您确实需要针对多核进行编程。 我的结论准确吗?
I've been tasked to write a high performance, high availability service that will run on a multicore box.
Do I need to make use of Task Parellel Library to really leverage a multicore server or will the service automagically run faster if I throw more hardware (cores) at it? Does the .NET framework provide the magic for me under the covers?
As a corollary, will there be performance gains by upgrading the server with more cores (keeping the spec of each individual core the same) for .NET applications that do not use TPL?
As per my understanding (perusing Joe Duffy's book and his blogs), you really do need to program for multicore. Is my conclusion accurate?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
这很难准确回答,因为并行处理不是一个普遍问题。 您需要分析您的项目以找到可以利用并行处理的地方。
如果您的应用程序可以轻松分解为具体的独立任务,那么并行处理肯定会得到改善。 如果其本质上主要是串行的,那么多个核心/线程根本没有任何帮助。
如果您确定并行任务代表流程的核心,那么并行库可以帮助您执行基本任务并使其更容易正确执行。
This is difficult to answer accurately since parallel processing is not a generic problem. You'll need to analyze your project to find places where you can leverage parallel processing.
If your application can be easily broken down into concrete independent tasks, parallel processing will definitely improve. If its primarily serial in nature, multiple cores/threads won't really help at all.
If you've determined that parallel tasks represent the core of your process, a parallel library can help you perform the basic tasks as well as make it easier to get right.
看一下PLinq,它将出现在.Net 4.0 中。 它将为您提供大量并行处理能力,而无需管理任务/负载算法。
Take a look at PLinq which will be coming in .Net 4.0. It will give you a lot of parallel processing capabilities without needing to manage task/load algorithms.
一个程序需要有多个执行路径才能利用 1 个以上的核心/处理器。 通常,这是通过运行多个线程来完成的,因为大多数操作系统提供多个执行路径的唯一方法是运行多个进程(可执行文件)或一个进程内的多个线程。
现代语言中内置了一些高级抽象,可以更轻松地处理本质上的多线程,但最好先学习基础知识; 线程
A program needs to have several paths of execution to leverage anything more than 1 core/processor. Typically this is done by running more than 1 thread, as most OS's only way of providing more than execution path is either by running several processes(executables) or several threads within one process.
There's several high level abstractions built into modern languages to more easily dealing with what is essentially multi-threading, but better learn the basics first; Threads