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 and shell scripting languages 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 12:01 PM
Make : parallel execution suman_jakkula AIX 0 03-14-2006 03:33 AM
parallel environment in aix mzzt AIX 0 01-09-2006 03:32 PM
How to run processes in parallel? sbasak Shell Programming and Scripting 3 11-03-2004 01:12 PM
How to do parallel processing?? zing UNIX for Dummies Questions & Answers 1 06-23-2003 01:47 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 05-09-2005
RishiPahuja's Avatar
RishiPahuja RishiPahuja is offline
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
  #2 (permalink)  
Old 05-09-2005
jim mcnamara jim mcnamara is online now Forum Staff  
...@...
  
 

Join Date: Feb 2004
Location: NM
Posts: 5,808
Assuming that by running separate processes you get better throughput, this is a fine way to proceed.
  #3 (permalink)  
Old 05-10-2005
Omkumar Omkumar is offline
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
  #4 (permalink)  
Old 05-10-2005
RishiPahuja's Avatar
RishiPahuja RishiPahuja is offline
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
  #5 (permalink)  
Old 05-10-2005
jim mcnamara jim mcnamara is online now Forum Staff  
...@...
  
 

Join Date: Feb 2004
Location: NM
Posts: 5,808
RishiPahuja -

We use the control file method just like you do. Sorry for any confusion
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 12:30 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0