ScriptingContainer, Ruby Runtime and Variable Map


#1

(Crossposting note: This question has also been posted at the JRuby
mailing list (removed_email_address@domain.invalid) on December 20, and on
http://stackoverflow.com/questions/34659435/scriptingcontainer-ruby-runtime-and-variable-map
as well, but hasn’t got any response yet).

This question is about understanding the impact of the LocalContextScope
parameter in the presence of multi-threading.

We can find at
https://github.com/jruby/jruby/wiki/RedBridge#Context_Instance_Type a
recipe which helps about choosing the best value for the
LocalContextScope parameter. This page explains, that this parameter
controls, whether ScriptingContainer and/or Ruby Runtime and/or Variable
Map is shared among threads. However, I would like to get a somewhat
deeper understanding to this issue, in particular, which part of the
“system” is implemented in which one of those three components.

For example, when I create global variables in Ruby, or new classes, or
functions and variables in the top level context, do they belong to the
ScriptingContainer, to the runtime, or to the variable map? What if I
modify a standard class, for example, by adding a method - what needs to
be shared so that the changes will be visible everywhere?