Legend of Java Concurrency/Parallelism
Upcoming SlideShare
Loading in...5
×
 

Legend of Java Concurrency/Parallelism

on

  • 273 views

2014 Sep 17 JJUG Night Seminar Material

2014 Sep 17 JJUG Night Seminar Material

Statistics

Views

Total Views
273
Views on SlideShare
265
Embed Views
8

Actions

Likes
1
Downloads
1
Comments
0

1 Embed 8

https://twitter.com 8

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Legend of Java Concurrency/Parallelism Legend of Java Concurrency/Parallelism Presentation Transcript

  • i Legend of Java Java in the Box Yuichi Sakuraba
  • K;4:‘ei%5.'= L#}£»'7 JaVa lCJ:7é F95§5l§'—J 7|] 7'53)? ‘ Java 851.6‘ iCtStream n‘ Ven kat Subramanuam 1-'~
  • ‘f_r 1.’. .. ‘ ‘if’. 2-'. ‘“. “:; 7 -1- ‘: ‘_: ‘," *-—'~ v-‘ -. ""1.. . ». .«. .._. -‘. :‘. ’'x' : ;—. >‘ _ V’ H J (_ / ~-r w-- . .~ . _» : L, ’-', ‘. ~ ~- — -~~* » . ~_ : ‘-; —~-: A”“*“": ."_. . ’: <_: :~r:3-‘I-‘; v . aIo. -.v, —p= -r. —J~'<. ..-": ... ..'. _.= :.‘ ’”. >,. __’. '.. ”a‘_‘. .-__. —. '_'i. ',. — ; ;;~, "_; ~—_*-~—-_—- -, -—. — 4-. 7.- . _—. . _, --; _. ‘_*; _“-; J. ‘: :: 2:; . ¢;. .._ Java 1 Thread/ Runnable synchronized volatile
  • ait notify! notify Thread join yeild
  • ‘ context wait
  • 7: : /; » _. t : .. -.‘“: .u -~‘-‘*-‘- -W“-= 4---xx-~ . ~-. ;., _,. _. .,, .-1.. :: ,,: .,. _~. : "-171. ~ 1- ‘ -K-' — " -‘I-i: ;-'1: - -1» : ’: :". - ’ 7*‘-: -‘ ~"~: f*- “-1 -_, —3_ ‘, _—"—; —A J. -. ‘. ,-. ;,-. . 7;: -". ";: :!‘_; ;_-, -‘51;’; -:55-7-; .—_r -, -» ; :_; 1 __~ - r, - it 5:. * —»: -. .~, ~-: ;;_— _ 3‘ _~__« —- : . 7,1, __ , ~: .: *‘ :1 :2; ~-, ~: “: ‘—; -~-'_—v-'7.. .‘ ’ A. ’¢1.““‘. ;;‘Z»“_: ’.:9‘_’: <_: "Y: °‘I‘-‘_~ . a.»o. -.3—p3-r——J~'<. _.-». _.. .'. ;.: :.‘ *; z.__’. '.3;. ‘-__. .': :. ’.‘: ;: ;~_“_; ~—_"*—-_- -4-— 4-. —. - . '_—. ., J, --; _4 ‘#1 :2 4.. ‘Ex; 2:. " 199 T Java 1.1 Anonymous Class new Thread(new Runnab1e() { public void run() { doSomething(); } }). start();
  • 2002 T J2SE1.4 Mostly Concurrent Mark & Sweep GC
  • 2004 T J2SE5 Concurrency Utilities
  • Async Execution Executor/ ExecutorService Runnable/ Callable Future
  • Callable<Foo> task = new Callable<Foo>() {. ¢.}; Executorservice service = Executors. newFixedThreadPool(4); Future<Foo> future = service. submit(task); Foo result futuretget();
  • Synchronizer ReentrantLock Semaphore CountDown Latch
  • Threadsafe Collection B| ockingQueue ConcurrentHashMap CopyOnWriteArrayList et al.
  • B} <; x czlgii J); J <f 2 st. + gr l. l fiffififc-. .uk; -,» r___y
  • Atomic Operation volatile U Atomiclnteger AtomicReference et al.
  • Rough-Grained Task ‘ll/ lulti-Core £ra Fine-Grained Task
  • Fork/ Join Framework Divide & Conquer Work Stealing Java 7 j 2014
  • Sum IIEEIIEEE HEB HE E
  • Project Lambda Para| le| Stream Spliterator Java 8 j 2015
  • Sum long sum = LongStream. range(@, 1@@_@@@_@00) . parallel() . reduce(@L, (Xay)-> X+y)3
  • Conclusion Basic: Thread Model Rough Grained: Conc. Utils. Fine Grained: Para| |elStream
  • Legend of ) Java Concurrency ‘Parallelwm _ Java in the Box Yuichi Sakuraba a