Re:Ruby concurrency explainined simply
by viraptor on Wednesday February 23, 2011 @06:41AM
(#2253774)
As much as this was informative... "However these people often don’t mention that the GIL makes single threaded programs faster" <- how did they ever get that idea?
[ Parent
| on HN ]
Re:Ruby concurrency explainined simply
by fuzzyman on Wednesday February 23, 2011 @10:10AM
(#2254275)
Because there is no need for locking in the fundamental data-types like hashes.
Re:Ruby concurrency explainined simply
by viraptor on Wednesday February 23, 2011 @11:04AM
(#2254514)
Why would you lock anything in a sigle-threaded code in the first place?
I don't know about Ruby, but in Python, the GIL is there to protect the interpreter from complicated locking and memory management overhead that thread-safety would require of it: http://mail.python.org/pipermail/python-3000/2007-May/007414...
@jessenoller has a great summary of concurrency in Python: http://jessenoller.com/2009/02/01/python-threads-and-the-glo...
The two worlds seem very similar.
Re:Ruby concurrency explainined simply
by viraptor on Wednesday February 23, 2011 @11:40AM
(#2254696)
Sure, I understand the idea of GIL being faster than fine-grained locking for single-threaded apps. This is not how I read the article though (maybe that's what they meant...).
The speed can be sorted as (in most cases): single-threaded code, single-threaded with GIL, single-threaded with fine locks.