Welcome to MSDN Blogs Sign in | Join | Help

News

  • These postings are provided "AS IS" with no warranties and confer no rights. All code and tools presented are done so under the Microsoft Public License.

Browse by Tags

All Tags » Code Samples   (RSS)
Samples for Parallel Programming with the .NET Framework 4 Beta 2
We've posted a whole bunch of samples on Code Gallery showcasing how to use the new parallelism support in the .NET Framework 4. You can find them at http://code.msdn.microsoft.com/ParExtSamples . Enjoy! Read More...
Parallelized Map and Filter Operations
Common operations like map and filter are available in parallelized form through PLINQ, though the names differ.  A map can be achieved with PLINQ’s Select operator, and a filter with PLINQ’s Where operator. For example, I could implement a ParallelMap Read More...
TaskScheduler.FromCurrentSynchronizationContext
The Task abstractions in .NET 4 run on instances of the TaskScheduler class.  Two implementations of TaskScheduler ship as part of the .NET Framework 4.  The first is the default scheduler, which is integrated with the .NET 4 ThreadPool and Read More...
Implementing Parallel While with Parallel.ForEach
The Parallel class in .NET 4 includes methods that implement three parallel constructs: parallelized for loops (Parallel.For), parallelized foreach loops (Parallel.ForEach), and parallelized statement regions (Parallel.Invoke).  One of the interesting Read More...
Asynchronous methods, C# iterators, and Tasks
More and more, developers are realizing the significant scalability advantages that asynchronous programming can provide, especially as it relates to I/O. Consider an application that needs to copy data from one stream to another stream, such as is being Read More...
Parallel For Loops over Non-Integral Types
In a previous post, it was demonstrated how for loops with very small loop bodies could be parallelized by creating an iterator over ranges, and then using Parallel.ForEach over those ranges. A similar technique can be used to write parallel loops over Read More...
Cancellation in Parallel Extensions
One of the great features that crosses all of Parallel Extensions types is a consistent approach to cancellation (see http://blogs.msdn.com/pfxteam/archive/2009/05/22/9635790.aspx ). In this post we explore some of the ways cancellation is used in Parallel Read More...
Tasks and the APM Pattern
The Asynchronous Programming Model (APM) in the .NET Framework has been around since .NET 1.0 and is the most common pattern for asynchrony in the Framework.  Even if you’re not familiar with the name, you’re likely familiar with the core of the Read More...
Achieving Speedups with Small Parallel Loop Bodies
The Parallel class represents a significant advancement in parallelizing managed loops. For many common scenarios, it just works, resulting in terrific speedups. However, while ideally Parallel.For could be all things to all people, such things rarely Read More...
Mechanisms for Creating Tasks
The core entity in the Task Parallel Library around which everything else revolves is System.Threading.Tasks.Task. The most common way of creating a Task will be through the StartNew method on the TaskFactory class, a default instance of which is exposed Read More...
The Nature of TaskCompletionSource<TResult>
The Task Parallel Library is centered around the Task class and its derived Task<TResult> . The main purpose of these types is to represent the execution of an asynchronous workload and to provide an object with a means to operate on that workload, Read More...
Tasks and Unhandled Exceptions
Prior to the .NET Framework 2.0, unhandled exceptions were largely ignored by the runtime.  For example, if a work item queued to the ThreadPool threw an exception that went unhandled by that work item, the ThreadPool would eat that exception and Read More...
Does Parallel.For use one Task per iteration?
In .NET 4, the new Parallel class provides For, ForEach, and Invoke methods for performing operations in parallel. One mental model that some folks use when thinking about Parallel.For is that it’s equivalent to running one System.Threading.Tasks.Task Read More...
Samples for Parallel Programming with the .NET Framework 4
Along with the release of the .NET Framework 4 Beta 1 , we've just published a slew of samples that demonstrate using Parallel Extensions in a variety of ways. You can download these from Code Gallery at http://code.msdn.microsoft.com/ParExtSamples . Read More...
Getting random numbers in a thread-safe way
It’s very common in a parallel application to need random numbers for this or that operation. For situations where random numbers don’t need to be cryptographically-strong, the System.Random class is typically a fast-enough mechanism for generating values Read More...
More Posts Next page »
Page view tracker