2
votes
4answers
90 views

Preloading next IEnumerable<T> value

Given the class structure: public class Foo { public IEnumerable<Bar> GetBars() { for(int i = 0; i < 1000; i++) { Thread.Sleep(1000); yield ...
0
votes
0answers
61 views

How to program wait Custom MessageBox OK,Cancel,Yes,No responses?

How to program wait Custom MessageBox OK,Cancel,Yes,No responses? i have been using custom messageBox because of my natural language because messagebox has only english ok,yes,no i have found this ...
3
votes
4answers
87 views

Is it possible to divide work between cores?

I have this simple (dummy) code : (heavy computed : 30 sec in my machine) BigInteger number = BigInteger.Pow(Int64.MaxValue, 300000); Console.WriteLine(number); Plinq will do the job division ...
0
votes
3answers
125 views

Problems with Longest Common Subsequence parallel algorithm in F# (using Parallel.For)

(Edited) I'm trying to parallelize a function to solve a LCS, via the usage of a Parallel.For loop. This function proceeds by diagonals, obtaining the value of the current diagonal cell based on the ...
2
votes
1answer
107 views

How to do Parallel filtering

How do I achieve parallel filtering in F#? Basically I want to do Array.Parallel.Choose except with a sequence expression to create an Array. I tried: Async.Parallel [for x in 1..40 do yield async { ...
0
votes
0answers
75 views

Need in depth understating /Example of Task Parallelism to Read data from database/active directory and display them in grid

I have scenario where i am fetching data from active directory and displaying it in the radGrid, but the collection of data is very big in millions, so retrieving it and displaying it in grid ...
3
votes
3answers
58 views

How to determine which thread a method will executes on when using TPL?

I know that the TPL is task-oriented, while the classic threading model is worker-oriented. Tasks let you focus primarily on what problem you want to solve instead of on the mechanics of how it will ...
2
votes
1answer
228 views

Parallel.Foreach vs Foreach and Task in local variable

When we use foreach and Tasks we need to use local variables like this: List<Task> TaskPool = new List<Task>(); foreach (TargetType Item in Source) { TargetType localItem = Item; ...
2
votes
1answer
105 views

Parallel.ForEach gives different results each time

Please help me to convert following loop to Parallel loop. I tried using Parallel.ForEach and ConcurrentBag instead of HashSet, but the wied thing is that "Matched" returns every time different ...
0
votes
1answer
52 views

Tool for suggesting possible parallelism [closed]

Is there any tool available which can find/suggest possible places in code which can be re-factored to use parallelism for improving performance.
1
vote
1answer
67 views

Parallelism with Task, some tasks worked, some not

I have a website and I write a HttpModule to convert all links, So every things fine until I going to use parallelism in convert URLs. This is My Test Console Application: class Program { ...
9
votes
5answers
724 views

How to put a task to sleep (or delay) in C# 4.0?

There is Task.Delay in .NET 4.5 How can I do the same in .NET 4.0?
2
votes
5answers
217 views

What is the difference in .NET between developing a multithreaded application and parallel programming?

Recently I've read a lot about parallel programming in .NET but I am still confused by contradicting statements over the texts on this subject. For example, tThe popup (upon pointing a mouse on ...
0
votes
1answer
84 views

Use of IsCancellationRequested property?

What is the use of CancellationToken's IsCancellationRequested property? Consider below code static void Main(string[] args) { CancellationTokenSource tokenSource = new CancellationTokenSource(); ...
1
vote
1answer
136 views

parallel.foreach is hanging my application

I have a List(of MyCustomObject). This List is the DataSource for TreeView. Now, all of collected objects must be updated on periodicaly Rising Timer1_Timer event. To update I'm using ...
0
votes
2answers
138 views

Summarize C# Datatable column with Parallel.For?

I have this DataTable: DataTable dt = GetDatatTable(); One of its column is Amount (decimal) I want to summarize it as fast as I can using TPL. object obj = new Object(); var total=0m; ...
0
votes
1answer
96 views

Using TPL parallel work inside an async wcf service method

I have one doubt. I implemented my wcf 4.0 service method as shown below. IAsyncResult BeginGetData(string userid, AsyncCallback cb, object asyncState) { // Here i want to call 2 ...
0
votes
1answer
52 views

WebClientExtensions - DownloadDataTask

I may be missing something basic but how come does this method: namespace System.Net { public static class WebClientExtensions { public static Task<byte[]> ...
0
votes
1answer
68 views

Using parallel programing to evaluate the result of the first executed method

Given the following array Func<int>[] funcs and using TPL (Task Parallel Library .NET) how can I evaluate the first result returned by the invocation of any of the functions in funcs. The main ...
0
votes
1answer
210 views

.NET 4.5 parallel processing and for loop

I am trying to create a list of tasks which depend on the number of processors available. I have a for loop which which seems to be behaving strangely. I am aware of the concept of closures in ...
0
votes
0answers
173 views

Programs hangs on parallelism, Parallel.ForEach

I am trying to make a program that uses parallel.foreach to find a particular string in files of a particular directory and its sub directories, it works fine for about 90% of the iteration but after ...
4
votes
2answers
1k views

AsParallel.ForAll vs Parallel.ForEach

Is there any difference between the below code snippets. If so, what? myList.AsParallel().ForAll(i => { /*DO SOMETHING*/ }); and Parallel.ForEach(mylist, i => { /*DO SOMETHING*/ }); Next ...
6
votes
1answer
181 views

Parallel.ForEach Misbehaviour [duplicate]

Possible Duplicate: C# Value storage during Parallel Processing I was running some performance tests in my console application today and I stumbled across something really unexpected. My ...
2
votes
1answer
98 views

Value storage during Parallel Processing

I just tried out this simple program... nothing fancy.. double[] a = new double[100000]; double[] b = new double[100000]; List<double> a1 = new List<double>(); List<double> b1 = ...
6
votes
3answers
145 views

Parallel.For using step != 1

Is there any way to achieve the Parallel.For version of this for loop? for (int i = 0; i < 100; i += 2) { DoStuff(i); } I don't see an overload which accepts a step parameter, though I can't ...
0
votes
1answer
79 views

Unexpected thread contention in Parallel.Foreach

I have tried to implement the following algorithm using Parallel.Foreach. I thought it would be trivial to make parallel, since it has no synchronization issues. It is basically a Monte-Carlo tree ...
4
votes
1answer
76 views

Parallelizing multiple dependent operations with varying bounds

Here's the list of tasks that I need to complete: Read a chunk of the file (Disk IO Bound) Encrypt said chunk (CPU Bound) Upload said chunk (Network IO Bound) Repeat until file is uploaded The ...
3
votes
3answers
261 views

TPL FromAsync with TaskScheduler and TaskFactory

I am trying to create a Task pipeline/ordered scheduler in combination with using TaskFactory.FromAsync. I want to be able to fire off web service requests (using FromAsync to use I/O completion ...
0
votes
1answer
122 views

What is the most efficient way to read N entities from an Azure Table structure

Background - will be using .NET 4.0, Azure SDK 1.7, Azure Table Storage Problem How to most efficiently (= fastest processing time ) to read N entries, where N is a large # (1000's to millions) of ...
1
vote
4answers
262 views

Parallel Generation of UI

We have a WPF application that has a ListBox with a VirtualizingStackPanel with caching. Not because it has massively many elements (typically less than 20 but perhaps up to 100 or more in extreme ...
1
vote
2answers
140 views

Parallel.ForEach executes twice on start up only when code hasn't been run?

I'm working on a Windows Service that where I am attempting to use Parallel.ForEach to spawn unique timed threads. The problem is that if I leave the code alone for several hours in VS or if I stop ...
2
votes
2answers
242 views

Recursive Function to calculate factorial using PLINQ

NOTE I am well aware of what I am asking, and there is no way I would need the use of a function such as this on a normal basis, but it is being used as a research factor for a graduate project on ...
3
votes
3answers
97 views

Doing a parallel read from a defined number of files

For a school project, I have to make a program in which the user chooses from 1 to 10 text files. Then, the program must search into this files with multiprocessor parallelism (Task Parallel Library I ...
1
vote
0answers
143 views

Cannot find bug in C# 4.0 Parallel.For loop using thread-specific variables

I am attempting to model slot machine behavior with parallel programming, using a base class (SlotBase) which will be overridden by classes representing each individual machine. In the base class, I ...
6
votes
3answers
201 views

TPL Parallel.For with long running tasks

I am wanting to use the Task Parallel Library (TPL) in F# to execute many (>1000) long running tasks. Here is my current code: Parallel.For(1, numberOfSets, fun j -> //Long running task here ...
1
vote
3answers
151 views

Reactive Extensions and parallel processing

I am planning on using Rx within a project of mine at some point, and I have been researching into what I can do with Rx. My project uses TPL for processing state machine transitions in parallel ...
1
vote
1answer
124 views

How to Parallelize Kinect AllFramesReady event

I am developing with Kinect and I need to perform a task in the AllFramesReady event. The task consists in a lot of writing using a BinaryWriter. I know that the frame (Color, Depth, Skeleton) exists ...
2
votes
2answers
134 views

parallel task and thread saftey in c#

I have two separate tasks and two independent operations in each. I think t0 is thread safe but I am not sure about t1. Is it correct? The performance of concurrent dictionary is awful and I need to ...
4
votes
1answer
112 views

Parallel and work division in c#?

(let's assume I have 10 cores) When I write: Parallel.For(0, 100, (i,state) => { Console.WriteLine(i); }); Questions: What is the formula of assigning ...
2
votes
5answers
195 views

Parallel programming: create a certain number of processes and related data/work

I need to allocate a workload on different processes, depending on the number of logical cores of the user's PC. The workload is done by the following code : static void work() { WorkData myData ...
1
vote
2answers
114 views

Arbitrarily long Parallel.For loops in C# .NET

Parallel.For allows loops with a max iteration of long.MaxValue Parallel.For(long fromInclusive, long toExclusive, Action<long> body) { } but what if I need to perform a Parallel loop which ...
7
votes
1answer
518 views

Entity Framework and Parallelism

Background I have an application that receives periodic data dumps (XML files) and imports them into an existing database using Entity Framework 5 (Code First). The import happens via EF5 rather ...
1
vote
1answer
84 views

Hoe does one convert from an IEnumerable to IEnumerable<T>?

Is there a way to get an IEnumerable<T> from an IEnumerable without reflection, assuming I know the type at design time? I have this foreach(DirectoryEntry child in de.Children) { // long ...
0
votes
1answer
85 views

Which database concurrency strategy should I use with task parallelism?

I'm using a Parallel.Foreach loop to process a set of input records: Parallel.Foreach(foos, x => Process(x)); The Process() method does a whole bunch of things that can be safely done in ...
2
votes
4answers
392 views

Parallel tasks with a long pause

I have a function which is along the lines of private void DoSomethingToFeed(IFeed feed) { feed.SendData(); // Send data to remote server Thread.Sleep(1000 * 60 * 5); // Sleep 5 ...
9
votes
3answers
238 views

Parallel.For and Break() misunderstanding?

I'm investigating the Parallelism Break in a For loop. After reading this and this I still have a question: I'd expect this code : Parallel.For(0, 10, (i,state) => { ...
2
votes
1answer
209 views

How to post results of Parallel.ForEach to a queue which is continually read in C#

In my application I have three classes, Extractor, Transformer and Loader, which are coordinated by a fourth class, Coordinator. Extractor, Transformer and Loader are very simple and do the following: ...
1
vote
3answers
228 views

Can I TryTake a group of items from a BlockingCollection<T>?

In an application I'm working on, thousands of updates are being received per second. Reflecting these updates on the UI immediately and one by one is performance overkill. The following code yields ...
1
vote
1answer
97 views

Dispose objects read from BlockingCollection

I have to parse a lot of files. So right now I open a file for reading parse the content and write the output on a different location. That is basically what I need to do but I will like to speed up ...
3
votes
1answer
174 views

Can Parallel.For be optimized for very short-running operations?

I am aware of tasks that offer fine grained control for short running tasks but I have a situation where it is more natural to use a foreach loop. The question is, is it possible to tell Parallel.For ...

1 2 3 4
15 30 50 per page