SPUG: Re: question on fork()

Richard Anderson richard at richard-anderson.org
Sat Feb 23 02:07:58 CST 2002


Being a fan of the System V interprocess communication facilities, I'd put
the list in shared memory with an associated semaphore to allow multiple
processes to use the list.  Then I'd fork of 5 subprocesses, each of which
takes an item off the list, processes it, then takes another item off the
list until the list is empty.  No need to keep respawning subprocesses; five
is all you need.  See man perlipc.

Cheers,
Richard
richard at richard-anderson.org
www.richard-anderson.org
www.raycosoft.com
----- Original Message -----
From: "Sean Dwyer" <oladar at drizzle.com>
To: "Spug" <spug-list at pm.org>
Sent: Friday, February 22, 2002 7:47 PM
Subject: SPUG: question on fork()


> All,
>
> What I am trying to do is iterate through a list (call it 100 items for
> sake of argument) 5 at a time. I can fork off the initial 5 processes but
is
> it possible to,  as a processes finishes, spawn a new proceses to handle
the
> next item in the list. Everything I have tried so far isn't working. ANy
> advice would be great.
>
> thanks,
>
> Sean Dwyer
> Oladar Computer Services
>
>
>
>  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
>      POST TO: spug-list at pm.org       PROBLEMS: owner-spug-list at pm.org
>       Subscriptions; Email to majordomo at pm.org:  ACTION  LIST  EMAIL
>   Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address
>  For daily traffic, use spug-list for LIST ;  for weekly, spug-list-digest
>      Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org
>
>
>


 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     POST TO: spug-list at pm.org       PROBLEMS: owner-spug-list at pm.org
      Subscriptions; Email to majordomo at pm.org:  ACTION  LIST  EMAIL
  Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address
 For daily traffic, use spug-list for LIST ;  for weekly, spug-list-digest
     Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org





More information about the spug-list mailing list