Microsofts PLinq to Speed Program Execution

Microsoft is working on a parallel version of its Language Integrated Query technology that will enable code to run on multiple CPUs.

Microsoft is working on a parallel implementation of its Language Integrated Query technology that will help programs execute faster, said the creator of the LINQ technology.

Anders Hejlsberg, a Microsoft technical fellow and lead architect for the C# language, said Microsoft has an internal project known as PLinq, which is an effort to create a parallel implementation of LINQ.

"With PLinq, effectively you write the code the same way, but we arrange for it to run on multiple CPUs," Hejlsberg said in an interview at Microsoft in early August. "So the queries get split up and run on multiple CPUs, and then you just wait for all the results to arrive. And lo and behold, without any changes your program just ran six times faster. Its instant gratification."

However, Hejlsberg warns that PLinq is not applicable to every program.

"It doesnt necessarily mean that every program is going to run six times faster, but there are classes of programs that we can make run faster without the user having to get into the nitty-gritty business of writing concurrent constructs," Hejlsberg said.

Indeed, the more the industry looks at concurrency and parallel computing, "the more it becomes obvious that there is no one single bullet that we can shoot thats going to make all these cores busy all the time," Hejlsberg said. But there are classes of problems that technology like PLinq can be applied to, he said.

LINQ is a set of language extensions to the C# and Visual Basic programming languages that extend the Microsoft .Net Framework by providing integrated querying for objects, databases and XML data. Using LINQ, developers will be able to write queries natively in C# and Visual Basic without having to use other languages, such as SQL (Structured Query Language) or XQuery, Microsoft said.

In a blog post from September 2005, Danny Thorpe, then chief scientist for Windows and .Net developer tools at Borland Software and now a developer on Microsofts Windows Live Platform team, asked what if the LINQ query back end distributed data across multiple processors in multiple threads.

Thorpe noted that this would be "incredibly powerful."

/zimages/3/28571.gifRead more here about Microsofts LINQ technology.

Moreover, in such a scenario, "LINQ presents an enormous opportunity to put parallel computing in a package that everyday coders can use safely and easily," Thorpe said in the post. "Exploit those multicore processors! Even grid computing is within reason."

Should PLinq make it out of the internal project phase, it will join XLinq and DLinq as two other LINQ APIs. XLinq is a lightweight API for manipulating XML, and DLinq is an API for accessing SQL relational databases, the company said.

XLinq, a language-agnostic component of the LINQ project, provides the query capabilities of XQuery and XPath in .Net Framework languages, Microsoft said.

DLinq, also a language-agnostic component of the LINQ project, provides a run-time infrastructure for managing relational data as objects without giving up the ability to query, Microsoft said. DLinq accomplishes this by translating language integrated queries into SQL for execution by the database and then translating the results back into objects, the company said.

In addition, Microsoft hosts the prototype of another LINQ-related technology, Blinq. Blinq is Web-site generation technology.

"Blinq is a tool for generating ASP.Net Web sites for displaying, creating and manipulating data based on database schema," said Polita Paulus, a developer on the ASP.Net team, in document describing Blinq on Microsofts site.

"Just point Blinq at a SQL database and it will create a Web site with pages that display sorted and paged data, allow you to update or delete records, create new records, and follow relationships between tables in your database," Paulus said. "You dont need to write SQL queries to use Blinq; LINQ will generate optimized queries for you that request just the data you want to show."

Blinq uses the May LINQ Community Technology Preview to access data, Microsoft said.

Some observers said Blinq behaves like the scaffolding technology in the popular Ruby on Rails Web application framework. The scaffold feature in Ruby on Rails generates code to make database table editing a snap, developers said.

Meanwhile, Hejlsberg said that up to 80 to 90 percent of the people who write in C# "also talk to a database, and they typically have to learn SQL. It can degenerate into a plumbing exercise rather than a coding exercise."

Hejlsberg said LINQ starts with the concept of a language integrated query and makes queries and set operations "first class" in the Visual Basic 9.0 and C# 3.0 languages.

Moreover, C# 3.0 will include new features such as local variable type inference, extension methods, lambda expressions, object initializers and anonymous types, Hejlsberg said.

/zimages/3/28571.gifCheck out eWEEK.coms for the latest news, reviews and analysis in programming environments and developer tools.