Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Quasar: Actor Model and Light Weight Threads on Java

3,778 views

Published on

Published in: Technology
  • Dating direct: ♥♥♥ http://bit.ly/2F4cEJi ♥♥♥
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • Follow the link, new dating source: ♥♥♥ http://bit.ly/2F4cEJi ♥♥♥
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • accessibility Books Library allowing access to top content, including thousands of title from favorite author, plus the ability to read or download a huge selection of books for your pc or smartphone within minutes.........ACCESS WEBSITE Over for All Ebooks ..... (Unlimited) ......................................................................................................................... Download FULL PDF EBOOK here { http://bit.ly/2m6jJ5M } .........................................................................................................................
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • If you want to download or read this book, Copy link or url below in the New tab ......................................................................................................................... DOWNLOAD FULL PDF EBOOK here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download EPUB Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download Doc Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... .........................................................................................................................
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • DOWNLOAD THI5 BOOKS 1NTO AVAILABLE FORMAT (Unlimited) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { http://bit.ly/2m77EgH } ......................................................................................................................... Download Full EPUB Ebook here { http://bit.ly/2m77EgH } ......................................................................................................................... ACCESS WEBSITE for All Ebooks ......................................................................................................................... Download Full PDF EBOOK here { http://bit.ly/2m77EgH } ......................................................................................................................... Download EPUB Ebook here { http://bit.ly/2m77EgH } ......................................................................................................................... Download doc Ebook here { http://bit.ly/2m77EgH } ......................................................................................................................... ......................................................................................................................... ......................................................................................................................... .............. Browse by Genre Available eBooks ......................................................................................................................... Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult,
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here

Quasar: Actor Model and Light Weight Threads on Java

  1. 1. Quasar: Java のアクター/軽量スレッド 宮川 拓 / @miyakawa_taku 2014-08-22 JJUG LT大会
  2. 2. 自己紹介 •宮川拓です •Kink という JVM 言語を作ってます –https://bitbucket.org/kink/kink •大相撲秋場所に向けて準備中です 1
  3. 3. Quasar? •Erlang 的なアクターモデルを実現する Java ライブラリ 2
  4. 4. アクターモデル •アクター(スレッド的なもの)同士がメッセージ を互いに投げ合って協調動作する計算モデル •オブジェクトを作る感覚でアクターを作る •つまり湯水のごとくスレッドを作る 3
  5. 5. Scala のアクターと何が違うの? •Scala のアクター –ネイティブスレッドで実現されている •Quasar のアクター –軽量スレッドで実現されている 4
  6. 6. 軽量スレッド? •軽量スレッド ::= –ユーザランド(カーネル外)で実現するスレッド –Go の goroutine, Erlang の「プロセス」など –Quasar では「Fiber」と呼ぶ •利点 –100万とか1,000万とかの数が作れる –ブロックが多発する状況では性能で有利 5
  7. 7. 実現方法 •バイトコード操作でコンテキストスイッチ用の コードを仕込む –クラスロード時(-javaagent) or コンパイル時 6
  8. 8. 実行時の動作 1.実行している命令の位置 2.ローカル変数のセット を自前のスタックに保存しながら実行する (ようにバイトコードを改変する) 7 class SenderFiber extends Fiber { public Void run() throws ... { int num = 42; channel.send(num); num = 24; channel.send(num); bye(); } } data=24
  9. 9. 制御が離れる時の動作 •ブロック/yieldするメソッドが SuspendExecution例外を投げる •呼び出し元がキャッチして他の軽量スレッドに 制御を渡す 8 class SenderFiber extends Fiber { public Void run() throws ... { int num = 42; channel.send(num); num = 24; channel.send(num); bye(); } } SuspendExecution
  10. 10. 制御が戻ってくる時の動作 •もう一度同じメソッドを呼び出す •メソッドの先頭で自前スタックから実行位置と ローカル変数を回復 •switch & ジャンプ 9 class SenderFiber extends Fiber { public Void run() throws ... { int num = 42; channel.send(num); num = 24; channel.send(num); bye(); } } ローカル変数回復 switch & ジャンプ

×