F#是否为您提供自动并行性? [英] Does F# provide you automatic parallelism?

查看:83
本文介绍了F#是否为您提供自动并行性?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的意思:当您免费设计应用副作用时,F#代码会自动分布在所有内核上吗?

By this I meant: when you design your app side effects free, etc, will F# code be automatically distributed across all cores?

推荐答案

不,恐怕不是.鉴于F#不是严格意义上的功能语言,我认为这样做相当困难.在F#中充分利用并行性的主要方法是使用 Async Workflows (主要通过我认为的Async模块). .NET 4.0中引入的TPL(任务并行库)将在F#中扮演类似的角色(尽管值得注意的是,它可以在所有.NET语言中同样有效地使用),尽管我不能说我确保确切将如何与现有的异步框架集成.也许微软会简单地建议在所有事物上都使用TPL,或者也许将两者保留为一种选择,并且最终将成为事实上的标准...

No, I'm afraid not. Given that F# isn't a pure functional language (in the strictest sense), it would be rather difficult to do so I believe. The primary way to make good use of parallelism in F# is to use Async Workflows (mainly via the Async module I believe). The TPL (Task Parallel Library), which is being introduced with .NET 4.0, is going to fulfil a similar role in F# (though notably it can be used in all .NET languages equally well), though I can't say I'm sure exactly how it's going to integrate with the existing async framework. Perhaps Microsoft will simply advise the use of the TPL for everything, or maybe they will leave both as an option and one will eventually become the de facto standard...

无论如何,这里有一些有关F#中异步编程/工作流的文章,可以帮助您入门.

Anyway, here are a few articles on asynchronous programming/workflows in F# to get you started.

  • http://blogs.msdn.com/dsyme/archive/2007/10/11/introducing-f-asynchronous-workflows.aspx
  • http://strangelights.com/blog/archive/2007/09/29/1597.aspx
  • http://www.infoq.com/articles/pickering-fsharp-async

这篇关于F#是否为您提供自动并行性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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