Best practice for variables shared between processes?
david at cantrell.org.uk
Tue Sep 21 13:20:08 BST 2010
On Mon, Sep 20, 2010 at 05:43:20PM +0100, Peter Edwards wrote:
> On 20 September 2010 17:30, Roger Burton West <roger at firedrake.org> wrote:
> > I wish to have two processes, a "producer" (which will create files) and
> > a "consumer" (which will do something with them), running
> > simultaneously. Ideally the producer would push filenames to a list as
> > it finishes producing them, while the consumer would shift them off the
> > same list (or loop-wait, if the list is empty).
> > What is the accepted best practice for achieving this effect in modern
> > idiomatic Perl?
> Use a queue?
> or for larger scale
> ApacheMQ | RabbitMQ | Beanstalkd
My first choice would be to just use the filesystem. Have the
producer(s) write its files somewhere and then mv them to a directory
that the consumer knows about once it's completely written.
The consumer would then process files in m-time order.
David Cantrell | Hero of the Information Age
Eye have a spelling chequer / It came with my pea sea
It planely marques four my revue / Miss Steaks eye kin knot sea.
Eye strike a quay and type a word / And weight for it to say
Weather eye am wrong oar write / It shows me strait a weigh.
More information about the london.pm