# Common variable in a more than one process?

**URL:** <https://www.ruby-forum.com/t/common-variable-in-a-more-than-one-process/125095>\
**Category:** Ruby\
**Created:** [January 5, 2008, 11:16am UTC](https://www.ruby-forum.com/t/common-variable-in-a-more-than-one-process/125095 "2008-01-05T11:16:38Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mokkai](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/c2a13f/32.png) [@mokkai](https://www.ruby-forum.com/u/mokkai)\
**Post date:** [January 5, 2008, 11:16am UTC](https://www.ruby-forum.com/t/common-variable-in-a-more-than-one-process/125095/1 "2008-01-05T11:16:38Z")

</div>

is there any way to access a common variable in more than one processes  
which are created in ruby ?

or

can we access a global variable or class variable into more than one  
processes…

---

<div class="post-metadata">

**Author:** ![mokkai](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/c2a13f/32.png) [@mokkai](https://www.ruby-forum.com/u/mokkai)\
**Post date:** [January 5, 2008, 2:45pm UTC](https://www.ruby-forum.com/t/common-variable-in-a-more-than-one-process/125095/2 "2008-01-05T14:45:25Z")

</div>

On 05.01.2008 11:16, Pokkai D. wrote:

> is there any way to access a common variable in more than one processes  
> which are created in ruby ?
> 
> or
> 
> can we access a global variable or class variable into more than one  
> processes…

Depends on the usage. For values that change often you could use DRb.

Cheers

robert

---

<div class="post-metadata">

**Author:** ![mokkai](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/c2a13f/32.png) [@mokkai](https://www.ruby-forum.com/u/mokkai)\
**Post date:** [January 5, 2008, 8:32pm UTC](https://www.ruby-forum.com/t/common-variable-in-a-more-than-one-process/125095/3 "2008-01-05T20:32:52Z")

</div>

You can set variables before fork.

but if you want to change them you should probably check SystemVIPC (on  
inux and cygwin) or drb
