Hacker News new | ask | show | jobs
by viraptor 5596 days ago
Why would you lock anything in a sigle-threaded code in the first place?
1 comments

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.

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.