Channels ▼

Gaston Hillar

Dr. Dobb's Bloggers

Silverlight 4 RC Stays With the Old .NET Threads; F# Helps

April 22, 2010

Silverlight 3 offered the possibility to take advantage of multiple processor cores by creating threads. So far, the recently launched Silverlight 4 RC stays with this old .NET multi-threading model and doesn't add features from the .NET Framework 4 Parallel Extensions. However, Visual Studio 2010 lets you integrate F# code in Silverlight applications.

This year, the following Microsoft developer frameworks will share a version number, 4:

  • .NET Framework 4
  • ASP.NET 4
  • Silverlight 4

If you create a new ASP.NET 4 Web Site or Web Application, you will be able to work against .NET Framework 4. However, if you create a new Silverlight 4 application, you won't be able to access the new .NET Framework 4 Parallel Extensions. The number 4 is confusing because developers associate it with the new features included in .NET Framework 4.

Silverlight 4 is still able to take advantage of multiple cores. You can access the System.Threading namespace, create threads, work with the thread pool, synchronize multiple threads and even use the System.ComponentModel.BackgroundWorker component. In fact, the asynchronous programming and multi-threading model available in Silverlight is very important to interact with a SharePoint 2010 Server and its Client Object Model.

However, the lack of support for Parallel Extensions won't let you work with the new task-based programming model and you will have to create threads to allow the microprocessor to run code in different cores. You will be able to take advantage of neither PLINQ (short for "Parallel Language INtegrated Query") nor the new concurrent collections. Thus, you will still have to work with the old .NET multi-threading model if you want your Silverlight applications to take advantage of multiple cores.

One of the great features offered by Silverlight has been its support for multiple threads to allow developers to prepare code to take advantage of multiple cores. The bad news is that this multicore support isn't evolving to add new features in Silverlight 4. Nevertheless, Visual Studio 2010 adds F# support in Silverlight 3 and 4, and therefore, you can use this functional language to create a new F# Silverlight library. Then, you can include this library in a Silverlight application and combine multiple threads with functional programming. In fact, Bart Czernicki has taken advantage of this new feature and wrote a very interesting article about the integration of F# code in a Silverlight 3 application. You can also do the same job targeting Silverlight 4. You can read Bart's article "Silverlight 3 and F# Support in Visual Studio 2010" and you will find that F# can open up a new world of possibilities in your Silverlight applications.

You can also read a previous post in which I wrote about Silverlight 3 Beta 1 multicore programming possibilities using C#. These possibilities are the same that you will find in Silverlight 4 RC.

Related Reading


More Insights






Currently we allow the following HTML tags in comments:

Single tags

These tags can be used alone and don't need an ending tag.

<br> Defines a single line break

<hr> Defines a horizontal line

Matching tags

These require an ending tag - e.g. <i>italic text</i>

<a> Defines an anchor

<b> Defines bold text

<big> Defines big text

<blockquote> Defines a long quotation

<caption> Defines a table caption

<cite> Defines a citation

<code> Defines computer code text

<em> Defines emphasized text

<fieldset> Defines a border around elements in a form

<h1> This is heading 1

<h2> This is heading 2

<h3> This is heading 3

<h4> This is heading 4

<h5> This is heading 5

<h6> This is heading 6

<i> Defines italic text

<p> Defines a paragraph

<pre> Defines preformatted text

<q> Defines a short quotation

<samp> Defines sample computer code text

<small> Defines small text

<span> Defines a section in a document

<s> Defines strikethrough text

<strike> Defines strikethrough text

<strong> Defines strong text

<sub> Defines subscripted text

<sup> Defines superscripted text

<u> Defines underlined text

Dr. Dobb's encourages readers to engage in spirited, healthy debate, including taking us to task. However, Dr. Dobb's moderates all comments posted to our site, and reserves the right to modify or remove any content that it determines to be derogatory, offensive, inflammatory, vulgar, irrelevant/off-topic, racist or obvious marketing or spam. Dr. Dobb's further reserves the right to disable the profile of any commenter participating in said activities.

 
Disqus Tips To upload an avatar photo, first complete your Disqus profile. | View the list of supported HTML tags you can use to style comments. | Please read our commenting policy.
 


Video