On 2020-09-02, Greg Ewing wrote:
> On 2/09/20 8:32 am, Neil Schemenauer wrote:
> > The most obvious approach is to adopt a multi-threaded model like is
> > done by modern Java.  I.e. no GIL and non-thread safe core data
> > structures.  That sounds a bit scary but based on Java experience it
> > seems programmers can manage it.
> 
> I think that depends on how non-thread-safe it is. If it's
> "weird things can happen" it might be all right. But if
> it's "can crash the interpreter" it might not be all right.

Weird things would include unexpected exceptions.  This seems a
relevant discussion:

    
https://softwareengineering.stackexchange.com/questions/262428/race-conditions-in-jvm-languages-versus-c-c#262440

The Java spec seems to contain the details but I admit I haven't
studied them:

    https://docs.oracle.com/javase/specs/jls/se8/html/jls-17.html

Getting exceptions if your locking is incorrect seems an okay
tradeoff to me.  My knowledge of Java is pretty limited but I
believe they originally tried to make the core data structures
thread-safe (e.g. maps, vectors).  That turned out to be too
difficult or too expensive.  Instead, the core collection types are
not thread-safe and they introduced new "concurrent" collections.
That way, you only pay the cost of synchronization if you need it.
_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/python-dev@python.org/message/JSYPXRC2N4LXVYIP4IB53LQKKFDYLD4M/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to