Click here to Skip to main content
15,887,471 members
Home / Discussions / .NET (Core and Framework)
   

.NET (Core and Framework)

 
GeneralRe: Path class in .NET Pin
Andy *M*26-Apr-07 2:23
Andy *M*26-Apr-07 2:23 
GeneralRe: Path class in .NET Pin
Jaiprakash M Bankolli26-Apr-07 2:27
Jaiprakash M Bankolli26-Apr-07 2:27 
GeneralRe: Path class in .NET Pin
Andy *M*26-Apr-07 2:37
Andy *M*26-Apr-07 2:37 
GeneralRe: Path class in .NET Pin
Jaiprakash M Bankolli26-Apr-07 2:45
Jaiprakash M Bankolli26-Apr-07 2:45 
GeneralRe: Path class in .NET Pin
Andy *M*26-Apr-07 2:59
Andy *M*26-Apr-07 2:59 
GeneralRe: Path class in .NET [modified] Pin
Jaiprakash M Bankolli26-Apr-07 3:04
Jaiprakash M Bankolli26-Apr-07 3:04 
GeneralRe: Path class in .NET Pin
Andy *M*26-Apr-07 3:17
Andy *M*26-Apr-07 3:17 
QuestionMultithreading-Performance Pin
roddy189124-Apr-07 20:21
roddy189124-Apr-07 20:21 
Hello!

I've got a problem with multithreading.

One should think that every Thread-Model causes overhead and is responsible
for a little bit lost of performance on a singel-Core CPU!
In my Case, the sequentiell version is about 3 % slower than the Threading-versions.
Has anybody an explanation for this?


//the worker-function
public void Function()
{
for (int i = 0; i < 10000; i++)
{
for (int j = 0; j < 10000; j++)
{
j = j + 1;
j = j - 1;
}
}
}

//Needed to set the AutoResetEvent -> Overhead?
public void FunctionNT(Object obj)
{
Function();
Object tmp = obj;
if (tmp != null)
{
((AutoResetEvent)obj).Set();
}
}

// sequentiell Version
class SequentiellTest : ThreadingParent
{
public SequentiellTest(int piterations)
{
this.iterations = piterations;
}

public void Run()
{
Worker wrk = new Worker();

for (int i = 0; i < iterations; i++)
{
wrk.Function();
}
}
}


// Version newThread
class NewThreadTest : ThreadingParent
{

public NewThreadTest(int piterations)
{
this.iterations = piterations;
}

public void Run()
{
AutoResetEvent[] ready = new AutoResetEvent[iterations];// = new AutoResetEvent(false);

Worker wrk = new Worker();

Thread[] tda = new Thread[iterations];

for (int i = 0; i < iterations; i++)
{
ready[i] = new AutoResetEvent(false);
tda[i] = new Thread(wrk.FunctionNT);
tda[i].Start(ready[i]);
}

//wait until all Threads are Ready
for (int j = 0; j < iterations; j++)
{
ready[j].WaitOne();
}
}
}


// Example for a Calling-Function
private void NewThreadStart()
{
//start the Stopwatch
stp.Start();

//Init NewThreadClass
NewThreadTest ntt = new NewThreadTest(Convert.ToInt16(tbIterations.Text));
ntt.Run();

//Stop the Stopwatch
stp.Stop();
}

Questionwhat is satellite assembly..? Pin
Balagurunathan S24-Apr-07 19:41
Balagurunathan S24-Apr-07 19:41 
AnswerRe: what is satellite assembly..? Pin
MatrixCoder24-Apr-07 19:49
MatrixCoder24-Apr-07 19:49 
GeneralRe: what is satellite assembly..? Pin
Balagurunathan S24-Apr-07 22:04
Balagurunathan S24-Apr-07 22:04 
GeneralRe: what is satellite assembly..? Pin
szukuro24-Apr-07 23:15
szukuro24-Apr-07 23:15 
AnswerRe: what is satellite assembly..? Pin
Jaiprakash M Bankolli24-Apr-07 23:15
Jaiprakash M Bankolli24-Apr-07 23:15 
Questionsealed UI classes Pin
DotNetInterest24-Apr-07 7:08
DotNetInterest24-Apr-07 7:08 
AnswerRe: sealed UI classes Pin
Pete O'Hanlon24-Apr-07 9:54
mvePete O'Hanlon24-Apr-07 9:54 
AnswerRe: sealed UI classes [modified] Pin
Jaiprakash M Bankolli25-Apr-07 23:05
Jaiprakash M Bankolli25-Apr-07 23:05 
Question[Interop] Connectionpoint Advise hangs Pin
User 21559724-Apr-07 6:57
User 21559724-Apr-07 6:57 
QuestionWhy no GC.Kill(object)? Pin
Tristan Rhodes24-Apr-07 5:36
Tristan Rhodes24-Apr-07 5:36 
AnswerRe: Why no GC.Kill(object)? Pin
Colin Angus Mackay24-Apr-07 5:40
Colin Angus Mackay24-Apr-07 5:40 
GeneralRe: Why no GC.Kill(object)? Pin
Tristan Rhodes24-Apr-07 5:57
Tristan Rhodes24-Apr-07 5:57 
GeneralRe: Why no GC.Kill(object)? Pin
Dave Kreskowiak24-Apr-07 6:21
mveDave Kreskowiak24-Apr-07 6:21 
GeneralRe: Why no GC.Kill(object)? Pin
Tristan Rhodes24-Apr-07 7:07
Tristan Rhodes24-Apr-07 7:07 
AnswerRe: Why no GC.Kill(object)? Pin
Daniel Turini24-Apr-07 6:44
Daniel Turini24-Apr-07 6:44 
Question.NET on linux/unix Pin
Waskira23-Apr-07 22:30
Waskira23-Apr-07 22:30 
AnswerRe: .NET on linux/unix Pin
Tristan Rhodes24-Apr-07 3:51
Tristan Rhodes24-Apr-07 3:51 

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.