Click here to Skip to main content
15,905,504 members
Home / Discussions / C#
   

C#

 
GeneralRe: Killing hidden processes Pin
teknolog1237-Apr-11 4:02
teknolog1237-Apr-11 4:02 
GeneralRe: Killing hidden processes Pin
dan!sh 7-Apr-11 5:41
professional dan!sh 7-Apr-11 5:41 
AnswerRe: Killing hidden processes Pin
Rajesh R Subramanian7-Apr-11 6:49
professionalRajesh R Subramanian7-Apr-11 6:49 
GeneralRe: Killing hidden processes Pin
Pete O'Hanlon7-Apr-11 9:32
mvePete O'Hanlon7-Apr-11 9:32 
GeneralRe: Killing hidden processes Pin
Rajesh R Subramanian7-Apr-11 9:36
professionalRajesh R Subramanian7-Apr-11 9:36 
GeneralRe: Killing hidden processes Pin
Pete O'Hanlon7-Apr-11 9:51
mvePete O'Hanlon7-Apr-11 9:51 
GeneralRe: Killing hidden processes Pin
Rajesh R Subramanian7-Apr-11 9:59
professionalRajesh R Subramanian7-Apr-11 9:59 
GeneralRe: Killing hidden processes Pin
Pete O'Hanlon7-Apr-11 10:07
mvePete O'Hanlon7-Apr-11 10:07 
GeneralRe: Killing hidden processes Pin
Rajesh R Subramanian7-Apr-11 10:16
professionalRajesh R Subramanian7-Apr-11 10:16 
GeneralRe: Killing hidden processes Pin
David19878-Apr-11 1:46
David19878-Apr-11 1:46 
GeneralRe: Killing hidden processes Pin
teknolog1239-Apr-11 2:32
teknolog1239-Apr-11 2:32 
GeneralRe: Killing hidden processes Pin
David19879-Apr-11 2:36
David19879-Apr-11 2:36 
GeneralRe: Killing hidden processes Pin
teknolog1239-Apr-11 6:45
teknolog1239-Apr-11 6:45 
QuestionSocket Exception Pin
Paul Harsent6-Apr-11 5:27
Paul Harsent6-Apr-11 5:27 
AnswerRe: Socket Exception Pin
Pete O'Hanlon6-Apr-11 6:06
mvePete O'Hanlon6-Apr-11 6:06 
GeneralRe: Socket Exception Pin
Paul Harsent6-Apr-11 6:09
Paul Harsent6-Apr-11 6:09 
GeneralRe: Socket Exception Pin
Pete O'Hanlon6-Apr-11 6:21
mvePete O'Hanlon6-Apr-11 6:21 
GeneralRe: Socket Exception Pin
#realJSOP6-Apr-11 9:07
professional#realJSOP6-Apr-11 9:07 
GeneralRe: Socket Exception Pin
Pete O'Hanlon6-Apr-11 9:13
mvePete O'Hanlon6-Apr-11 9:13 
GeneralRe: Socket Exception Pin
ankitjoshi246-Apr-11 9:40
ankitjoshi246-Apr-11 9:40 
AnswerRe: Socket Exception Pin
Luc Pattyn6-Apr-11 6:57
sitebuilderLuc Pattyn6-Apr-11 6:57 
GeneralParallel.For Issue Pin
Bassam Abdul-Baki6-Apr-11 5:12
professionalBassam Abdul-Baki6-Apr-11 5:12 
I have a program that I'm trying to multithread. It works correctly on a single processor. All I had to do was change the for loop to Parallel.For and add ");" at the end. Basically, the structure is as follows:
Variables (V) that do not get modified inside the loop, including a LinkedList<BigInteger> that does.

Parallel.For (0, 5, j => {
  BigInteger Variable that relies on j and another from (V - outside loop).
  foreach (BigInteger k in numbers) {
    Local Variables.
    //Console.WriteLine(Everything in numbers.);     if (condition)
    {
      Add k to LinkedList.
      Console.WriteLine(k and other data.);
    }
  Console.WriteLine(Summary count per loop.);
});
This parallel loop is missing a few values when multithreaded. However, if I put a write statement just before the IF to capture everything (commented out), it works. The summary count comes up accurate every time.  If I comment it out, it fails, every time starting at higher values of k across all j.  Basically, it starts working and slowly degrades. It seems to be that the write statement is slowing it down for it to work.

Do I need a more threaded way of adding to the LinkedList array or am I missing something else? Any suggestions would be appreciated.

NB - Can't submit code and this is console programming without the use of Visual Studio. Don't ask! Smile | :)

GeneralRe: Parallel.For Issue Pin
David19876-Apr-11 5:19
David19876-Apr-11 5:19 
GeneralRe: Parallel.For Issue Pin
Bassam Abdul-Baki6-Apr-11 5:25
professionalBassam Abdul-Baki6-Apr-11 5:25 
AnswerRe: Parallel.For Issue Pin
Luc Pattyn6-Apr-11 5:25
sitebuilderLuc Pattyn6-Apr-11 5:25 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.