Author: Armin Rigo <[email protected]>
Branch: 
Changeset: r1080:9b94866e95da
Date: 2014-03-20 08:27 +0100
http://bitbucket.org/pypy/stmgc/changeset/9b94866e95da/

Log:    This contention management policy is much better. Document the
        problem with the previous one.

diff --git a/c7/stm/contention.c b/c7/stm/contention.c
--- a/c7/stm/contention.c
+++ b/c7/stm/contention.c
@@ -69,6 +69,14 @@
 __attribute__((unused))
 static void cm_always_wait_for_other_thread(struct contmgr_s *cm)
 {
+    /* we tried this contention management, but it seems to have
+       very bad cases: if thread 1 always reads an object in every
+       transaction, and thread 2 wants to write this object just
+       once, then thread 2 will pause when it tries to commit;
+       it will wait until thread 1 committed; but by the time
+       thread 2 resumes again, thread 1 has already started the
+       next transaction and read the object again.
+    */
     cm_abort_the_younger(cm);
     cm->try_sleep = true;
 }
@@ -110,7 +118,7 @@
 #ifdef STM_TESTS
     cm_abort_the_younger(&contmgr);
 #else
-    cm_always_wait_for_other_thread(&contmgr);
+    cm_pause_if_younger(&contmgr);
 #endif
 
     /* Fix the choices that are found incorrect due to TS_INEVITABLE
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to