Csharp Par
Csharp Par
in C#
Hans-Wolfgang Loidl
<[email protected]>
School of Mathematical and Computer Sciences,
Heriot-Watt University,
Edinburgh
Semester 1 2016/17
1
See “World’s First 1,000-Processor Chip”, University of California, Davis,
June 2016
H-W. Loidl (Heriot-Watt Univ) Parallel Programming in C# Semester 1 2016/17 4 / 41
The Free Lunch is over!
1
See “World’s First 1,000-Processor Chip”, University of California, Davis,
June 2016
H-W. Loidl (Heriot-Watt Univ) Parallel Programming in C# Semester 1 2016/17 4 / 41
The Free Lunch is over!
1
See “World’s First 1,000-Processor Chip”, University of California, Davis,
June 2016
H-W. Loidl (Heriot-Watt Univ) Parallel Programming in C# Semester 1 2016/17 4 / 41
Options for Parallel Programming in C#
int n = ...
for (int i = 0; i<=n; i++)
{
// ...
});
int n = ...
Parallel.For(0, n, i =>
{
// ...
});
int n = ...
Parallel.For(0, n, i =>
{
// ...
});
node.Value = f(node.Value);
var t1 = Task.Factory.StartNew(() =>
ParMapTree(f, node.Left));
var t2 = Task.Factory.StartNew(() =>
ParMapTree(f, node.Right));
Task.WaitAll(t1, t2);
}
Further reading:
“Parallel Programming with Microsoft .NET — Design
Patterns for Decomposition and Coordination on
Multicore Architectures”, by C. Campbell, R. Johnson, A.
Miller, S. Toub. Microsoft Press. August 2010.
http://msdn.microsoft.com/en-us/library/ff963553.aspx
“Patterns for Parallel Programming”, by T. G. Mattson, B. A.
Sanders, and B. L. Massingill. Addison-Wesley, 2004.
“MapReduce: Simplified Data Processing on Large Clusters”,
J. Dean and S. Ghemawat. In OSDI ’04 — Symp. on
Operating System Design and Implementation, pages 137–150,
2004. http://labs.google.com/papers/mapreduce.html