Solved

Is threading a good option?

Posted on 2006-07-21
3
247 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 125 total points
Comment Utility
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
Comment Utility
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
Comment Utility
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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Suggested Solutions

We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

728 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now