The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
parallel processing audippa Shell Programming and Scripting 3 03-01-2007 09:01 AM
Make : parallel execution suman_jakkula AIX 0 03-14-2006 12:33 AM
parallel environment in aix mzzt AIX 0 01-09-2006 12:32 PM
How to run processes in parallel? sbasak Shell Programming and Scripting 3 11-03-2004 10:12 AM
How to do parallel processing?? zing UNIX for Dummies Questions & Answers 1 06-23-2003 09:47 AM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 05-09-2005
RishiPahuja's Avatar
Registered User
 

Join Date: Apr 2005
Location: Bangalore, India
Posts: 203
Parallel Execution

Hello,

I wish to run parallel process forked from one script.
Currently I doing is submit them in background.

For example:
---------------------------------------------------------------
#!/usr/bin/ksh

process1 &
process2 &
process3 &
.....
.....

#here I check for completion of all process success.
#each process writes its status to a file
while true
do
# code to check success

done
---------------------------------------------------------------

Is there a better way to execute jobs in paralle?
If yes please advise.

Thanks,
Rishi
Reply With Quote
Forum Sponsor
  #2  
Old 05-09-2005
...@...
 

Join Date: Feb 2004
Location: NM
Posts: 4,298
Assuming that by running separate processes you get better throughput, this is a fine way to proceed.
Reply With Quote
  #3  
Old 05-10-2005
Registered User
 

Join Date: Mar 2005
Posts: 22
What about something like...

#!/bin/ksh

./a.sh &
pid_a=$!
./b.sh &
pid_b=$!
./c.sh &
pid_c=$!

wait $pid_a
echo "a.sh returned $?"
wait $pid_b
echo "b.sh returned $?"
wait $pid_c
echo "c.sh returned $?"

-Om
Reply With Quote
  #4  
Old 05-10-2005
RishiPahuja's Avatar
Registered User
 

Join Date: Apr 2005
Location: Bangalore, India
Posts: 203
it can be good replacement if I was not seeking parallel execution...
I believe with wait the execution will become sequential...and waiting for all the process finishing starting from one...

my requirement is suppose one process is finished I need to start some processing on data prepared by tht process....

in this case say process a takes largest time then I need to wait till process a to finish before I begin for processing of b,c...z though they have already finished...

Rishi
Reply With Quote
  #5  
Old 05-10-2005
...@...
 

Join Date: Feb 2004
Location: NM
Posts: 4,298
RishiPahuja -

We use the control file method just like you do. Sorry for any confusion
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 04:57 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0