Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
カーネルVM@北陸 1発表資料 - CRuby on OSv
Search
orumin
July 12, 2014
380
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
カーネルVM@北陸 1発表資料 - CRuby on OSv
カーネルVM@北陸 1(
http://connpass.com/event/5840/)の発表資料
orumin
July 12, 2014
More Decks by orumin
See All by orumin
あのころの iPod を どうにか再生させたい
orumin
2
2.9k
ヴィンテージマシンと付き合う - kernel/vm online 5
orumin
0
1.2k
むかしの RISC、むかしの Unix
orumin
7
3.8k
Fundamental of architecture to implementing OS on AArch64
orumin
3
5.5k
Kernel/VM Kansai #9
orumin
0
1k
Kernel/VM #14 発表資料
orumin
1
640
Unikernels report
orumin
2
530
第13回Kernel/VM勉強会発表資料
orumin
1
1.7k
第12回カーネル/VM探検隊
orumin
0
400
Featured
See All Featured
Sam Torres - BigQuery for SEOs
techseoconnect
PRO
0
290
Documentation Writing (for coders)
carmenintech
77
5.4k
Introduction to Domain-Driven Design and Collaborative software design
baasie
1
860
The Organizational Zoo: Understanding Human Behavior Agility Through Metaphoric Constructive Conversations (based on the works of Arthur Shelley, Ph.D)
kimpetersen
PRO
0
370
Beyond borders and beyond the search box: How to win the global "messy middle" with AI-driven SEO
davidcarrasco
3
170
How Software Deployment tools have changed in the past 20 years
geshan
0
34k
Speed Design
sergeychernyshev
33
1.9k
brightonSEO & MeasureFest 2025 - Christian Goodrich - Winning strategies for Black Friday CRO & PPC
cargoodrich
3
740
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
55
3.4k
Facilitating Awesome Meetings
lara
57
7k
4 Signs Your Business is Dying
shpigford
187
22k
From Legacy to Launchpad: Building Startup-Ready Communities
dugsong
0
240
Transcript
. . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Introduction OSᵛ CRuby on OSᵛ さいごに CRuby on OSᵛ orumin Jul 12th, 2014 orumin CRuby on OSᵛ
. . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Introduction OSᵛ CRuby on OSᵛ さいごに 1 Introduction 2 OSᵛ 3 CRuby on OSᵛ 4 さいごに orumin CRuby on OSᵛ
. . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Introduction OSᵛ CRuby on OSᵛ さいごに Introduction orumin CRuby on OSᵛ
. . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Introduction OSᵛ CRuby on OSᵛ さいごに Who are you? orumin 学生(今年から大阪,大破ではない) seccamp 2012 GSoC 2014 student orumin CRuby on OSᵛ
. . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Introduction OSᵛ CRuby on OSᵛ さいごに Who are you? orumin 学生(今年から大阪,大破ではない) seccamp 2012 GSoC 2014 student orumin CRuby on OSᵛ
. . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Introduction OSᵛ CRuby on OSᵛ さいごに GSoCでOSᵛにCRubyを移植! OSᵛとは? 何をやったのか? orumin CRuby on OSᵛ
. . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Introduction OSᵛ CRuby on OSᵛ さいごに OSᵛ orumin CRuby on OSᵛ
. . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Introduction OSᵛ CRuby on OSᵛ さいごに What’s OSᵛ Cloudius Systems イスラエルベンチャー KVMのQumranetのコアメンバーが開発 ハイパーバイザやIaaS(EC2,GCE etc)で動作 フルサイズのOSではなく“library OS” 1 app on 1 VM ログインしてから手動のコンフィグ不要,REST APIで制御 orumin CRuby on OSᵛ
. . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Introduction OSᵛ CRuby on OSᵛ さいごに What’s OSᵛ BSDL ハイパーバイザー上で動作することを前提 単一のメモリ空間で,単一のプロセス,マルチスレッド動作 OpenJDKが移植してあり,任意のJavaアプリケーションが動作 FedoraのJVMバイナリそのまま持ってきてる ネットワークスタックとZFSをFreeBSDから移植 orumin CRuby on OSᵛ
. . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Introduction OSᵛ CRuby on OSᵛ さいごに What’s OSᵛ コンテナ仮想化より高効率 現在のクラウドは既にハイパーバイザーが用意されている その上で汎用のOSが動いて,コンテナが動いて,アプリが…… orumin CRuby on OSᵛ
. . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Introduction OSᵛ CRuby on OSᵛ さいごに What’s OSᵛ コンテナ仮想化より高効率 二度手間 複数インスタンス立ててスケールさせるほうが効率高 library OSであり,1 app per 1 VMであることが生きる orumin CRuby on OSᵛ
. . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Introduction OSᵛ CRuby on OSᵛ さいごに What’s OSᵛ (image from @syuu1228’s blog) orumin CRuby on OSᵛ
. . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Introduction OSᵛ CRuby on OSᵛ さいごに What’s OSᵛ libcがある! (musl-libc, BSDL) CFLAGS=-fPIC -shared main()がある*.soなら動く Linuxエミュレーション,たとえばunameはLinuxを返す Linuxのアプリケーションを低コストで移植可能(?) orumin CRuby on OSᵛ
. . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Introduction OSᵛ CRuby on OSᵛ さいごに What’s OSᵛ CRuby OSv kernel FBSD code ZFS TCP/ IP COM port virtio- blk virtio- net clock ACPI sched uler ramfs VFS MM libc ELF loader syscall emu libruby.so ruby.so Ruby app オリジナル実装(C++11) ポーティング バイナリ 非ネイティブコード orumin CRuby on OSᵛ
. . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Introduction OSᵛ CRuby on OSᵛ さいごに Porting native application http://github.com/cloudius-systems/osv/wiki/ Porting-native-applications-to-OSv orumin CRuby on OSᵛ
. . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Introduction OSᵛ CRuby on OSᵛ さいごに Porting native application 先述通り,libcのPOSIX APIがありLinuxエミュレーションをしているの でほぼそのまま動作 makeのときshared binaryを吐くように調節してやれば良い 巨大なアプリケーションだとちょっと辛いかもしれない…… orumin CRuby on OSᵛ
. . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Introduction OSᵛ CRuby on OSᵛ さいごに Porting native application もう一つ,OSᵛのイメージの,ファイルレイアウトを書く必要アリ usr.manifest orumin CRuby on OSᵛ
. . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Introduction OSᵛ CRuby on OSᵛ さいごに Porting native application Figure 1: usr.manifest orumin CRuby on OSᵛ
. . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Introduction OSᵛ CRuby on OSᵛ さいごに Porting native application じゃあこれで誰でもすぐ移植できますね? orumin CRuby on OSᵛ
. . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Introduction OSᵛ CRuby on OSᵛ さいごに Porting native application アッハイ orumin CRuby on OSᵛ
. . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Introduction OSᵛ CRuby on OSᵛ さいごに CRuby on OSᵛ orumin CRuby on OSᵛ
. . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Introduction OSᵛ CRuby on OSᵛ さいごに いしょくのげんじつ 存在しない数多のAPI そもそも内部的には単一アドレス空間 直接メソッド呼んだりするので,POSIXに合わせたAPIがないこと多数 仕様上存在しない(できない?)fork(2)やexec(2) これの扱いをどうすべきか何度も議論されている 複数立ち上げるVMのELFの名前空間を共有? orumin CRuby on OSᵛ
. . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Introduction OSᵛ CRuby on OSᵛ さいごに いしょくのげんじつ _人人人人人人人人人人人人人_ > 多くのwork arround必至 <  ̄^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^ ̄ orumin CRuby on OSᵛ
. . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Introduction OSᵛ CRuby on OSᵛ さいごに missing symbol Failed looking up symbol __register_atfork [backtrace] 0x31a7f3 <elf::object::resolve_pltgot(unsigned int)+83> 0x35fbb3 <__elf_resolve_pltgot+47> 0x31c8e5 <elf::program::get_library(std::string, std::vector<std::string, std::allocator +1317> 0x3b7734 <osv::run(std::string, int, char**, int*)+132> 0x3b7b80 <osv::run(std::string, std::vector<std::string, std::allocator<std::string> >, i +576> 0x20d366 <run_main(std::vector<std::string, std::allocator<std::string> > const&) +246> 0x20ef10 <do_main_thread(void*)+1024> 0x3fd6a6 <sync+70> 0x3a246b <thread_main_c+27>orumin CRuby on OSᵛ
. . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Introduction OSᵛ CRuby on OSᵛ さいごに missing symbol 大概こうなる みたことのないlibc APIをいっぱい知ることできるよ! orumin CRuby on OSᵛ
. . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Introduction OSᵛ CRuby on OSᵛ さいごに missing symbol 解決策 関数を呼び出すだけのAPI実装 存在しないシステムコールは,OSᵛが内部的に持っててlibcにないだけの ことも musl-libcから移植 OSᵛの持つクラスにパブリックメソッドを追加 メモリ管理やptreadあたりはC++11で実装されている stubをつくる どうしようもないときの対処 orumin CRuby on OSᵛ
. . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Introduction OSᵛ CRuby on OSᵛ さいごに missing symbol libcとの格闘がGSoCで大部分占めてます orumin CRuby on OSᵛ
. . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Introduction OSᵛ CRuby on OSᵛ さいごに おとしぁな libc以外のOSᵛ固有の問題でハマる Alphaだけあってそもそもの実装バグを踏む Rubyやbundlerの振舞いでもハマる rquire ’bundler/setup’するとシステムコマンド叩くのかexec(2)で落ちる Windowsはfork(2)とか持ってないはずだから回避方法はあるはず……? 現在進行形でもハマってる EC2,GCEでRubyなサーバー走らせようとしたらOpenSSLのseedに失敗 RDRAND,virtio-rngがない? (ローカルでは問題ないのに……) orumin CRuby on OSᵛ
. . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Introduction OSᵛ CRuby on OSᵛ さいごに おとしぁな ローカルだとgdbでアタッチできる https://github.com/cloudius-systems/osv/wiki/Debugging-OSv IaaSのリモート上だと……? orumin CRuby on OSᵛ
. . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Introduction OSᵛ CRuby on OSᵛ さいごに おとしぁな ローカルだとgdbでアタッチできる https://github.com/cloudius-systems/osv/wiki/Debugging-OSv IaaSのリモート上だと……? 色々REST APIが増えてるらしい(でもドキュメント……) orumin CRuby on OSᵛ
. . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Introduction OSᵛ CRuby on OSᵛ さいごに おとしぁな Figure 2: world_is_mine orumin CRuby on OSᵛ
. . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Introduction OSᵛ CRuby on OSᵛ さいごに おとしぁな ローカルで動作するならIaaSにデプロイ するだけで動く orumin CRuby on OSᵛ
. . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Introduction OSᵛ CRuby on OSᵛ さいごに おとしぁな orumin CRuby on OSᵛ
. . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Introduction OSᵛ CRuby on OSᵛ さいごに デモ デモあります! orumin CRuby on OSᵛ
. . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Introduction OSᵛ CRuby on OSᵛ さいごに デモ http://osv.orum.in/ orumin CRuby on OSᵛ
. . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Introduction OSᵛ CRuby on OSᵛ さいごに さいごに orumin CRuby on OSᵛ
. . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Introduction OSᵛ CRuby on OSᵛ さいごに さいごに http://github.com/cloudius-systems/osv/wiki/Latest-EC2-AMI-list orumin CRuby on OSᵛ
. . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Introduction OSᵛ CRuby on OSᵛ さいごに さいごに Amazon EC2用のAMIが公開されています! おそらくt2.microでも動作 EC2アカウントお持ちの方は試してみよう! orumin CRuby on OSᵛ
. . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Introduction OSᵛ CRuby on OSᵛ さいごに さいごに そのうちPublifyのAMIとかも公開できるかも…… orumin CRuby on OSᵛ
. . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Introduction OSᵛ CRuby on OSᵛ さいごに 宣伝 Kernel/VM探検隊ブログやりませんか orumin CRuby on OSᵛ
. . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Introduction OSᵛ CRuby on OSᵛ さいごに 宣伝 Kernel/VM探検隊ブログやりませんか 発表補足 低レイヤ連載 美味しいお店紹介とかでもOK? orumin CRuby on OSᵛ
. . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Introduction OSᵛ CRuby on OSᵛ さいごに 宣伝 ブログシステムのバックエンドにOSᵛ,使えたらいいな orumin CRuby on OSᵛ
. . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Introduction OSᵛ CRuby on OSᵛ さいごに 宣伝 興味ある人は@kotatsu_miとかに連絡下さい orumin CRuby on OSᵛ