[pypy-commit] extradoc extradoc: finish the talk

arigo noreply at buildbot.pypy.org
Thu Oct 3 07:53:28 CEST 2013


Author: Armin Rigo <arigo at tunes.org>
Branch: extradoc
Changeset: r5065:d5a8d289edd6
Date: 2013-10-03 07:53 +0200
http://bitbucket.org/pypy/extradoc/changeset/d5a8d289edd6/

Log:	finish the talk

diff --git a/talk/fscons2012/talk.pdf b/talk/fscons2012/talk.pdf
index 1a6257d12b0ddced11a617033ddb00dbafc7612d..53828b62beb908f0b3f8ab8d72815e376c744719
GIT binary patch

[cut]

diff --git a/talk/pyconza2013/Makefile b/talk/pyconza2013/Makefile
new file mode 100644
--- /dev/null
+++ b/talk/pyconza2013/Makefile
@@ -0,0 +1,13 @@
+
+
+view: talk.pdf
+	xpdf talk.pdf
+
+talk.pdf: talk.tex
+	64bit pdflatex talk.tex
+
+talk.tex: talk1.tex fix.py
+	python fix.py < talk1.tex > talk.tex
+
+talk1.tex: talk.rst
+	rst2beamer $< > talk1.tex
diff --git a/talk/pycon2013/pypy_without_gil/beamerdefs.txt b/talk/pyconza2013/beamerdefs.txt
copy from talk/pycon2013/pypy_without_gil/beamerdefs.txt
copy to talk/pyconza2013/beamerdefs.txt
diff --git a/talk/pyconza2013/fix.py b/talk/pyconza2013/fix.py
new file mode 100644
--- /dev/null
+++ b/talk/pyconza2013/fix.py
@@ -0,0 +1,8 @@
+import sys
+
+for line in sys.stdin:
+    #if line.startswith('\\begin{itemize}'):
+    #    line = '\\begin{itemize}\n'
+    if line == '\\usepackage[scaled=.90]{helvet}\n':
+        line = '\\usepackage[scaled=1.1]{helvet}'
+    sys.stdout.write(line)
diff --git a/talk/pyconza2013/speed.png b/talk/pyconza2013/speed.png
new file mode 100644
index 0000000000000000000000000000000000000000..a99b2b6eb60e6c3df3118df660396286c98a41e0
GIT binary patch

[cut]

diff --git a/talk/pyconza2013/talk.pdf b/talk/pyconza2013/talk.pdf
new file mode 100644
index 0000000000000000000000000000000000000000..6fed83a5c845e1d71cd4c32a98eb6a6b93d07bcf
GIT binary patch

[cut]

diff --git a/talk/pyconza2013/talk.rst b/talk/pyconza2013/talk.rst
--- a/talk/pyconza2013/talk.rst
+++ b/talk/pyconza2013/talk.rst
@@ -1,9 +1,20 @@
+.. include:: beamerdefs.txt
 
 =======================================
 Software Transactional Memory with PyPy
 =======================================
 
 
+Software Transactional Memory with PyPy
+---------------------------------------
+
+* PyCon ZA 2013
+
+* talk by Armin Rigo
+
+* sponsored by crowdfunding (thanks!)
+
+
 Introduction
 ------------
 
@@ -15,11 +26,13 @@
 Introduction
 ------------
 
-.. image: speed.png
+.. image:: speed.png
+   :scale: 65%
+   :align: center
 
 
-SQL Databases by example
-------------------------
+SQL by example
+--------------
 
 ::
 
@@ -34,10 +47,10 @@
 
 ::
 
-    ..
+    ...
     x = obj.value
     obj.value = x + 1
-    ..
+    ...
 
 
 Python by example
@@ -56,9 +69,10 @@
 
 ::
 
-    with atomic:
-        x = obj.value
-        obj.value = x + 1
+    the_lock.acquire()
+    x = obj.value
+    obj.value = x + 1
+    the_lock.release()
 
 
 Python by example
@@ -71,6 +85,16 @@
         obj.value = x + 1
 
 
+Python by example
+-----------------
+
+::
+
+    with atomic:
+        x = obj.value
+        obj.value = x + 1
+
+
 Locks != Transactions
 ---------------------
 
@@ -107,7 +131,7 @@
 
 * Transactional Memory
 
-* advanced magic (but not more so than databases)
+* advanced but not magic (same as databases)
 
 
 STM versus HTM
@@ -152,6 +176,8 @@
 
 * each thread runs tasks in a `with atomic`
 
+* uses threads, but internally only
+
 
 Example 2
 ---------
@@ -172,15 +198,36 @@
 
 ::
 
-  def compute(train):
+  def compute_time(train):
      ...
+     train.start_time = ...
 
   def next_iteration(all_trains):
      for train in all_trains:
-        add_task(compute, train)
+        add_task(compute_time, train)
      run_all_tasks()
 
 
+Conflicts
+---------
+
+* like database transactions
+
+* but with `objects` instead of `records`
+
+* the transaction aborts and automatically retries
+
+
+Inevitable
+----------
+
+* means "unavoidable"
+
+* handles I/O in a `with atomic`
+
+* cannot abort the transaction any more
+
+
 By the way
 ----------
 
@@ -192,29 +239,110 @@
 Current status
 --------------
 
-* 
+* basics work, JIT compiler integration almost done
 
+* different executable called `pypy-stm`
+
+* slow-down: around 3x (in bad cases up to 10x)
+
+* speed-ups measured with 4 cores
+
+* Linux 64-bit only
 
 
 User feedback
 -------------
 
+* implemented:
+
 ::
 
-  Detected conflict:
-    File "foo.py", line 17, in walk
-      if node.left not in seen:
-  Transaction aborted, 0.000047 seconds lost
+    Detected conflict:
+      File "foo.py", line 17, in walk
+        if node.left not in seen:
+    Transaction aborted, 0.000047 seconds lost
 
 
 User feedback
 -------------
 
+* not implemented yet:
+
 ::
 
-  Forced inevitable:
-    File "foo.py", line 19, in walk
-      print >> log, logentry
-  Transaction blocked others for 0.xx seconds
+    Forced inevitable:
+      File "foo.py", line 19, in walk
+        print >> log, logentry
+    Transaction blocked others for 0.xx seconds
 
-(not implemented yet)
+
+Async libraries
+---------------
+
+* future work
+
+* tweak a Twisted reactor: run multithreaded,
+  but use `with atomic`
+
+* existing Twisted apps still work, but we need to
+  look at conflicts/inevitables
+
+* similar with Tornado, gevent, and so on
+
+
+Async libraries
+---------------
+
+::
+
+  while True:
+     events = epoll.poll()
+     for event in events:
+        queue.put(event)
+
+And in several threads::
+
+  while True:
+     event = queue.get()
+     with atomic:
+        handle(event)
+
+
+More future work
+----------------
+
+* look at many more examples
+
+* tweak data structures to avoid conflicts
+
+* reduce slow-down, port to other OS'es
+
+
+Under the cover
+---------------
+
+* 10'000-feet overview
+
+* every object can have multiple versions
+
+* the shared versions are immutable
+
+* the most recent version can belong to one thread
+
+* synchronization only when a thread "steals" another thread's most
+  recent version, to make it shared
+
+* integrated with a generational garbage collector, with one
+  nursery per thread
+
+
+Summary
+-------
+
+* transactions in Python
+
+* a big change under the cover
+
+* a small change for Python users
+
+* `Q & A`


More information about the pypy-commit mailing list