Solved

Is threading a good option?

Posted on 2006-07-21
3
274 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
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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Article by: Najam
Having new technologies does not mean they will completely replace old components.  Recently I had to create WCF that will be called by VB6 component.  Here I will describe what steps one should follow while doing so, please feel free to post any qu…
Summary: Persistence is the capability of an application to store the state of objects and recover it when necessary. This article compares the two common types of serialization in aspects of data access, readability, and runtime cost. A ready-to…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

809 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