Author: Armin Rigo <[email protected]>
Branch: extradoc
Changeset: r5194:8fbca1504d5a
Date: 2014-04-08 18:05 +0200
http://bitbucket.org/pypy/extradoc/changeset/8fbca1504d5a/

Log:    Add what we get from "download as text" from google docs: not good
        at all, but better than nothing

diff --git a/talk/wtm2014/WTM_Talk.txt b/talk/wtm2014/WTM_Talk.txt
new file mode 100644
--- /dev/null
+++ b/talk/wtm2014/WTM_Talk.txt
@@ -0,0 +1,206 @@
+STMGC-C7       
+
+Fast Software Transactional Memory for Dynamic Languages
+Remi Meier
+
+Department of Computer Science
+ETH Z&#252;rich
+Armin Rigo
+
+www.pypy.org
+
+Current Situation
+Dynamic languages popular
+(Python, Ruby, PHP, JavaScript)
+Parallelization is a problem: GIL
+Atomicity & isolation for bytecode instructions
+
+&#8594; Transactional Memory
+Concurrency, but no parallelism
+
+Background: Current TM systems
+TM implemented in hardware: HTM
+(e.g. Intel Haswell CPU)
+Limited size of transactions
+Not so flexible (e.g. less runtime feedback)
+Fast
+TM implemented in software: STM
+No limits
+Much more flexible
+A lot of overhead (2-10x) &#8592; we want to change that
+
+Background: STM Overhead
+Major source of STM overhead in barriers
+All over the place
+Isolation (Copy-On-Write, Locking, &#8230;)
+Validation
+Reference resolution (for COW)
+
+
+
+
+O = read(O)
+return O
+return find_right_version(O)
+right version
+slowpath
+
+Our Goal
+We don&#8217;t want to resolve references:
+no &#8220;right version&#8221; check
+no find_right_version()
+We want
+Copy-on-write (easy & efficient)
+An object has always only one unique reference
+Threads automatically see their version of an obj
+Not to lose the flexibility of STM
+Big part of the STM overhead
+
+C7: Implementation
+How can two copies of an object share the same reference?
+
+Or
+
+How can one reference point to two different locations in memory if used in 
different 
+threads?
+
+C7: Segmentation
+Partition virtual memory into segments
+1 segment per thread
+Each segment is a copy    &#8594; same contents in all segments
+All copies of an object are at the same segment offset (SO) in each segment
+Segment 0
+Segment 1
+Virtual Memory Pages
+SO
+SO
+
+C7: Memory segmentation
+Use SO as object reference
+Need to translate to linear address (LA):    LA = segment address + SO
+Hardware supported &#8658; fast!
+%gs holds a thread&#8217;s segment address
+%gs::SO translated to different LAs by CPU
+SO
+SO
+%gs for a thread
+%gs for another thread
+LA: %gs::SO
+LA: %gs::SO
+LA: NULL
+
+C7: Segment Offset
+One SO &#8594; multiple LAs
+Extremely inefficient:
+N-times the memory
+1 allocation &#8658; N allocations
+1 write &#8658; N writes
+SO
+SO
+%gs for a thread
+%gs for another thread
+LA: %gs::SO
+LA: %gs::SO
+LA: NULL
+&#10003;
+How to share memory?
+
+C7: Page Sharing
+Partition virtual memory into segments: each segment is backed by different 
memory
+a
+b
+c
+d
+e
+f
+a&#8217;
+b&#8217;
+c&#8217;
+d&#8217;
+e&#8217;
+f&#8217;
+Segment 0
+Segment 1
+Virtual Memory Pages
+Virtual File Pages
+1:1 mapping
+
+C7: Page Sharing
+Remap segment 1: Both segments share the same memory
+
+
+a
+b
+c
+d
+e
+f
+Segment 0
+Segment 1
+Virtual Memory Pages
+Virtual File Pages
+N:1 mapping
+
+C7: Page Sharing
+We can unshare / privatize pages
+a
+b
+c
+d
+e
+f
+c&#8217;
+Segment 0
+Segment 1
+Virtual Memory Pages
+Virtual File Pages
+copy&#8230;
+mixed mapping
+
+C7: Copy-On-Write
+2-step address translation:
+%gs + SO &#8594; LA
+LA &#8594; memory location
+Memory location can be shared or private
+Initially fully shared memory
+Copy-on-write &#8658; switch to private memory:each thread has a private copy
+
+SO never changes
+
+C7: Barriers
+SO always translates to the right version&#8594; no &#8220;right 
version&#8221; check&#8594; no find_right_version()
+COW check for writing to non-local object
+
+
+C7: Summary
+Very cheap barriers
+Hardware accelerated address translation
+Page-level COW
+Object-level conflict detection
+
+Limitations
+Huge address space needed (64bit)
+configurable static max. amount of memory
+Optimized for low #segments
+
+Evaluation
+PyPy Python interpreter
+GIL version vs. STM version
+Overhead compared to sequential execution
+System:
+Intel Core i7-4770, 3.4GHz, 4 cores & HT
+16 GB RAM
+
+Evaluation
+Some benchmarks (Richards, Raytrace, &#8230;?)
+scaling to 4 cores
+GIL vs. STM
+
+Evaluation: Overhead
+Overhead-Breakdown
+
+Summary
+Optimized for low #CPUs
+Optimized for dynamic language VMs
+Overhead < 50%
+Still STM, not HTM &#8594; flexibility
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to