On 8/19/07, skaller <[EMAIL PROTECTED]> wrote:

> So the point of this note is that you should carefully
> restrict the visibility of any channels you create
> to the fthreads that communicate using them: if any
> active thread COULD use the channel, other threads
> waiting on it will not die.

I think my visibility is right, I want all the threads
to just go away (i.e. not be rescheduled) after the launching
thread exits. It's easier to do this via schannels than
via quit flags, especially if I tie them into my periodically
called timing fns. No, my problem here turned out to be a form
of starvation: the flx runtime when executing a read or write
always reschedules an fthread, however  instead of that thread
going to the end of the active queue, like a good englishman,
it jumps straight to the front, all'italiana.  This means that
if you have two fthreads writing to one schannel with a third
fthread reading from it, the second writing fthread will not be
rescheduled until the first writer exits, if it exits. I'm not
sure that this behaviour is 100% wrong: fthread scheduling is
blissfully undefined and probably should be that way, also all
fthreads  will have forward progress if they terminate, and
the code's probably more instruction cache friendly, but on the
other hand, it doesn't feel right either. I DO want to write
non-terminating flx procedures that communicate/deschedule themselves
via schannels,  that just evaporate  when the other end of
the schannel goes away:

proc gen_coords(ch: schannel[point]) {
  forever {
    write_chan(ch, gen_pt(t));
  };
}

The above mightn't be the best example, it would more simply
done with a generator (does felix have generators? what's the
syntax?)

Anyway, search push_front(writer) and push_front(reader) in flx_rtl.pak
to see the code I'm talking about.

RF

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
Felix-language mailing list
Felix-language@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/felix-language

Reply via email to