Hi Jorge,

> >   (de processCustomers (N . Prg)
> >      (let Lst (need N)
> >         (iter (tree 'nr '+CuSu)
> >            '((This)
> >               (let Pos (wait NIL (memq NIL Lst))
> >                  (set Pos T)
> >                  (later Pos
> >                     (run Prg)
> >                     NIL ) ) ) ) ) )
> 
> Thanks, that looks good. My only objection would be the additional
> fork() implied by 'later'.

Not sure. I rather believe that the database file I/O is the bottleneck.
Then a direct, single-threaded iteration might be even the fastest.

The parallel stuff makes only sense if the processing in the 'Prg' is
very CPU intensive.


> Another option to avoid the fork() would be to have a pool of
> pre-forked instances reading from a jobs queue or something like that
> (perhaps taking advantage of an additional database to implement the
> queue?), but my skills are still lacking on how to implement that.

That's also an interesting approach.


An important question is: Does this parallel processing of database
objects also involve modifications of these objects? If so, the
necessary synchronization between the processes will produce additional
costs.

Cheers,
- Alex
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe

Reply via email to