Re:Proposal of a new concurrency model for Ruby 3 [pdf]
by the_mitsuhiko on Thursday September 08, 2016 @05:21AM
(#12451461)
> Seems like a guild is just a subprocess with its own resources.
In an ideal world the guild is the interpreter state which would be very far from processes. How far down you can go there largely depends on what promises the API made to C extensions and other things in the past.
Re:Proposal of a new concurrency model for Ruby 3 [pdf]
by Someone on Thursday September 08, 2016 @03:11AM
(#12450887)
I think I would consider implementing it as 1:1 threading where every thread=guild runs its own set of green threads.
That likely would be faster than having OS threads in each guild that use PS locks to prevent running >1 of them concurrently.
Re:Proposal of a new concurrency model for Ruby 3 [pdf]
by _ko1 on Thursday September 08, 2016 @05:43PM
(#12457610)
CRuby/MRI supports C-extension which can use TLS (thread-local-storage). So that each Ruby threads runs on one OS thread.
Re:Proposal of a new concurrency model for Ruby 3 [pdf]
by _ko1 on Thursday September 08, 2016 @05:45PM
(#12457627)
Like sub-process, but share many things like bytecodes (ISeq in MRI context), class and module objects (and method tables) and so on. Also we can share immutable objects (deeply frozen objects) like threads.
Re:Proposal of a new concurrency model for Ruby 3 [pdf]
by Roboprog on Thursday September 08, 2016 @12:07PM
(#12454290)
The Guild concept feels much like a mix of actors and messaging from Erlang and Go. Not as restrictive as Erlang, but not as permissive as Go. (there was a nod to Elixir/Erlang in the slides)
Re:Proposal of a new concurrency model for Ruby 3 [pdf]
by _ko1 on Thursday September 08, 2016 @06:09PM
(#12457817)
Yes.
Actually, I think Go is some kind of multi-thraeding (goroutine is only a useful mechanism on the "threads" and can't help to avoid multi-threads difficulties (but this design helps to reduce difficulties)).
Seems like a guild is just a subprocess with its own resources. And you copy objects over as needed. And when the guild is done it will get garbage collected. Like other objects.