Microsoft regearing .Net for easy concurrency

17.05.2011

Parallel programming is not new to .Net. Version 4 of .Net already includes some tools to help create a program that runs on multiple processors, most notably APM (Asynchronous Programming Model) and the Event-based Asynchronous Pattern (EAP).

"These patterns were pretty good when they came out, but as asynchronous programming became more prevalent, we're finding more and more flaws with these patterns," Shih said. One is complexity: Shih showed an example of how four lines of code can balloon to more than 40 by using APM.

In a program with a standard "synchronous" approach, as Shih called it, the program halts executing until the data it requested is delivered. The Async library offers a set of keywords that developers can use to signify a block of code can be executed in parallel with the rest of the program. The "await" keyword, for instance, when placed in front of a block of code such as a method, tells the rest of the program not to wait for the results of that operation.

Shih said that the company is developing Async for inclusion in a future version of .Net. It will first be implemented in Microsoft's own C# and Visual Basic languages, with the hope it will be adopted by other languages as well.

Async in a CTP (Community Technology Preview) that can run on the newest edition of Visual Studio. The download replaces the standard compiler with one that supports the new keywords.