which problems does a multi-language virtual machine need to solve in the multicore/manycore era?
DESCRIPTION
While parallel programming for very regular problems has been used in the scientific community by non-computer-scientists successfully for a few decades now, concurrent programming and solving irregular problems remains hard. Furthermore, we shift from few expert system programmers mastering concurrency for a constrained set of problems to mainstream application developers being required to master concurrency for a wide variety of problems.Consequently, high-level language virtual machine (VM) research faces interesting questions. What are processor design changes that have an impact on the abstractions provided by VMs to provide platform independence? How can application programmers’ diverse needs be facilitated to solve concurrent programming problems?We argue that VMs will need to be ready for a wide range of different concurrency models that allow solving concurrency problems with appropriate abstractions. Furthermore, they need to abstract from heterogeneous processor architectures, varying performance characteristics, need to account for memory access cost and inter-core communication mechanisms but should only expose the minimal useful set of notions like locality, explicit communication, and adaptable scheduling to maintain their abstracting nature.Eventually, language designers need to be enabled to guarantee properties like encapsulation, scheduling guarantees, and immutability also when an interaction between different problem-specific concurrency abstractions is required.TRANSCRIPT
Which Problems Does a
Mul$-‐Language Virtual Machine
Need to Solve in the
Mul$core/Manycore Era?
Stefan Marr Ma8as De Wael, Michael Haupt, Theo D’Hondt
VMIL Workshop 2011 2011-‐10-‐24
VMs today
25/10/11 2
Performance Memory Management
F#
MulJ-‐Language Eco System PlaLorm Independent
What do we need in the MulJcore/Manycore Era?
25/10/11 3
Two Dimensions
25/10/11 4
Processor Design Concurrency Models
Actors
STM
DataFlow
Fork/Join
Processors and Concurrency Models
25/10/11 5
!"#$%!&'()*
!&'()*
!&'()*
!&'()*
!&'()*
+&,%-()&../")&0%'&'()*
!"$*%-()&.1")#(2.%0#33&)&$4%0&.#5$.
6$4&)78()&%9&4,():
!"#$%!&'()*
VM?
WHAT ARE THE RELEVANT CHANGES AT THE HARDWARE-‐LEVEL?
25/10/11 6
Brawny vs. Wimpy
• High sequenJal performance
• Few in numbers
• Weak sequenJal performance
• High in numbers
25/10/11 7
And everything in-‐between!
25/10/11 8
Wimpy Brawny
IBM Power7
Intel i7 Cell B.E. Nvidia Fermi
AMD Fusion
Intel MIC
Hybrid
Cores vs. Threads vs. Shared PUs
25/10/11 9
Source: AMD
Memory and CommunicaJon
Nehalem Cache Hierarchy Four Processor Setup
25/10/11 10
Source: Intel CommunicaJon implicit via memory
Memory and CommunicaJon
25/10/11 11
TILEPro64 Source: Tilera
What do VMs need to account for?
• Appropriate uJlizaJon – Varying performance of cores/units?
– Caches and simultaneous mul,threading?
• Non-‐uniform memory and communicaJon
– Cache hierarchies?
– Explicit inter-‐core communicaJon?
25/10/11 12
WHAT ARE TYPICAL IMPLEMENTATION PROBLEMS OF CONCURRENCY MODELS?
25/10/11 13
Actors
STM
DataFlow
Fork/Join
EncapsulaJon
actor BreakEncapsulation: def main_loop(self): receive: (Message) => Message.msg = "broken" # main msg = Message("Hello World!") broken ! (msg) # wait print msg.msg
25/10/11 14
IMPORTANT: Messages can be any kind of object but have to be immutable. Scala can’t enforce immutability (yet) so this has to be by convenJon. JCSP: obj-‐by-‐ref, no warning Kilim: zero-‐copy type system not “reflecJon-‐proof” Clojure: STM + pure Java Agents + pure Java Swing UI: “The single-‐ thread rule”
Scheduling Guarantees
25/10/11 15
Fork/Join Actors PrioriJzed Tasks
work-‐stealing fair scheduling priority-‐based scheduling
Immutability
25/10/11 16
Source: Star Wars Episode V: The Empire Strikes Back.
Crossing Borders and Language-‐Levels
25/10/11 17
ImplementaJon/Meta-‐Level Language/ApplicaJon-‐Level
jThread.sortedSet = FarRefWrapper(sortSet) jThread.sortedSet .add(FarRefWrapper(e)) // add(fr_e) (wrapper semantics) fr_e.compareTo(obj) { return send_wait(e, compareTo, obj) }
a e
add(e)
e.compareTo(*)
sortedSet
What do VMs need to account for?
• Enforcing language semanJcs?
• Flexible concurrent encapsulaJon?
– What is the relaJon to immutability?
• Enforceable scheduling guarantees?
• Normal vs. reflecJve operaJons?
25/10/11 18
What do VMs need to account for?
25/10/11 19
Processor Design Concurrency Models
Actors
STM
DataFlow
Fork/Join
What do VMs need to account for?
Processor Design
• Appropriate uJlizaJon – Varying performance?
– Hyperthreads?
• Non-‐uniform memory and communicaJon – Cache hierarchies? – Explicit inter-‐core
communicaJon?
Concurrency Models
• Flexible concurrent encapsulaJon? – Flexible Immutability?
• Enforceable scheduling guarantees?
• Normal vs. reflecJve operaJons?
25/10/11 20