ruby - gil

Ruby 2015. 4. 13. 21:27



ruby 공부를 하면서, Global Interpreter Lock(http://en.wikipedia.org/wiki/Global_Interpreter_Lock)에 대해서 알게 되었다. ruby 에서는 muli-thread 코딩이 할 수 있지만, 사실상 GIL 때문에 성능이 올라가지 않는다. 




https://www.igvita.com/2008/11/13/concurrency-is-a-myth-in-ruby/





따라서 JVM을 업은 JRuby만 멀티 쓰레드를 잘 동작할 수 있다. 아니면, Mutl-process 방식을 써서 해야 한다.


반면, python쪽도 같이 GIL 이슈가 있다. Cpython은 GIL 이슈가 있고, pypy, Jython은 이슈가 없다. 



그림으로 GIL을 이해할 수 있는 블로그도 있다.

http://www.jstorimer.com/blogs/workingwithcode/8085491-nobody-understands-the-gil




Posted by '김용환'
,