Microsoft is building two new additions to its .Net framework that should make it much easier for programmers to utilize all the cores of a multicore processor.
The additions should not only ease the complexities of writing a program to run across multiple cores, but also address how the requirements for programs have changed over the past few years, said Danny Shih, the Microsoft program manager for .Net concurrency development.
"Applications are becoming more and more connected," Shih said, speaking at the Microsoft TechEd conference in Atlanta. "It's more common for applications to use Web services, to store data in the cloud, or offload general computation into the cloud."
This waiting for the data can be the source of latency, and badly written applications may just hang in a state of suspension until the data is delivered. Shih described a new approach to tackle this problem, called asynchronous programming.
The way data is handled is another area of change in the requirements of programs. Traditional programming assumes that a predefined data set already exists and the amount of the data is fairly well-known. Newer programs, however, may have to process a wildly varying amount of data.
The two new libraries, Asynch and The Task Parallel Library Dataflow (TPL Dataflow), both available in preview form for .Net and the Visual Studio IDE (integrated developer environment), address these problems.
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.
Sign up for MIS Asia eNewsletters.