thread lockdef f(list1, list2): acquire_all_locks(list1.lock, list2.lock) x = list1.pop() list2.append(x) release_all_locks(list1.lock, list2.lock)Software Transactional Memory (STM)def f(list1, list2): while True: t = transaction() x = list1.pop(t) list2.append(t, x) if t.commit(): breakhttp://morepypy.blogspot.tw/2012/08/multicore-programming-in-pypy-and.html
http://morepypy.blogspot.tw/2011/06/global-interpreter-lock-or-how-to-kill.html
http://en.wikipedia.org/wiki/Hardware_transactional_memory
http://cs.brown.edu/courses/csci1610/papers/stm.pdf
http://morepypy.blogspot.tw/2011/08/we-need-software-transactional-memory.html