parallel-extensions Questions

4

I've gotten used to using Parallel.For() in .NET's parallel extensions as it's a simple way of parallelizing code without having to manually start and maintain threads (which can be fiddly). I'm no...

3

Solved

static async void Main(string[] args) { Task t = new Task(() => { throw new Exception(); }); try { t.Start(); t.Wait(); } catch (AggregateException e) { // When waiting on the task, ...
Randolphrandom asked 7/9, 2011 at 20:44

4

Solved

What is the difference between the below code snippets? Won't both be using threadpool threads? For instance if I want to call a function for each item in a collection, Parallel.ForEach<Item&g...
Dictator asked 15/2, 2011 at 20:33

6

Solved

In one of my projects that's kinda an aggregator, I parse feeds, podcasts and so from the web. If I use sequential approach, given that a large number of resources, it takes quite a time to proces...

6

Solved

I am using the below code var processed = new List<Guid>(); Parallel.ForEach(items, item => { processed.Add(SomeProcessingFunc(item)); }); Is the above code thread safe? Is there a ch...
Roughcast asked 16/2, 2011 at 18:22

1

Solved

I have some basic Azure tables that I've been querying serially: var query = new TableQuery<DynamicTableEntity>() .Where(TableQuery.GenerateFilterCondition("PartitionKey", QueryComparisons...
Rawlinson asked 5/10, 2014 at 6:37

4

Solved

I´m trying to understand the purpose of BlockingCollection in the context of the new Parallel Stacks on .NET 4. The MSDN documentation says: BlockingCollection is used as a wrapper for an IPro...
Bulrush asked 21/12, 2009 at 7:57

5

Solved

I have a question concerning parallel for loops. I have the following code: public static void MultiplicateArray(double[] array, double factor) { for (int i = 0; i < array.Length; i++) { a...
Klingel asked 13/9, 2012 at 12:9

2

Solved

I must be doing something wrong somewhere because i am getting duplicate items in my concurrentbag, here is the chain of events var listings = new ConcurrentBag<JSonListing>(); Parallel.Fo...
Armyn asked 7/2, 2014 at 12:2

3

Solved

While I was using Parallel.ForEach in my program, I found that some threads never seemed to finish. In fact, it kept spawning new threads over and over, a behaviour that I wasn't expecting and defi...

1

Solved

what I'm basically doing is iterating in parallel over a sequence of letter combinations, when I get the combo I want it's considered a win. I want to get all the wins from this query (which it's d...
Welldone asked 7/10, 2012 at 1:18

1

Solved

public bool HasItemsFromPropertySet(InfoItemPropertySet propertySet, CompositeInfoItem itemRemoved) { var itemAndSubItems = new InfoItemCollection(); if (itemRemoved != null) { itemAndSubItems...
Ecto asked 19/4, 2012 at 9:16

4

Solved

I have a requirement to fire off web service requests to an online api and I thought that Parallel Extensions would be a good fit for my needs. The web service in question is designed to be called...
Fredericafrederich asked 20/3, 2012 at 21:54

4

Solved

So for example: ConcurrentDictionary<string,Payload> itemCache = GetItems(); foreach(KeyValuePair<string,Payload> kvPair in itemCache) { if(TestItemExpiry(kvPair.Value)) { // Remove ...
Hilde asked 23/2, 2010 at 12:22

2

Solved

Please see this question for background information: How do Tasks in the Task Parallel Library affect ActivityID? That question asks how Tasks affect Trace.CorrelationManager.ActivityId. @Greg Sa...

2

Solved

If i do the following: Using scope = New TransactionScope() entries.Content.ReadAs(Of IList(Of WebMaint)).AsParallel.ForAll(Sub(entry) _repos.Update(entry) End Sub) scope.Complete() End Usin...
Loblolly asked 18/11, 2011 at 19:29

2

Solved

Let's say I have two sequences returning integers 1 to 5. The first returns 1, 2 and 3 very fast, but 4 and 5 take 200ms each. public static IEnumerable<int> FastFirst() { for (int i = 1; ...
Metallo asked 9/11, 2011 at 13:25

1

I'm using LINQ to compare two DataSets with each other to create new rows and update existing. I've noticed that the complete comparison lasts ~1,5 hours and only one of the two cores is busy(Task-...
Emolument asked 28/9, 2011 at 11:34

1

How can I diagnose and minimize or prevent AppDomainUnloadedException? NUnit 2.5.2 consistently throws AppDomainUnloadedException after long (>10s) tests involving PLINQ. Back in July 2008, Step...
Auburn asked 27/8, 2009 at 10:28

1

Solved

Does anyone know if there's any overload that would allow me to specify a step size in a Parallel.For loop? Samples in either C# or VB.Net would be great.
Brufsky asked 22/8, 2011 at 1:51

3

Solved

I have a simulation that generates data which must be saved to database. ParallelLoopResult res = Parallel.For(0, 1000000, options, (r, state) => { ComplexDataSet cds = GenerateData(r); Save...

2

Solved

The idomatic way to start a new side-effect-only task (that is: a task that returns no result) using the TPL in .NET 4.0 is using the following API: Task Task.Factory.StartNew(Action<object>...
Howler asked 3/12, 2009 at 14:10

3

Solved

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)...
Ionone asked 25/2, 2011 at 11:31

2

Solved

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.
Youngman asked 21/10, 2010 at 9:29

1

Solved

Short version: Can we read from dozens or hundreds of table partitions in a multi-threaded manner to increase performance by orders of magnitude? Long version: We're working on a system that is st...
Nip asked 7/10, 2010 at 2:31

© 2022 - 2024 — McMap. All rights reserved.