If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Unix Shell Scripts > Paralleled tasks in ksh

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-27-03, 07:40
wpietron wpietron is offline
Registered User
 
Join Date: Feb 2003
Posts: 3
Arrow Paralleled tasks in ksh

SunOS 5.8

Dear gurus,

I have a group of tasks: `task1`, `task2`, `task3`. I do not know how
long it takes to process them. But I know I can paralell them because
they are independent. When the longest task of the group ends I want to
run `task4` because it is based on results of finished `task1`, `task2`
and `task3`. I pay attantion to fact, that I do not know which task is
the longest one.

Have a look at the ascii-pic of the processing I would
like to get:

#################################
--task1-----
--task2--
--task3-----------
--task4-------
|paralelled tasks | task depended|
#################################

Are where any mechanism in ksh that let me do such a processing? I tried
any combination of 'wait', 'exec', '&', '(', ')' but I was not
successful.

Does anybody know any other shells or tools that can enable me such
a processing?

I appreciate any help. Examples would be great.
Thank you in advance.
Wojciech
Reply With Quote
  #2 (permalink)  
Old 02-27-03, 08:51
thebap thebap is offline
Registered User
 
Join Date: Feb 2003
Posts: 45
Question Wait

Are you running these tasks in the Background ?

I've used wait in the past and it worled OK for me, the wait command waits for background processes to complete before continuing :

ie:

==%<=============================
#!/usr/bin/ksh

## Run each task in the background
task1 &
task2 &
task3 &

## Now we wait for the above to finish prior to running task 4
wait

task4

==%<=============================
Reply With Quote
  #3 (permalink)  
Old 02-27-03, 09:32
wpietron wpietron is offline
Registered User
 
Join Date: Feb 2003
Posts: 3
Hi,

isn't 'wait' waiting for the last process? I am going to check it out
right now.

Thank you for your help.
Reply With Quote
  #4 (permalink)  
Old 02-27-03, 09:36
thebap thebap is offline
Registered User
 
Join Date: Feb 2003
Posts: 45
Lightbulb Wait

Well the man page for wait on my Solaris 8 box indicates wait
as waiting for any background processes I would run within a script.

I've used it under DG Unix , Linux and Solaris so I'd say it works!
Reply With Quote
  #5 (permalink)  
Old 02-27-03, 09:40
wpietron wpietron is offline
Registered User
 
Join Date: Feb 2003
Posts: 3
Thanks

Thank you thebap, it really works. You have
a beer from me in Poland.
wojtek
Reply With Quote
  #6 (permalink)  
Old 02-27-03, 09:44
thebap thebap is offline
Registered User
 
Join Date: Feb 2003
Posts: 45
Talking

Nay problemo.

Glad u sorted it.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On