Sunday, November 30, 2008

‘Concurrency’ – The elephant in the room . . .

Concurrency is one of the biggest challenges the industry is working on now days. Anders mentioned about the details of this in his talk ‘Future of C#’ at PDC.
So what’s the problem about?
Concurrency is about doing multiple tasks simultaneously. Most of our applications today do this asynchronous programming using multiple threads/processes but they all work on a Single CPU.
This worked fine until now as the single CPU’s were getting faster and faster as per the Moore’s Law and hence the applications would also just run faster without us having to do anything.
But now we are facing some physical limitations increasing the speed of a Single CPU. So to increase the processing power we need to have multiple CPU’s in a single machine. Hence we are already getting many core machines with 2, 4, 8 to 64 CPU’s.
So how does this impact us as a Developer?
With this solution in place the traditional asynchronous programming isn’t going to help us scale our applications. We would have to create programs which can divide their workload into tasks that can be executed in parallel on Multiple CPU’s.

Parallel FX (PFX)

Microsoft is developing a number of technologies to simplify parallel programming. Parallel Extensions for the .NET Framework (PFX) is an example of this. It is a managed programming model for data parallelism, task parallelism, scheduling, and coordination on parallel hardware. This technology was first discussed by Anders Hejlsberg and Joe Duffy in Oct 2007 and was initially provided as an extension library but it’s now deeply integrated into the .Net Framework 4.0.

Task Parallel Library (TPL)
The basic unit of parallel execution in the TPL is a ‘Task’. The Parallel.For() and Parallel.ForEach() static methods create a Task for each member of the source IEnumerable and distribute execution of these across the machine’s available processors using User Mode Scheduling.

Parallel LINQ (PLINQ)
We can setup a LINQ query for parallel execution using PLINQ. We just need to wrap IEnumerable<T> in an IParallelEnumerable<T> by calling the AsParallel() extension method.

Daniel Moth did an excellent presentation on PFX at Tech-Ed which you can watch here.

For more details you can go to the PFX Team blog site which contains lots of videos and tutorials on parallel programming.

Monday, November 17, 2008

First Look at - "Windows 7"

Install Experience :




Its just a 2 step pretty smooth installation procedure. Took me about an hour to finish the entire thing.
The theme and the UX looks similar to Vista with a few tweaks here and there.

The wordpad has the office ribbons and the calculator has a new UI with additional modes :


Another good feature is the new search capabilities.
Open the search and type this " How much RAM is on this computer " -> and than click on the result link . . . .


that would take you to the system properties . . . isn't that cool !!!

There are many other refinements to poke around so worth having a look . . .

Monday, November 10, 2008

'System.Dynamic' namespace missing on VS2010 CTP

Finally I got my hands on all the materials from this year’s PDC including the VPC with VS 2010 CTP, Oslo, WF & WCF 4.0 and other bits.

The first thing I wanted to try out was the new ‘dynamic’ keyword and the creation of dynamic classes but I found that I can’t seem to refer to the ‘System.Dynamic’ namespace as mentioned in Anders Session.

Googling around I found the resolution around this issue here. I just had to slightly modify the code to include a generic dictionary for the dynamic property dispatching as below :


Enjoy dynamic learning,

Sunday, November 09, 2008

Webcasts on Oslo, WCF, WF (.net 4.0) & Dublin

Just found these 2 webcasts by Alan Smith reviewing some of the recent bits provided from PDC 08 :

Enjoy Learning !!!