Using F # To implement parallel programming in Silverlight

Source: Internet
Author: User

With the release of. NET 4, the. NET platform for parallel programming is a breeze. In fact, Microsoft provides you with three basic functions for parallel programming. The first is the Concurrency Runtime (concurrency Runtime) that is provided to C + +, and the second is by using the. NET platform provides a set of parallel programming functions for managed languages (including TPL, PLINQ, and parallel programming data structures, etc.), and the last one is based on the parallel programming features of F # itself.

However, because of the streamlining, the current coreclr does not include a parallel function library in. NET 4, making it impossible to directly gain the ability to parallel programming in Silverlight, even in the latest Silverlight 4. But let's not be discouraged, we can also use F # in Silverlight to implement parallel programming.

Bart Czernicki Detailed this approach in his blog, Silverlight 3 and F # Support in Visual Studio 2010. In this blog post, Bart gives the concrete steps to use F # for parallel programming, the corresponding sample code, and the discussion of performance, and a very interesting point of view:

Concurrent programming is the largest feature of Silverlight beyond other RIA technologies.

Bart also mentions the benefits of using F # to assist in parallel programming in Silverlight:

Do not have to explicitly start and stop a thread (for example, call Thread.Start)

No need to use BackgroundWorker

No callback required (AsyncCallback)

No need to follow asynchronous patterns such as BeginExecute

Of course, there are many drawbacks to implementing parallel programming in Silverlight through F #:

You cannot use PLINQ

If your code is written mainly by C # and VB, you can only write a wrapper in F # to implement parallelism in disguise.

Currently this is only available on Silverlight 3 because F # Runtime for Silverlight publishes only the Silverlight 3 version, whereas Silverlight 4 version of F # runs in Silverlight 4 The Tools for VS2010 are available when they are officially released.

For the last point above, Gaston Hillar's Blog "Silverlight 4 RC stays with the" old. NET Threads; F # helps has also been mentioned.

However, while we can now work on parallel programming in Silverlight, we still want Microsoft to provide direct parallel programming capabilities in future Silverlight versions.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.