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
Unikernelで始める自作OS/OS Development with Unikernel
Search
Akira Moroo
October 06, 2019
Technology
690
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Unikernelで始める自作OS/OS Development with Unikernel
Unikernelの設計/実装を使って自作OSができるのではないかという話です.
Akira Moroo
October 06, 2019
More Decks by Akira Moroo
See All by Akira Moroo
svc-hook: hooking system calls on ARM64 by binary rewriting
retrage
2
410
Exploring x86 MSR Space
retrage
0
1.5k
LLMでバイナリ解析支援
retrage
0
240
GitHub ActionsでDevSecOpsごっこ
retrage
0
120
Practical Rust (Hypervisor) Firmware
retrage
3
1.9k
Bypassing UEFI Secure Boot with Thin-Hypervisor
retrage
0
1.3k
Porting Linux to Nabla Containers
retrage
0
1.3k
Network Boot from Bell Labs
retrage
2
1.8k
LLVM Backend Development for EFI Byte Code
retrage
2
1.1k
Other Decks in Technology
See All in Technology
PLaMo 3.0 Primeの構造化出力サポート
pfn
PRO
0
130
1台から試せる!Edge IoTを使った位置情報の活用設計【SORACOM Discovery 2026】
soracom
PRO
0
110
運用を犠牲にせずコストを制御し事業成長を支える B2B SaaS ID管理基盤におけるS3 Tableのログストレージ活用
kaminashi
1
110
オートマトンと字句解析でRoslynを読む
tomokusaba
0
130
NYC Summit 2026 におけるAmazon Bedrock AgentCore のアップデート
ren8k
3
280
事業成長とAI活用を止めないデータ基盤アーキテクチャの設計思想
hiracky16
0
780
新しい SLO が良い感じにハマっている話
z63d
1
340
AI Agent を本番環境へ―― Microsoft Foundry × Azure Serverless で作る Enterprise-Ready な基盤
shibayan
PRO
1
880
システム監視を 「システムを監視するだけ」で 終わらせないために
seiud
0
150
reFACToring
moznion
1
980
それでも、技術なブログを書く理由 #kichijojipm / Why I Still Write Tech Blogs Even Now
shinkufencer
0
1.4k
AIで楽になるはずが、なぜ疲れる?
kinopeee
0
150
Featured
See All Featured
The SEO identity crisis: Don't let AI make you average
varn
0
520
Darren the Foodie - Storyboard
khoart
PRO
3
3.5k
Pawsitive SEO: Lessons from My Dog (and Many Mistakes) on Thriving as a Consultant in the Age of AI
davidcarrasco
0
200
Skip the Path - Find Your Career Trail
mkilby
1
170
Designing for Performance
lara
611
70k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
47
8.2k
Building Experiences: Design Systems, User Experience, and Full Site Editing
marktimemedia
0
560
Leveraging Curiosity to Care for An Aging Population
cassininazir
1
440
A Soul's Torment
seathinner
6
3.1k
Accessibility Awareness
sabderemane
1
170
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
34
2.8k
Google's AI Overviews - The New Search
badams
0
1.1k
Transcript
Unikernelで 始める⾃作OS October 6, 2019 第17回 ⾃作OSもくもく会 @retrage
Q: なぜOS⾃作? 1
A: 楽しいから 2
A: 学習のため • こういう⼈もいるはず • コンピュータアーキテクチャやOSを知る • 書籍や資料を読んだり • 既存OSの実装を読んだり
• 実際に⼿を動かしてみることで理解が深まる 3
学習のためのOS⾃作 • 1. ゼロから全部実装 • 全てを⾃分で実装したコードで制御できる • 関⼼のある部分の実装にたどり着くまでが⼤変 • 2.
既存OSの改造 • 関⼼のある部分の実装にすぐ着⼿できる • 既存OSの実装を理解している必要がある • Linuxのような⼤規模なOSの場合かなり⼤変 4
OS⾃作の障壁 • x86プラットフォームは⽐較的複雑 • 歴史的経緯による • 煩雑な起動プロセス • 多種多様なデバイスへの対応 •
学習⽤途であれば仮想環境で⼗分では? • デバイス: virtio, シリアルコンソール • OSの起動: -kernel os.img • => Unikernelが使えそう 5
Unikernel: 概要 • OSの形態の1つ (Library OS) • 仮想環境で動作す ることを前提 •
空間の分離なし • シングルプロセス • ハイパーバイザで 隔離性を担保 • 実装は多数 6
Unikernel: ⾃作OSの観点 • 簡易化したOSとみなせる • 1. ゼロからの実装: • マルチプロセスの実装が不要 •
実装すべきデバイスドライバは少数 • 2. 既存OSの改造: • コード量が⽐較的少ない • 例: Unikraft 108,523⾏ 7
Unikernels as Processes • Unikernelをホスト上のプロセスとして動かす • 隔離はOS上のプロセスで⼗分 • Unikernelに対する制約 •
システムコールを直接発⾏できない 8
ハイパーコール 9
Unikernels as Processes: ⾃作OSの観点 • 抽象化されたデバイス • デバイスドライバを書く必要がない • ハイパーコールを発⾏するだけで利⽤可能
• デバッグが⽐較的容易 • ただのユーザ空間のプロセスのため • エミュレータも不要 • => ⾼レイヤーな部分を作るのに最適 10
課題点 • 学習を⽬的に設計実装されていない • コードが不親切だったり • コードの説明がなかったり • 汎⽤OSでは必須な機能の実装がない •
マルチタスク • ユーザ空間とカーネル空間の分離 • =>どこに興味があるかに依存 11
実例 12
Unikraft 13
Linux Kernel Library 14 • vanillaなLinux Kernelがユーザ空 間で動作 • ホスト固有の
コードは綺麗に 分離 • mutex/semaphore /thread/block rw etc. • arch/lkl
LKL on Unikraft 15 uk-host.o lkl.o LKL App unikraft_linuxu_x86_64 liblkl
LK mutex.o thread.o timer.o
LKL on Unikraftデモ 16 $ ./build/boot_linuxu-x86_64 Welcome to _ __
_____ __ _____ (_) /__ _______ _/ _/ /_ / // / _ \/ / '_// __/ _ `/ _/ __/ \_,_/_//_/_/_/\_\/_/ \_,_/_/ \__/ Titan 0.2~51691ea /* snip */ [ 0.000000] Linux version 4.17.0+ (
[email protected]
) (gcc version 8.1.1 20180712 (Red Hat 8.1.1-5) (GCC)) #1 Thu Jan 10 14:04:16 JST 2019 /* snip */ [ 0.000000] This architecture does not have kernel memory protection. lkl_start_kernel(&lkl_host_ops, "mem=16M loglevel=8") = 0 /* snip */