Questions tagged [parallel-extensions]

Parallel Extensions is a managed concurrency library included in the .NET 4.0 release.

Parallel Extensions is a managed concurrency library included in the .NET 4.0 release. It is composed of two parts: Parallel LINQ (PLINQ) and Task Parallel Library (TPL).

124 questions
5
votes
3 answers

Task.WaitAll on a list in F#

I am doing parallel programming using F#. With fixed number of elements, for example with 2 elements a1, a2 and a function f, I can do as follows: let t1 = Task.Factory.StartNew(fun () -> f a1) let t2 = Task.Factory.StartNew(fun () -> f…
pad
  • 41,040
  • 7
  • 92
  • 166
5
votes
2 answers

Progress update in Parallel.For() loops

As you can guess the index of the Parallel.For() loop jumps from one value to the other. How can I estimate the amount of the work done? Thanks.
abenci
  • 8,422
  • 19
  • 69
  • 134
5
votes
4 answers

Using .Net Parallel Extensions (Parallel.Invoke) for multiple asynchronous calls?

Currently I have a section of code that needs to make about 7 web service calls to various providers for data. Each call takes a several seconds to execute, so I would like to run them in parallel to speed things up. I have wrapped my 7 calls in a…
puffpio
  • 3,402
  • 6
  • 36
  • 41
5
votes
1 answer

How to Force an Exception from a Task to be Observed in a Continuation Task?

I have a task to perform an HttpWebRequest using Task.Factory.FromAsync(req.BeginGetRespone, req.EndGetResponse) which can obviously fail with a WebException. To the caller I want to return a Task where HttpResult is a…
Richard
  • 106,783
  • 21
  • 203
  • 265
4
votes
1 answer

How do I avoid out of memory exceptions when using PLINQ?

Hi and thanks for looking! Background I have a computing task that requires either a lot of time, or parallel computing. Specifically, I need to loop through a list of about 50 images, Base64 encode them, and then calculate the Levenshtein distance…
Matt Cashatt
  • 23,490
  • 28
  • 78
  • 111
4
votes
5 answers

Parallel Extensions

I have an application with heavy IO operations such as file copying, zipping and moving the files around the file system, copying to backup servers. I build this program as single threaded. It runs in 2 minutes. I built another version of this…
DarthVader
  • 52,984
  • 76
  • 209
  • 300
4
votes
2 answers

Is multi-level ConcurrentDictionary still thread-safe?

I have four level data structure defined like this: Dictionary>>> The whole thing is encapsulated in a class which also maintains thread-safety. Currently it just locks whole collection while…
Matěj Zábský
  • 16,909
  • 15
  • 69
  • 114
4
votes
2 answers

Getting results from Parallel.For

I am looking at using Parallel.For to call into a web service that takes a while to return, however, we know we can call it many times simultaneously and it doesn't take that much longer than a single call. To that end I'm trying out the…
Colin Mackay
  • 18,736
  • 7
  • 61
  • 88
4
votes
2 answers

How to send the progress when using Parallel.ForEach

I am planning to use Parallel.ForEach on a DataTable so that each record can be written to a file. How can we notify user the percentage/number of records that are processed. Normally when we use Background worker we have a ProgressChanged event…
4
votes
3 answers

Can I develop production code with Microsoft Parallel Extensions to .NET Framework 3.5, June 2008 Community Technology Preview?

Is there any recommendation against using this CTP? Is it unstable?
Jader Dias
  • 88,211
  • 155
  • 421
  • 625
4
votes
1 answer

Task Parallel Library - How do you get a Continuation with TaskContinuationOptions.OnlyOnCanceled to Fire?

I'm experimenting with the Task support in .NET 4.0 - specifically with the continuation support. What I'm perplexed about is that I can't figure out how to get a continuation with the TaskContinuationOptions.OnlyOnCanceled flag set to execute. If…
Keith Hill
  • 194,368
  • 42
  • 353
  • 369
4
votes
1 answer

any special reference needed for c# 4.0 Parallel.For?

I am following this article: Link and in my console app Parallel namespace is visible, but "Parallel.For" fails compilation with "type of namespace For does not exist in namespace 'Parallel'". I've scoured the net, but not seeing anything other than…
Sonic Soul
  • 23,855
  • 37
  • 130
  • 196
4
votes
2 answers

How to call Parallel.ForEach with a multidimensional array

I'm having a little trouble figuring out how to call the Parallel.ForEach with a 2D array of strings: string[,] board = new string[,]{ {"A", "B", "C", "D", "E" }, {"F", "G", "H", "I", "J"}, {"K", "L", "M", "N", "O"}, …
Kiril
  • 39,672
  • 31
  • 167
  • 226
4
votes
3 answers

Naming a thread inside Parallel.Invoke results in an exception "This property has already been set and cannot be modified."

I have an application, which has run without issue for a long time, which suddenly fails to start due to the following error: "This property has already been set and cannot be modified." When I inspect the code, which basically resembles the snippet…
JMc
  • 971
  • 2
  • 17
  • 26
4
votes
2 answers

How to await a ParallelQuery with LINQ?

I have an async method, that should look up database entries. It filters by name, thus is a candiate for parallel execution. However, I can not find a simple way to support both parallel execution and asynchronous tasks. Here's what I have: private…
Marcel
  • 15,039
  • 20
  • 92
  • 150
1 2
3
8 9