سلام

امکانات جدید در برنامه نویسی موازی در NET Framework 4.5.:

Performance بهتر: 400% اجرای سریعتر!
Task Parallel Library



using System;
using System.Diagnostics;
using System.Threading.Tasks;

classProgram
{
staticvoid Main()
{
var sw = newStopwatch();
while (true)
{
GC.Collect();
GC.WaitForPendingFinalizers();
GC.Collect();

var tcs = newTaskCompletionSource<object>();
var t = tcs.Task;
sw.Restart();
for (int i = 0; i < 1000000; i++)
t = t.ContinueWith(_ => (object)null);
var elapsed = sw.Elapsed;
GC.KeepAlive(tcs);

Console.WriteLine(elapsed);
}
}
}


Parallel LINQ (PLINQ)


بسیاری کوئری ها که در نسخه 4 سریال اجرا می شدند اکنون موازی اجرا می شوند!



ساختمان داده های هماهنگ کننده( Coordination Data Structures)


15% اجرای سریعتر پس از Upgrade به نسخه 4.5!


using System;
using System.Collections.Concurrent;
using System.Diagnostics;

classProgram
{
staticvoid Main(string[] args)
{
while (true)
{
var cd = newConcurrentDictionary<int, int>();
var sw = Stopwatch.StartNew();
cd.TryAdd(42, 0);
for (int i = 1; i < 10000000; i++)
{
cd.TryUpdate(42, i, i – 1);
}
Console.WriteLine(sw.Elapsed);
}
}
}



کنترل بیشتر در پارتیشن بندی منبع داده ها در PLINQ و Parallel.For:

با استفاده از enum جدید EnumerablePartitionerOptions!


Parallel.ForEach(Partitioner.Create(source, EnumerablePartitionerOptions.NoBuffering), item =>
{
// ... process item
});


Parallel Watch


Multi-process Support


Concurrency Visualizer Markers


لینک رو ببینید:
http://blogs.msdn.com/b/pfxteam/arch.../10212961.aspx