4 ms·
Very cool. I am interested to see how this progresses. It seems to me there is lots of optimisation possible to alleviate the cost of contention with greater n
by jpgvm 12y ago
Very cool.
I am interested to see how this progresses. It seems to me there is lots of optimisation possible to alleviate the cost of contention with greater number of threads.
Single thread performance will always have to suffer somewhat but their cheap read barriers have done wonders already to bring that down to an acceptable level. It will reach a point however where the only way to speed it up further will be for the programmer to be able to specify STM hints for variables.
I would like to see this in Java or C# where there is more room for extended optimisation.
Kudos to the PyPy guys for sticking to their guns on this.
- Torn 12y agoJava and C# don't have a GIL though, and have good support for threading right?
- VMG 12y agoSTM is useful even if you have good threading support. You could easily build a STM library for Java or C#, and there are some, but without syntax support it's pretty cumbersome to use. Clojure has good STM support because it's easy to add the necessary primitives to a Lisp.
- jpgvm 12y agoPrecisely. :) STM's advantages are not so much in -enabling- threading, but instead allowing for new paradigms (possibly simpler ones).
- thesz 12y agoLinked list for single processor is a job for first year student. Linked list for multiprocessors with mutexes and locks is a PhD-level job. Linked list for multiprocessors with STM is a job for first year student again. The quote is from one of Simon Peyton-Jones talks.
- Torn 12y agoThanks - that quote immediately shifted my thinking.
- eslaught 12y agoJava (and probably also C#) already has mature STM implementations. Here is one, but there are certainly others: https://sites.google.com/site/deucestm/ https://sites.google.com/site/deucestm/ As noted in the other comments, you don't need STM for parallelism in Java and C# because they have access to native threads. But the programming model may still be nicer to use than the standard threads-with-shared-memory programming model.
- bkeroack 12y agoStandard CPython also has access to native threads. The Python threading module is just a thin wrapper over pthreads. The issue is that the GIL prevents threads from exploiting multiple cores.