SlideShare uses cookies to improve functionality and performance, and to provide you with relevant advertising. If you continue browsing the site, you agree to the use of cookies on this website. See our User Agreement and Privacy Policy.
SlideShare uses cookies to improve functionality and performance, and to provide you with relevant advertising. If you continue browsing the site, you agree to the use of cookies on this website. See our Privacy Policy and User Agreement for details.
Successfully reported this slideshow.
Activate your 14 day free trial to unlock unlimited reading.
20.
20
Red HatのKVMによりサポートされるゲストOS
• virtioドライバ(ゲストOS用ドライバ)が提供されており、
パフォーマンスが期待できるもの
– EL3.9 (32bit, 64bit), EL4.7(32bit, 64bit), EL5.3 (32bit, 64bit)
– Windows Server 2003 (32bit, 64bit), 2008 (32bit, 64bit)
– Windows XP (32bit) – Network driver only
– Windows 2000=NG Windows Vista, 7=?
• RHEL5により公式サポートされるもの
– EL3(32bit), EL4(32bit or 64bit), EL5(32bit or 64bit)
– Windows Server 2003 (32bit, 64bit), 2008 (32bit, 64bit)
– Windows XP (32bit)
※公式なサポート状況はRed Hatにご確認ください
34.
34
メモリ管理、ちょっと寄り道(1/2)
現在一般的なシステムにおける、物理メモリ空間と仮想メモリ空間
0GiB -
OS Kernel
Process 2
Process2 から見える
メモリ空間物理メモリ
OS Kernel
Process 1
Process 2
Process 3
Process 4
64GiB -
OS Kernel
Process 1
Process1 から見える
メモリ空間
35.
35
メモリ管理、ちょっと寄り道(2/2)
procedure CR3Read(var p : Pointer);
asm
mov p, cr3
end;
// エディットボックスEdit1の内容が変更されたら、その内容を
// 文字列バッファbuffにコピーする。
procedure TForm1.Edit1Change(Sender: TObject);
begin
StrPCopy(@buff, Edit1.Text);
end;
// Button1がクリックされたら、文字列バッファがどこにあるか
// アドレスを表示し、また、バッファ上の文字列を表示する。
procedure TForm1.Button1Click(Sender: TObject);
var
s: String;
begin
s := format('バッファは0x%pにあります。', [ @buff ]);
memo1.lines.add(s);
s := format('このアドレスには文字列 %s が記録されています。',
[ PChar(@buff) ] );
memo1.lines.add(s);
end;
// Button2がクリックされたら CR3 を読み取り、表示する。
// ※特権命令があるため、実際には成功しない
procedure TForm1.Button2Click(Sender: TObject);
var
p: Pointer;
s: String;
begin
CR3Read(p);
s := format('このプロセスのCR3は %p を指しています。',
[ p ] );
memo1.lines.add(s);
end;
サンプル ダウンロード先
http://bit.ly/aPn3zm
36.
36
x86におけるメモリ管理の基本 #1
CSCS
System Registers
LDTRLDTR
TRTR
CR3CR3CR2CR2
CR1CR1CR0CR0
GDTRGDTR
IDTRIDTR
Controll Regiesters
System Address Registers
floating point number registers
・・・
Debug Registers
DR0DR0 ~ DR7DR7 TR3TR3 ~ TR7TR7
EAXEAX
EBPEBP
EBXEBX
ECXECX
EDXEDX
Main Registers
Base Pointer
ESPESP
ESIESI
EDIEDI
Stack Pointer
EIPEIP
EFLAGSEFLAGS
Flag Register
Segment Registers
CSCS
DSDS
ESES
SSSS
FSFS
GSGS
Instruction Pointer
General Registers
(参考) 486プロセッサに実装されているレジスタセット
作成にあたっての参考資料: はじめて読む486 (1994年 株式会社アスキー)
40.
40
仮想化環境におけるメモリ利用イメージ
非仮想化
環境の場合
0GiB -
OS Kernel
Process 2
ユーザプロセスから
見えるメモリ空間物理メモリ
Hypervisor
Guest OS 1
Guest OS 2
Guest OS 3
Guest OS 4
OS Kernel
Process 1
Process 2
Process 3
Process 4
ゲストOSの
メモリ空間
OS Kernel
Process 1
Process 2
Process 3
Process 4
64GiB -
仮想化環境の場合
物理メモリ
41.
41
KVM, QEMUにおける
VMへのメモリ領域割当 #1
• VMのメモリ空間はqemu-kvm
( QEMU)のデータ領域として確保さ
れる
– 他の一般なプロセスと同じ扱い
• Linuxカーネルから見ればただのユー
ザスペースのデータ領域に過ぎない
• VM割り当てメモリサイズの上限
– qemu-kvm + VM Imageの合計が
プロセス最大メモリサイズに収まる
必要がある
– 32bit / 32bit PAE …… < 4GB
– x86_64 …… 4GB以上可能
Linux Kernel
qemu-kvm (or QEMU)
VM Image
process
process
process
物理メモリ
52.
52
Serial
Port
Serial
Port
Parallel
Port
Parallel
Port
PIIX3 PCI IDEPIIX3 PCI IDE
PIIX3 PCI USBPIIX3 PCI USB
PCI SlotPCI Slot
PCI SlotPCI Slot
LSI Logic
LSI53c895a
LSI Logic
LSI53c895a
System MemorySystem Memory
Bochs
Flash BIOS
Bochs
Flash BIOS
Real Time
Clock
Real Time
Clock
Cirrus Logic
CL-GD5446
Cirrus Logic
CL-GD5446
Realtek
RTL8029
Realtek
RTL8029
Ensoniq
ES1370
Ensoniq
ES1370
ISA
Bus
ISA
Bus
ISA
I/O Interface
ISA
I/O Interface
FloppyFloppy
PC SpeakerPC Speaker
PCI
Bus
PCI
Bus
Intel 82371 PIIX3
(South-bridge)
Intel 82371 PIIX3
(South-bridge)
CPUCPU
VGAVGA
EthernetEthernet
SpeakerSpeaker
SCSI HDDSCSI HDD
IDE HDDIDE HDD
CD-ROMCD-ROM
USBUSB
KeyboardKeyboard
MouseMouse
PS/2PS/2
QEMUによる
x86ハードウェアエミュレーション
出典: KVM徹底入門 (2010年 翔泳社)
Intel 82441FX
(North-bridge)
Intel 82441FX
(North-bridge)
79.
Copyright(C) Software Research Associates, Inc. All Rights Reserved.
Xen環境下におけるZFS障害体験
(おまけ)
80.
80
(番外編)ZFSを正しく動かすのは難しい
• ZFSをPC, PCサーバ, 仮想マシンの上で正しく動かすのは難しい
– ZFSの設計思想のひとつ:信頼性
– End to End Checksum
• 上記実現のために前提条件として要求されるもの
– 正しいエラー通知をするハードウェア、ドライバ
– 必要なライト操作は同期I/Oで行われること
– “絶対に壊れないZFS Intent Log(ZIL)” ※ZIL利用時
• Xenの上で実行するにあたり
– blktapの”tap:aio:…”もしくは”tap:sync:…”を使う
81.
81
RAID-Z障害の例(1)
root@os200811:~# zpool status array1
pool: array1
state: DEGRADED
status: One or more devices are faulted in response to persistent errors.
Sufficient replicas exist for the pool to continue functioning in a
degraded state.
action: Replace the faulted device, or use 'zpool clear' to mark the device
repaired.
see: http://www.sun.com/msg/ZFS-8000-K4
scrub: none requested
config:
NAME STATE READ WRITE CKSUM
array1 DEGRADED 0 0 0
raidz1 DEGRADED 0 0 0
c3d1p1 ONLINE 0 0 0
c3d2p1 FAULTED 8 7.56M 0 too many errors
c3d3p1 ONLINE 0 0 0
84.
84
いまは平和に動いています
toor@vm230:~$ pfexec zpool status array1
pool: array1
state: ONLINE
status: The pool is formatted using an older on-disk format. The pool can
still be used, but some features are unavailable.
action: Upgrade the pool using 'zpool upgrade'. Once this is done, the
pool will no longer be accessible on older software versions.
scrub: scrub completed after 3h40m with 0 errors on Fri Mar 12 01:20:10 2010
config:
NAME STATE READ WRITE CKSUM
array1 ONLINE 0 0 0
raidz1-0 ONLINE 0 0 0
c6t1d0p0 ONLINE 0 0 0
c6t2d0p0 ONLINE 0 0 0
c6t3d0p0 ONLINE 0 0 0
logs
c6t4d0p0 ONLINE 0 0 0
errors: No known data errors
85.
Copyright(C) Software Research Associates, Inc. All Rights Reserved.
付録
88.
88
外部リソース集 (3/3)
– 書籍『Virtual Machines: Versatile Platforms for Systems and Processes
(The Morgan Kaufmann Series in Computer Architecture and Design)』
http://www.amazon.com/dp/1558609105/
※ハードカバー&分厚いので amazon.com から Kindle 版の購入をお勧め!