News for hackers. Stuff that matters.
Re:Grumpy: Go running Python by joshuata on Wednesday January 04, 2017 @01:06PM (#13320535)
In regards to the third point: The global interpreter lock protects the fact that python's GC scheme is not thread safe. It does not coordinate accesses across threads, and therefore grumpy's would not either. In grumpy the GIL is replaced by Go's GC implementation that is specifically tuned for multithreaded execution. Any additional synchronization would need to be done with individual locks etc...
Re:Grumpy: Go running Python by beagle3 on Wednesday January 04, 2017 @04:17PM (#13322133)
The GIL is not just for GC; it does coordinate access across threads, albeit at a very low level -- if two threads execute "mylist.append(v)" at the same time, it is the GIL that makes sure it actually works as expected, and from comments above it seems grumpy uses per-object locks for that.
Re:Grumpy: Go running Python by earthboundkid on Wednesday January 04, 2017 @11:12PM (#13324672)
That's not a good characterization of the GIL. It doesn't prevent races or make multithreaded mylist.append safe. It makes sure that mylist.append doesn't cause a segfault as the bytes in RAM are in an inconsistent state during an update. Beyond that, it doesn't really protect you from your bad threaded code.
Re:Grumpy: Go running Python by beagle3 on Thursday January 05, 2017 @01:10AM (#13325128)
(assuming mylist is a standard python list) it does prevent races inside mylist.append. It does make mylist.append safe.

When I wrote "append from two threads .. as expected" I meant "two items will be added, which one first is unspecified", and the GIL certainly takes care of that.

I agree it does not protect you from your bad threaded code - but then, nothing short of STM does (and even STM doesn't guarantee starvation in the general sense - nothing can).

Re:Grumpy: Go running Python by eloff on Thursday January 05, 2017 @10:05AM (#13327588)
An unintended side effect of the GIL is that all calls to a C implemented function are atomic and single threaded, provided that the C function doesn't release the GIL. In practice this means lists and dicts are thread safe and existing Python code relies on this.