Results 1 to 6 of 6
  1. #1
    Join Date
    Feb 2003
    Posts
    3

    Arrow Unanswered: 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

  2. #2
    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

    ==%<=============================

  3. #3
    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.

  4. #4
    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!

  5. #5
    Join Date
    Feb 2003
    Posts
    3

    Thanks

    Thank you thebap, it really works. You have
    a beer from me in Poland.
    wojtek

  6. #6
    Join Date
    Feb 2003
    Posts
    45

    Talking

    Nay problemo.

    Glad u sorted it.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •