On Sun, 30 Sep 2001, Hong Zhang wrote: > > >How does python handle MT? > > > > Honestly? Really, really badly, at least from a performance point of view. > > There's a single global lock and anything that might affect shared state > > anywhere grabs it. > > One way to reduce sync overhead is to make more operation atomic instead > of of sync. For example, read() write() are atomic. There is no need to > sync stream. The array get/put are atomic in Java, so we don't need sync > either. The high level library or app itself will be responsible for the > sync.
Now how do you go about performing an atomic operation in MT? I understand the desire for reentrance via the exclusive use of local variables, but I'm not quite sure how you can enforce this when many operations are on shared data (manipulating elements of the interpreter / global variables). I definately agree that locking should be at a high level (let them core if they don't obey design it well). I liked the perl5 idea that any scalar / array / hash could be a mutex. Prevents you from having to carry around lots of extra mutex-values. We can achieve the exact same "synchronization" policy of java or one that's finer tuned for performance. -Michael