近未来的並列 LL2. @mootoh
5
: = 7:3
http://deadbeaf.org
6. mootoh
wraith13
goyoki
STM hayamiz
HPU MUDA syoyo
Lock-free yamasa
Haskell shelarcy
???
12. (^o^)
(^o^)
(^o^)
(^o^)
(^o^)
(^o^)
(^o^)
CC by-nc-sa : http://www.flickr.com/photos/carrapatoso/3467673411/
13. “The Free Lunch is Over”, by Herb Sutter
http://www.gotw.ca/publications/concurrency-ddj.htm
14. “The Free Lunch is Over”, by Herb Sutter
http://www.gotw.ca/publications/concurrency-ddj.htm
15. •
• CPU
• ( )
• (^o^)
•
18. CC by-nc : http://www.flickr.com/photos/b-tal/407402521/
20. • : Eclipse.app
• on iMac Core 2 Duo 3GHz 4GB RAM
• : 33s, 2 : 7s
21. • : Eclipse.app
• on iMac Core 2 Duo 3GHz 4GB RAM
• : 33s, 2 : 7s
22. • : Eclipse.app
• on iMac Core 2 Duo 3GHz 4GB RAM
• : 33s, 2 : 7s
(628,702 * 33s * 365 ) / (60 * 60 * 24 * 30)
=> 2,921 /
31. • Native thread
• 5.6 ithread
• thread VM
• default shared nothing
• 6.0 STM
•
• POE, AnyEvent, Coro, ...
32. • Native & green thread ( )
• ruby1.8: green
• ruby1.9: native, GIL
• JRuby, MacRuby: native, GIL o/
•
• Revactor, EventMachine, NeverBlock, ...
33. • Thread
• CPython: GVL
• Jython, IronPython :
• Jython: system 216% cpu 12.285 total
35. Haskell
• Haskell
•
• Parallel Haskell
• Concurrent Haskell
• STM
• Native thread?
38. • goroutine
• Native thread
• runtime.GOMAXPROCS(NCPU)
• Channel
•
40. Perl Ruby Python PHP Haskell Erlang Scala go Javascript
Native
thread × ? ?
Thread,
Thread, Thread, STM
Model, Message Message Message
Thread Process
Paradigm Passing Message Passing Passing
STM Fiber
Passing
shared-
nothing
Web
goroutine
Workers
by
default
49. •
• :)
http://images.apple.com/macosx/technology/docs/
GrandCentral_TB_brief_20090903.pdf
• :( ...?
• :
• Grand Central Dispatch → Mac http://en.wikipedia.org/wiki/File:Gcd_icon20090608.jpg
• Java 7 → JVM
• OpenCL http://www.khronos.org/opencl/
50. •
•
• Out of Order
• Future
•
•
• : value resolved
: value not resolved yet
: executable Atom
: pending Atom
52. DSL C
Mol Atom
Runtime
53. Mol
•
•
• Atom ( )
•C
main() {
frame(frame_no, input) {
local loop;
local edge[-1..9] outside(0);
Haskell local pocs[-1..9] outside(0);
local ccr [-1..9] outside(0);
DSL loop = loop_count();
edge[i] := edge_atom(input, i);
ccr [i] := ccr_atom(edge[i-1], edge[i], edge[i+1], i);
pocs[i] := i % 2 == 0
? pocs_even_atom(ccr [i-1], ccr[i], ccr [i+1], loop, i)
: pocs_odd_atom (pocs[i-1], ccr[i], pocs[i+1], loop, i);
return &pocs;
}
sync for (i in [0..30])
put_frame_atom(frame(i, get_frame_atom()));
}
54. Runtime
Atom Waiting
arguments, waiting for runtime lock
return value Shared
•
Memory
VM update runtime context
Global
Lock
Runtime
Context
•
Runtime Atom
Mol Atom Wait
55. Runtime
Atom Waiting
arguments, waiting for runtime lock
return value Shared
•
Memory
VM update runtime context
Global
Lock
Runtime
Context
•
Runtime Atom
Mol Atom Wait
62. FAQ
• ?
http://www.speedia.co.jp/~namisato/2008_05.html
63. FAQ
• ?
http://www.speedia.co.jp/~namisato/2008_05.html
P = f V^2
1MHz 1000 → 1GHz !
64. Memory
Wall
CC-by : http://www.flickr.com/photos/afagen/4145629623/
65. Memory Wall
•
•
•
• 100
• by “Can Manycores Support the Memory Requirements of Scientific Applications?” /
A4MMC 2010
66. Memory Wall
• →
• : Intel SCC
•
• HW
http://techresearch.intel.com/articles/Tera-Scale/1826.htm
67. • Actor
• Erlang, Scala, go, Javascript (HTML5, WebWorkers)
• LL
CC-by : http://www.flickr.com/photos/punkscrapper/4276443469/
69. ↓
!
http://dragon-quest.jp/five/monster/11kingusuraimu.html
70. ↓
!
http://dragon-quest.jp/five/monster/11kingusuraimu.html
76. Timeline
Message passing
JVM
2010 2015 2020
78. LL
P
• OK (Portable)
•
• (Performance)
• (Productivity)
• OK
80. LL
• OK (Portable)
•
• (Performance)
• (Productivity)
• OK
81. LL ?
• Light
•
•
• DSL
82. : DSL
• LL
• : C, Ruby, Perl, PHP, ...
• Communicating Sequential Process
• LL
•
• Glue LL, LL
83. ?
•
•
• ( )
•
• 40%
(by Harvard Business Review
http://blogs.hbr.org/bregman/2010/05/how-and-why-to-stop-multitaski.html )
94. 2.
“
”
http://blogs.itmedia.co.jp/yasusasaki/2010/07/ipad-ab70.html