Re: Invoking External Batch Program on Multiple Core Machine
- From: "Peter Duniho" <NpOeStPeAdM@xxxxxxxxxxxxxxxx>
- Date: Wed, 16 May 2007 02:29:52 -0700
On Wed, 16 May 2007 01:35:57 -0700, Luc The Perverse <sll_noSpamlicious_z_XXX_m@xxxxxxxxxx> wrote:
Hello! You may remember me as the guy who's trying to learn C# and using
that old version 2003 of visual studio. (Although free version of command line .NET compiler is available, so if some new feature would greatly
simplify my life, then I am not opposed)
A free version of the *IDE* is available, not just the command line compiler. You should upgrade, VS 2005 is very nice (I haven't used 2003, but I have a friend who is using it now and every time I mention "well, VS does this for me" he always finds himself saying "really? VS 2003 doesn't do that"...I gather it's a pretty significant upgrade, and frankly I was surprised at how much was left usable in the Express version, considering it's free).
I currently have an application that is single threaded that does batch work (you pass it a file in the command line, it runs for 2-45 minutes and spits out another file). I do not own the application and do not know what it is written in.
This is very annoying since I have a dual core machine and would like to get my work done as quickly as possible.
So long as you remember that "dual core" does not mean "dual hard drive" or "dual RAM". :) Depending on what that application is actually doing, you may or may not realize benefits by having it run in the background while you try to get something else done.
Is there a way to invoke a foreign application from C# to run on a specified core? (If so, can you point me to an example?)
You can use the Process class to start a new process with a specific command, and you can even set the ProcessorAffinity on the class instance to control what CPUs it runs on. However, why would you want to set a specific CPU? Windows is smart enough to distribute the workload fairly across whatever CPUs are available. There's no need to assign the process to a specific one.
Right now we do our work, click "compile" and then wait. Eventually I would like to try to implement some form of distributed computing on all our
office computers, so that someone needing to compile 4-5 items can occupy
the same number of idle cores accross the network.
The idea is sound. So sound, in fact, that I'm pretty sure I've read of implementations that already exist to do this sort of thing. I think there are even general-purpose solutions that you might be able to use off-the-shelf. That said, depending on what exactly you're trying to do, it may not be very hard to do it. Use some sort of peer-to-peer architecture to control workload requests (.NET remoting? Socket? WCF? Whatever...), run the process (capturing the output if you like).
Just keep in mind the caveat I mentioned at the outset: just because a CPU core is available, that doesn't mean that running a process on the computer won't impact whatever work someone else is already doing on the computer.
Pete
.
- References:
- Invoking External Batch Program on Multiple Core Machine
- From: Luc The Perverse
- Invoking External Batch Program on Multiple Core Machine
- Prev by Date: autocomplete
- Next by Date: Re: C# Updatable Software
- Previous by thread: Invoking External Batch Program on Multiple Core Machine
- Next by thread: autocomplete
- Index(es):
Relevant Pages
|