# ScriptingContainer, Ruby Runtime and Variable Map

**URL:** <https://www.ruby-forum.com/t/scriptingcontainer-ruby-runtime-and-variable-map/243765>\
**Category:** JRuby\
**Created:** [January 2, 2016, 11:18am UTC](https://www.ruby-forum.com/t/scriptingcontainer-ruby-runtime-and-variable-map/243765 "2016-01-02T11:18:53Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sadaf\_N](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/858c86/32.png) [@Sadaf\_N](https://www.ruby-forum.com/u/Sadaf_N)\
**Post date:** [January 2, 2016, 11:18am UTC](https://www.ruby-forum.com/t/scriptingcontainer-ruby-runtime-and-variable-map/243765/1 "2016-01-02T11:18:53Z")

</div>

(Crossposting note: This question has also been posted at the JRuby  
mailing list (removed\_email\_address@domain.invalid) on December 20, and on

> <https://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](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?
