threading question

  • Thread starter Thread starter D
  • Start date Start date
D

D

I have a c++ program NumberCruncher that I wroteto do some heavy number
crunching, it's a single threaded console app which takes command line
arguments (input file, paramters, output file) .

I wrote a c# program which runs the c++ program with all the correct
arguments since there are many many files to process. I did this using
System.Diagnostic.Process.

I was thinking creating a few threads that would each run NumberCruncher but
I don't know the impact on memory. Would each c++ process get 2 gig or would
all of them have to share 2 gig. (yes I know its 4 and the os takes 2 for
itself).

I think each is separate and each Sys.diag.process gets 2 gig.
 
D said:
I have a c++ program NumberCruncher that I wroteto do some heavy number
crunching, it's a single threaded console app which takes command line
arguments (input file, paramters, output file) .

I wrote a c# program which runs the c++ program with all the correct
arguments since there are many many files to process. I did this using
System.Diagnostic.Process.

I was thinking creating a few threads that would each run NumberCruncher but
I don't know the impact on memory. Would each c++ process get 2 gig or would
all of them have to share 2 gig. (yes I know its 4 and the os takes 2 for
itself).

I think each is separate and each Sys.diag.process gets 2 gig.

I'm a little confused by this 2 gig. Is that your processor speed? Is it
single processor?

If so, each and every thread on your system will be allocated time slices
from your execution time. If this is what you mean, then each thread will
get a share of the processor time. Of course, multithreaded apps can benefit
from multiple processors.

--
Regards,

Tim Haughton

Agitek
http://agitek.co.uk
http://blogitek.com/timhaughton
 
D said:
I have a c++ program NumberCruncher that I wroteto do some heavy number
crunching, it's a single threaded console app which takes command line
arguments (input file, paramters, output file) .

I wrote a c# program which runs the c++ program with all the correct
arguments since there are many many files to process. I did this using
System.Diagnostic.Process.

I was thinking creating a few threads that would each run NumberCruncher but
I don't know the impact on memory. Would each c++ process get 2 gig or would
all of them have to share 2 gig. (yes I know its 4 and the os takes 2 for
itself).

I think each is separate and each Sys.diag.process gets 2 gig.

They'd each get 2GB of *virtual* memory, as they'd be entirely separate
processes. Indeed, you wouldn't need to start separate threads in .NET,
just start the processes all from the same thread - they'll still be
independent processes.

How much physical memory have you got?
 
1 gig.

what if I had an array of System.Diagnostic.Processes instead , would they
still each get 2 gig of vm?

thanks
 
It's the new processes themselves which have the virtual memory, not
the Process objects in your .NET application.

However, actually *using* more than your physical memory is going to
cause *massive* performance problems...

Jon
 
Right that's what I thought that each had their own space.

I'm not too concerned over performance. I was doing some testing with a
simple bat file and I was running 10 copies of my numbercruncher and it
handled it ok.

I don't use the pc while its doing this I go and use another and let
numbercruncher do its work.

thanks
 
Just wonder why you need running 10 instances of a CPU bound process while
running them in sequence would be faster?

Willy.
 
Just wonder why you need running 10 instances of a CPU bound process while
running them in sequence would be faster?

Which begs the question, how many CPU bound processes would run *optimally*
on an N processor system? I've heard it said that the optimal number is
*not* N. Thoughts? Or, more useful, experiences?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top