zoukankan      html  css  js  c++  java
  • 初识Parallel Extension

     

    初识Parallel Extension

    LazyBee

    随着双核处理器的逐渐普及标志着多核处理器的时代已经来临。为了适应这种变化,充分利用多核的硬件资源,微软正在研发下一代并行系列框架(Parallel FX)。PLINQ(Parallel LINQ)TPL(Task Parallel Liberary)就是其中的关键组件。同时也在加大力度研发自己的在并行方面应用出色的函数式语言F#(目前版本是1.9.3RC)。目前微软已经将PLINQTPL包含在Parallel Extension中,在200712月,微软推出了Parallel ExtensionCTP版本(社区预览版),你可以通过以下地址http://www.microsoft.com/downloads/details.aspx?FamilyID=e848dc1d-5be3-4941-8705-024bc7f180ba&displaylang=en去下载这个版本。在运行安装文件ParallelExtensions_Dec07CTP.msi之后,在C:\Program Files下将创建Microsoft Parallel Extensions Dec07 CTP目录,在目录中包含文档、示例以及System.Threading.dll文件(安装时已经增加到GAC中了),PLINQTPL就包含在System.Threading.dll文件中.在安装完成之后,你就可以非常方便的使用并行扩展创建你的并行程序。

    为了使用PLINQ,你只需要简单的将System.Threading.dll添加到应用库中,然后调用System.Linq.ParallelQuery.AsParallel扩展方法即可,例如我们有这样的LINQ代码片段:

    string[] words = new[] { "Welcome", "to", "Beijing" };

    (from word in words select Process(word)).ToArray();

    我们很容易就可以将其变成PLINQ版本:

    string[] words = new[] { "Welcome", "to", "Beijing" };

    (from word in words.AsParallel() select Process(word)).ToArray();

    是不是很容易?当然其中也会有很多注意事项,我该回家了,先写到这里。以后接着写

  • 相关阅读:
    画笔
    进程和线程<二>
    进程和线程<一>
    文件<2>
    文件<1>
    窗口(3)
    窗口<二>
    窗口(1)
    消息
    位图
  • 原文地址:https://www.cnblogs.com/LazyBee/p/1095544.html
Copyright © 2011-2022 走看看