On Thursday, January 21, 2016 at 10:58:51 AM UTC-5, Sam Tobin-Hochstadt wrote:
> Hi Brian,
> 
> A few suggestions:
> 
> 1. You really want to use synchronization to determine when to end,
> not sleeping. Have each place write a message back to its parent when
> it is done, and have the parent wait for that message before
> finishing.

That seems difficult in this case since each worker is in a loop where it reads 
a line from it's place channel, does some work and then writes the result to 
another place channel, so it's processing a stream.

I suppose the main place could write a terminating message to each worker after 
the input file has been read, and then wait for the worker place to also send 
back a terminating message.

> 2. Async channels are implemented with threads, and threads can't be
> sent between places. This is currently pretty fundamental to the way
> places work -- they are essentially copies of the Racket runtime which
> don't share anything, so things like threads (or procedures or mutable
> data) can't be sent between them.

I have a better idea of how places work now, but it seems like it would be 
handy to have a way to limit the size of a place channel, right?  If my input 
place is running much faster than the worker places, each of the worker place 
channels may be getting *huge* which seems bad.

> If what you need is buffering in places, you should probably write a
> buffer yourself using a thread and a mutable vector, which will
> consume all the messages sent to the worker place.

The blocking needs to be done in front of the worker place channel though, not 
after it, right? In other words, I'm trying to prevent the place channels from 
growing w/o bound. My goal is to maximize use of the cores and minimize elapsed 
time - my understanding of Racket threads is they only run one at a time, so 
I'm not sure how a thread would help in this case.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to