# Global lock

**URL:** <https://www.ruby-forum.com/t/global-lock/72141>\
**Category:** Ruby\
**Created:** [October 14, 2006, 6:03pm UTC](https://www.ruby-forum.com/t/global-lock/72141 "2006-10-14T18:03:34Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![taq](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/7c8e57/32.png) [@taq](https://www.ruby-forum.com/u/taq)\
**Post date:** [October 14, 2006, 6:03pm UTC](https://www.ruby-forum.com/t/global-lock/72141/1 "2006-10-14T18:03:34Z")

</div>

Hi there!

Does Ruby threading model uses a global lock as Python uses?

Thanks!

---

<div class="post-metadata">

**Author:** ![taq](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/7c8e57/32.png) [@taq](https://www.ruby-forum.com/u/taq)\
**Post date:** [October 14, 2006, 6:27pm UTC](https://www.ruby-forum.com/t/global-lock/72141/2 "2006-10-14T18:27:57Z")

</div>

Hi,

In message “Re: Global lock”  
on Sun, 15 Oct 2006 01:03:37 +0900,  
“=?utf-8?Q?Eust=c3=a1quio\_Rangel?=” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) writes:

|Does Ruby threading model uses a global lock as Python uses?

No. It’s worse (in a sense). It uses its own green thread.

```
						matz.

```

---

<div class="post-metadata">

**Author:** ![taq](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/7c8e57/32.png) [@taq](https://www.ruby-forum.com/u/taq)\
**Post date:** [October 14, 2006, 7:03pm UTC](https://www.ruby-forum.com/t/global-lock/72141/3 "2006-10-14T19:03:59Z")

</div>

Yukihiro M. wrote:

> |Does Ruby threading model uses a global lock as Python uses?  
> No. It’s worse (in a sense). It uses its own green thread.

Thanks for your answer, Matz! Can you give me a tip where I can learn  
more things about this matter? I mean, some URL for  
documentation/article or where to look on the Ruby source code?

Thanks again!

---

<div class="post-metadata">

**Author:** ![taq](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/7c8e57/32.png) [@taq](https://www.ruby-forum.com/u/taq)\
**Post date:** [October 16, 2006, 5:48pm UTC](https://www.ruby-forum.com/t/global-lock/72141/4 "2006-10-16T17:48:31Z")

</div>

Hi,

In message “Re: Global lock”  
on Sun, 15 Oct 2006 02:04:02 +0900,  
“=?utf-8?Q?Eust=c3=a1quio\_Rangel?=” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) writes:

|Thanks for your answer, Matz! Can you give me a tip where I can learn  
|more things about this matter? I mean, some URL for  
|documentation/article or where to look on the Ruby source code?

See [Download Ruby](http://www.ruby-lang.org/en/downloads/) for source download  
instruction. For threading matters, eval.c has everything.  
Note: beware. it’s a black magic inside.

```
						matz.

```

---

<div class="post-metadata">

**Author:** ![taq](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/7c8e57/32.png) [@taq](https://www.ruby-forum.com/u/taq)\
**Post date:** [October 16, 2006, 6:08pm UTC](https://www.ruby-forum.com/t/global-lock/72141/5 "2006-10-16T18:08:40Z")

</div>

On 10/16/06, Yukihiro M. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> In message “Re: Global lock”  
> on Sun, 15 Oct 2006 02:04:02 +0900, “=?utf-8?Q?Eust=c3=a1quio\_Rangel?=” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) writes:
> 
> |Thanks for your answer, Matz! Can you give me a tip where I can learn  
> |more things about this matter? I mean, some URL for  
> |documentation/article or where to look on the Ruby source code?
> 
> See [Download Ruby](http://www.ruby-lang.org/en/downloads/) for source download  
> instruction. For threading matters, eval.c has everything.  
> Note: beware. it’s a black magic inside.

Jumping directly to eval.c can be very scary.  
It is probably easier to follow order given in  
[http://eigenclass.org/hiki.rb?ruby+internals+guide](http://eigenclass.org/hiki.rb?ruby+internals+guide)

---

<div class="post-metadata">

**Author:** ![taq](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/7c8e57/32.png) [@taq](https://www.ruby-forum.com/u/taq)\
**Post date:** [October 16, 2006, 6:57pm UTC](https://www.ruby-forum.com/t/global-lock/72141/6 "2006-10-16T18:57:39Z")

</div>

> > See [Download Ruby](http://www.ruby-lang.org/en/downloads/) for source download  
> > instruction. For threading matters, eval.c has everything.  
> > Note: beware. it’s a black magic inside.

> Jumping directly to eval.c can be very scary.  
> It is probably easier to follow order given in  
> [eigenclass.org](http://eigenclass.org/hiki.rb?ruby+internals+guide)

I download and compile the sources on every release, I made a Slackware  
build file some months ago for it. 🙂

I opened eval.c before, just needed to make sure I was on the right  
place (I searched for “thread” on the source code and there I was) and  
as you and Tomasz said, it’s scary and looks like black magic going  
directly there, but I’ll take a look carefully.

Thanks again!
