On Tuesday, March 8, 2016 at 5:10:45 PM UTC-5, Brian Adkins wrote:
> I'm toying around with porting a small Elixir program to Racket. The 
> following gist has both programs:
> 
> https://gist.github.com/lojic/66c00514dab54b84c56e
> 
> One thing that's quite awkward in my Racket version is the need for the extra 
> place channels (ch1, ch2). 
> 
> So, for example, the size function needs 3 channels:
> 1) pid - the place channel of the stack place to send the command to
> 2) ch1 - a channel the stack will send the response to
> 3) ch2 - a channel for size to read the response from
> 
> I think if I used Racket threads, my code would be more similar to the Elixir 
> example, because it appears that threads have their own implicit mailbox.
> 
> Do places have an implicit mailbox that I've overlooked? Or is the 3 channel 
> requirement above unavoidable?
> 
> Thanks,
> Brian

I coded up a version using threads instead of places, and it's very close to 
the Elixir code. I've added the racket-threads.rkt file to the gist:

https://gist.github.com/lojic/66c00514dab54b84c56e

I think I just need to adjust my thinking re: concurrency & parallelism. 
Threads would allow the massive concurrency of Elixir/Erlang processes but 
limited to one core. Places allow using all cores, but using a very different 
programming model - rather than spawning a million places, I understand it's 
better to spawn one per process (or possibly hyperthread), so one would likely 
make more use of queues of work units vs. sending the work units directly to 
the places.

-- 
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