Craig Votava (Sat 01/19/08 14:40):
>> 
>> I don't understand why you wouldn't simply fork off a parser via
>> Wheel::Run and let the OS essentially handle prioritization for you.
>> That's one common way of handling expensive tasks.
> 
> Let me expound upon what I think you're saying, and please correct me
> when I go off track.
> 
> You suggest that I keep the data input and GUI as separate POE sessions
> under the parent process id, letting POE sequence between the two jobs
> (something which I think is ok to do).
> 
> You also suggest that I use Wheel::Run to spawn the parser off as a
> child process (possibly with a worse process priority than the parent)
> in order to have the OS do the prioritization for me. This is a very
> interesting idea.
> 
> The parent will have to send data to the child to be parsed, but this
> could be accomplished using the ptk DoWhenIdle call. I think you might
> have something here.

You do this with put() or by creating a new wheel.  In the first case
you would create a single wheel to which all parse requests are sent.
I use this method with things like database connections where I don't
want to reconnect each time.  On the other hand, we run a daemon that
runs hundreds of jobs simultaneously. Some take 5 seconds and others
hours (even days) to run.  We can't use a single wheel in this case so
we create a new one for each job.

Those are some of the choices.  You'll have to decide based on your
parsing needs, the frequency of input, the acceptable amount of lag
between input and parsing, etc.  The flow is very simple though:
receive input, send to another process, and, at some point, receive
an event that the parsing failed or succeeded.

> 
> Would it make sense to have the data input also be a child, or is it
> good enough to simply keep it as a session in the parent? I can't seem
> to find good arguments either way.

I suppose it depends on the potential for data input to block for 
unacceptable amounts of time.  I would guess that tk and input,
from which the parsing wheel(s) are created, sessions would be enough.

Zach

Reply via email to