#189245 - 2008-08-24 01:28 PM
Re: Asynchronous Script Execution
[Re: MySpoonIs2Big]
|
Glenn Barnas
KiX Supporter
   
Registered: 2003-01-28
Posts: 4402
Loc: New Jersey
|
I do this often to process large amouts of data. Shawn has confirmed the process and also uses the logic to run many concurrent threads. It has no bearing on the number of processors in a system.
On a P3-800 MHz system where I first tested this a few years ago, I ran 25-30 concurrent threads, processed about 400 jobs in 15 minutes at 100% CPU load. The newer systems don't even break a sweat.
Basically, what I do is:
- Create an array of tasks to run
- Run the first 25 in the list
- Monitor the task load, and when it drops below a threshold, I run a few more tasks. I'm rarely concerned about running at 100% CPU load for short durations.
So - basically, the answer is yes - you can run several tasks.
If this is a login process, you might want to give my login script a try. It does the drive & printer mapping first so those resources are available, then can display text message files for user notification, and then run any number of commands via Shell, Run, or Call. Using Call even allows you to utilize the variables and UDFs in the main script, or from script to script.
Glenn
_________________________
Actually I am a Rocket Scientist!
|
|
Top
|
|
|
|
#189246 - 2008-08-24 01:57 PM
Re: Asynchronous Script Execution
[Re: Glenn Barnas]
|
Glenn Barnas
KiX Supporter
   
Registered: 2003-01-28
Posts: 4402
Loc: New Jersey
|
Had to re-read your last statement AFTER my morning coffee...
If you are using other executables, they'll be multiple files. If you are planning on running multiple Kix scripts, you'd need individual script files - OR - some mechanism to tell Kix which "module" within the single script file to perform. I doubt that the second method will prove reliable enough, or have any benefit to make it worthwhile.
Simply - map your resources, then issue a string of Run commands, one after the other.
Run 'avupdate.exe' ; update antivirus def
Run 'bginfo.exe blah blah' ; update background with PC data
Run 'kix32.exe kixscript2.kix' ; run a concurrent kix process to tweak settings As you see, to benefit from this with other kix scripts, you need to run a separate instance of Kix32. Of course, that will isolate one script from another, so you'll need to pass any needed arguments to it on the command line ($ARG="value"). There will be no way to return data to the main script, since Run spawns a child process via Exec rather than a Fork method. There's no communication path back in this mode. Your scripts can create logs or use INI files if they need to communicate with one another. Of course, that opens issues of concurrent file access.. so its best to only use tasks that are truly independent.
Glenn
_________________________
Actually I am a Rocket Scientist!
|
|
Top
|
|
|
|
#189249 - 2008-08-24 11:38 PM
Re: Asynchronous Script Execution
[Re: Glenn Barnas]
|
MySpoonIs2Big
Fresh Scripter
Registered: 2008-08-24
Posts: 11
|
Thanks for your response! I was somewhat worried that I would be waiting a few days.
[...] Basically, what I do is: - Create an array of tasks to run
- Run the first 25 in the list
- Monitor the task load, and when it drops below a threshold, I run a few more tasks. I'm rarely concerned about running at 100% CPU load for short durations.
[...]
While it sounds like your script performs a lot more tasks than mine is going to, that is still the exact way I was planning on going about it.
|
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 937 anonymous users online.
|
|
|