Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Is threading a good option?

Posted on 2006-07-21
3
Medium Priority
?
298 Views
Last Modified: 2010-04-16
Hi

My problem:

I need to connect to a bunch of computers (4000) and execute a batch file. Because these computers are in use I have a limited window in which to accomplish this. My idea is to use a threadpool with each thread making a remote connection and executing the batch file in order to improve the time to complete. Will threading improve my time to complete. I will probably use the WMI Win32_process.create method to run the batch file.

Target computers: WinXP without .NET

Matt
0
Comment
Question by:matt_d_p
3 Comments
 
LVL 23

Accepted Solution

by:
apresto earned 375 total points
ID: 17154211
Hi matt_d_p,

Threading is good, but can be dangerous if you dont use it properly.  For exampe, if 2 threads are accessinf the same file - i dont think its going to like that, however with threading you can Queue processes.  You can use threading to run multiple processes at once, i.e you may have one thread talking and retrieving info from the database, and you might have another thread sending that information somewhere, acting as a data router

Threading is extremely useful, but do some serious reading before you commit to code

Apresto
0
 
LVL 35

Expert Comment

by:mrichmon
ID: 17154598
Threading benefits can be seen more on computers with multi processors.  If the target machines don't have multiple processors, then you may not see very much benefit and therefore it may not be worth the overhead.

A good book that discusses threading is:

C# Threading Handbook by Wrox ISBN: 1861008295
0
 

Author Comment

by:matt_d_p
ID: 17154603
Thanks Apresto

My thread will be working on a seperate remote machine in each case so I don't need to worry about syncronization or anything like that. I'm hoping that running multiple threads will reduce my time as I think a lot of the single process time is spent waiting on the network.

the only place I might have to be careful is I'd like to output the machine name to a text file for record purposes but I think I can use the built in delegate for that.
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Suggested Courses

916 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question