Ive been thinking about how to decrease the internal synchronization that goes on in Jython. From my conceptual viewpoint there are going to be 2 simple camps:
1. Users who expect/want GIL like behavior for threading. They expect 1 thead at a time to execute.
2. Users who expect/want Java behavior for threading. They will do the synching themselves.
As to #1, Im not sure if synchronizing access to all data structures really does this. This is kind of the norm now with Jython since it uses synched collections and such all over the place. This doesn't seem to guarantee 1 thread running at a time, but I guess we can call it the quasi-GIL way of Jython. Having this behavior will help out app written to this model execute in Jython(like Twisted).
As to #2, this seems to ask for the the desynching of Jython, let the Jython developer do it himself(like me).
So how best to deal with the contending needs? One option Ive considered, is allowing the user to specify different synchronization models for the running Jython.
or something like that. Id expect the default to be the "gil", which corresponds to the current state of affairs. "none" would mean use unsynchronized objects for storage and such.
Implementation wise, Id expect a simple factory class to deal with creating the right internals.
Map map = CollectionCreator.createMap();
/// "gil" map, is a Hashtable, or even a HashMap with a synchronization layer over it
/// "none", return a HashMap
List l = CollectionCreator.createList();
//"gil", make it a Vector
// "none", return an ArrayList
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around