Running software on Dual or Quad core CPU

H

harry

Just wondering, if one has Dual or Quad core CPU and one is running multiple
different programs, or multiple copies of the same program, does the
operating system (XP or 2003) run each individual program on seperate cores?
or does one need to do something when starting the programs on the command
line or through code to force them to run on seperate cores?

Thanks
harry
 
M

Michael C

harry said:
Just wondering, if one has Dual or Quad core CPU and one is running
multiple different programs, or multiple copies of the same program, does
the operating system (XP or 2003) run each individual program on seperate
cores? or does one need to do something when starting the programs on the
command line or through code to force them to run on seperate cores?

They could both use either cores and switch between while running. You don't
need to do anything.
 
G

Guest

They could both use either cores and switch between while running. You
don't need to do anything.

Also the performance benefit of multiple cores really depends if there was
any multi-threading done to the application.
 
W

William LaMartin

When you say multi-threading done to the application, do you simply mean
that within the program you start several different threads to accomplish
various things.

For example, I just wrote an application to go out on the Internet and
gather three pieces of information from a server. I had it do this in three
separate threads. Is this the type of thing that would benefit from more
than one core?
 
B

Brian Gideon

When you say multi-threading done to the application, do you simply mean
that within the program you start several different threads to accomplish
various things.

For example, I just wrote an application to go out on the Internet and
gather three pieces of information from a server. I had it do this in three
separate threads. Is this the type of thing that would benefit from more
than one core?

William,

Probably not. It sounds like the threads would spend an awful lot of
time in an idle state waiting for the IO complete. In this particular
example I'm skeptical that a multicore system would provide a
significant benefit.

But, in general a CPU intensive application written using more than
one thread could benefit from having more than one CPU.

Brian
 
G

Guest

When you say multi-threading done to the application, do you simply
mean that within the program you start several different threads to
accomplish various things.

Yes - long running processes should be done via Delegates or Worker
Threads.
For example, I just wrote an application to go out on the Internet and
gather three pieces of information from a server. I had it do this in
three separate threads. Is this the type of thing that would benefit
from more than one core?

Yes - but 3 threads might be overkill ;-)

Multi-threading is application specific - I guess you have to analyze how
your application works to optimize it to it's fullest potential.
 
P

pfc_sadr

this is a pleasent thread; it makes me understand a little bit better.

I was of the understanding that they were going to have to go 'visual
fred' on us again in order to support multi-cores since this is what
all the large sites like cnet.com and thereqister.co.uk seems to imply
 
G

Guest

(e-mail address removed) wrote in @j27g2000cwj.googlegroups.com:
I was of the understanding that they were going to have to go 'visual
fred' on us again in order to support multi-cores since this is what
all the large sites like cnet.com and thereqister.co.uk seems to imply

In a sense - because many developers lack the experience with multi-
threading, a lot of applications need to be re-written to take advantage of
multi-cores.

Multi-core cpus can distribute application instances across more than 1 CPU
automatically (Actually Window's Scheduler does that) - which means you can
run more applications at once. However, for an application to run faster,
it'll need to be multi-threaded.
 
P

PFC Sadr

Spam

can you plz expand on this more?

so.. if I launch a VB.net console app using a windows schedule
context; it is more capable of using multi-cores or processors??
 
B

Brian Gideon

Spam

can you plz expand on this more?

so.. if I launch a VB.net console app using a windows schedule
context; it is more capable of using multi-cores or processors??

I think what spam meant was that a VB.NET (or VB 2005) application
(like any application) must make use of more than one thread to
realize the performance advantage of multicore processors. Windows
will automatically affinitize threads within processes so there's
nothing special required beyond making your application
multithreaded. It is important to note, however, that a poorly
implemented multithreaded application may not necessarily see a gain
in performance.
 
G

Guest

I think what spam meant was that a VB.NET (or VB 2005) application
(like any application) must make use of more than one thread to
realize the performance advantage of multicore processors.

Yes exactly - for an application to be "faster" under multi-core it
needs to be multi-threaded.

However, that does not mean multi-core CPUs are useless for non-multi-
threaded applications. Windows has the ability to distribute different
applications (which are really threads) to different CPUs. So even if
the application is single threaded, it can run on one core, while
another application can run on a second core.
Windows
will automatically affinitize threads within processes so there's
nothing special required beyond making your application
multithreaded. It is important to note, however, that a poorly
implemented multithreaded application may not necessarily see a gain
in performance.

I agree, using multi-threading in a wrong or incorrect fashion can cause
the application to act in an unpredicatable fashion (random crashes,
corrupted data, unreproducable results, etc.). Before implementing a
multi-threaded application, some cursory knowledge about how threading
works is useful (mandatory? :)
 
C

CodeMonkey

PFC said:
Spam

can you plz expand on this more?

so.. if I launch a VB.net console app using a windows schedule
context; it is more capable of using multi-cores or processors??

From what I recall, if you were to launch two instances of the
application, the scheduler can launch one instance on one cpu and the
other instance on the other cpu.

If you want that single instance to be multi-threaded, then you need to
write the application to be multi-threaded. VB.Net can do multi-threaded
applications with no problems. I do it all the time for background
processes.
 
M

Michael D. Ober

CodeMonkey said:
From what I recall, if you were to launch two instances of the
application, the scheduler can launch one instance on one cpu and the
other instance on the other cpu.

If you want that single instance to be multi-threaded, then you need to
write the application to be multi-threaded. VB.Net can do multi-threaded
applications with no problems. I do it all the time for background
processes.

In addition, the framework itself is multi-threaded to the extent that most
call backs (delegates) are run on a different thread.

Mike Ober.
 

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

Top