2

This is more curiosity than anything else (I should totally drop that and try jRuby), but is it possible to disable YARV ruby's global interpreter lock and any other associated locks?

I assume this would "void your warranty" as some of YARV Ruby's libraries aren't thread safe, but would it cause any other problems?

Andrew Grimm
  • 78,473
  • 57
  • 200
  • 338

2 Answers2

0

Tenderlove has tweeted about a patch to disable the GIL:

I’d like to see @_ko1’s experimental patch to remove the GIL /cc @yukihiro_matz #rubyconf

Andrew Grimm
  • 78,473
  • 57
  • 200
  • 338
0

There is no way to disable it unless you actually edit the source code and recompile. I haven't looked at how it's implemented, but I'm guessing it's hard to just "pop" it out of the code. If you don't want a GIL you could try JRuby, and I'm pretty sure Rubinius doesn't have one as well.

sarahhodne
  • 9,796
  • 3
  • 39
  • 44
  • I was under the impression that Rubinius had to introduce the GIL so that C extensions would always work. Or maybe the GIL is only active when using C extensions? It's also possible that I'm totally incorrect. – cam Jan 26 '11 at 07:38
  • You don't need a GIL for C extensions (I think). Brian Ford was saying at the last PDXruby meeting that the way they do it is to add a small lock on modifying variables. So if one thread is modifying @a, other threads doing the same will have to wait, while threads doing other things will keep running fine. – sarahhodne Feb 08 '11 at 16:32