Silverlight 4 RC Stays With the Old .NET Threads; F# Helps
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.

