今日から始めるPlan 9 from Bell Labs

2,355 views

Published on

第一回カーネル・VM探検隊。2009-08-10

Published in: Technology
  • Be the first to comment

今日から始めるPlan 9 from Bell Labs

  1. 1. Plan 9 from Bell Labs oraccha Plan9 http://d.hatena.ne.jp/oraccha/ 2009 8 10 VM
  2. 2. Plan 9
  3. 3. • Plan 9 OS • 9vx Plan 9 • Plan 9
  4. 4. Plan 9 UNIX OS Phil Winterbottom Dave Presotto Dennis Ritchie Rob Pike 1995
  5. 5. Plan 9 UNIX OS Phil Winterbottom Jim McKie Dave Presotto Dennis Ritchie Rob Pike 1995 2004
  6. 6. Plan 9 • BlueGene/P • Google Summer of Code • International Workshop
  7. 7. Plan 9 “Not only is UNIX dead, it’s starting to smell really bad.” -- Rob Pike, 1991
  8. 8. xterm... User Window Shell ASR-33
  9. 9. Plan 9 • • 9P •
  10. 10. • • open-read-write-close
  11. 11. UNIX Kernel UFS UFS Interface Process Char Char Interface device Block Block Interface device
  12. 12. ... UNIX UNIX • • UCB • GUI • X MIT
  13. 13. Socket Other file Sysctl system Process Lotsa stuff! UFS VFS VFS sysfs Interface Char Char Interface device Block Block Interface device
  14. 14. Kernel Server Server Process Interface Device
  15. 15. Plan 9 9p2000 protocol Kernel Server (process) Server for email file system Process Interface Server (process) for local file system Device
  16. 16. 9P version auth attach flush error walk open create read write clunk remove stat wstat
  17. 17. UNIX I/O Plan 9 • I/F •
  18. 18. Plan 9 UNIX root
  19. 19. UNIX • 9P • proc • • rfork clone • • UTF-8
  20. 20. • i386 AMD64 ARM PowerPC SPARC • KVM QEMU Virtual Box VMWare Xen KVM lguest • MIPS
  21. 21. UNIX Plan 9 • Plan9port • Plan 9 • v9fs • 9vx • Plan 9 • • Drawterm •
  22. 22. 9vx Plan 9 Plan 9 Plan 9 1 a.out a.out a.out vx32 sandbox library Modified Plan 9 kernel Host OS (Linux, FreeBSD, MacOS X)
  23. 23. 9vx TIPS • x86_64 Mercurial - http://code.google.com/p/vx32/ • Plan 9 % 9fs sources % cd /n/sources % @{cd plan9/386/lib && tar c .} | @{cd /386/lib && tar x}
  24. 24. • acme: • kencc: ANSI C • acid: • APE: POSIX
  25. 25. man emacs(1) EMACS(1) NAME emacs - editor macros SYNOPSIS emacs [ options ] DESCRIPTION This page intentionally left blank. SOURCE MIT SEE ALSO sam(1), vi(1) BUGS Yes.
  26. 26. kencc: rio/rio.c 58: enum 59: { 60: Cut, 61: Paste, 62: Snarf, 63: Plumb, 64: Send, 65: Scroll, 66: }; 67: C99 68: char *menu2str[] = { 69: [Cut] "cut", [Cut] = “cut”, 70: [Paste] "paste", 71: [Snarf] "snarf", 72: [Plumb] "plumb", 73: [Send] "send", 74: [Scroll] "scroll", 75: nil 76: };
  27. 27. kencc: • Linux • rio/dat.h 107 struct Mousestate 108 { 109 Mouse; 110 ulong counter; 111 }; rio/wind.c 305: m = (Mousestate){w->mc.Mouse, w->mouse.counter};
  28. 28. Hello, World! % cat hello.c #include <u.h> #include <libc.h> void main() { print(“Hello, World!n”); exits(nil); } % 8c hello.c % 8l -o hello hello.8 % hello
  29. 29. % cat hello.c #include <u.h> #include <libc.h> void main() { print(“Hello, World!n”); exits(nil); } % 8c hello.c % 8l -o hello hello.8 % hello
  30. 30. ANSI C/POSIX % cat hello.c #include <u.h> #include <libc.h> void main() { print(“Hello, World!n”); exits(nil); } % 8c hello.c % 8l -o hello hello.8 % hello
  31. 31. % cat hello.c #include <u.h> #include <libc.h> void main() include/libc.h: { 1: #pragma lib “libc.a” print(“Hello, World!n”); 2: #pragma src “/sys/src/libc” exits(nil); } % 8c hello.c % 8l -o hello hello.8 % hello
  32. 32. ./hello % cat hello.c #include <u.h> #include <libc.h> void main() { print(“Hello, World!n”); exits(nil); } % 8c hello.c % 8l -o hello hello.8 % hello
  33. 33. % ls /env '*' boottime 'fn#sigexit' pid terminal 0 cflag font prompt timezone NPROC cputype fs rcname user apid ether0 home rootdir wctl auth facedom ifs service wsys bootargs fileserver objtype status bootfile 'fn#cpu%' path sysname % cat /env/path ./bin
  34. 34. • /bin % ns | grep /bin bind /386/bin /bin bind -a /rc/bin /bin bind -a /usr/oraccha/bin/rc /bin bind -a /usr/oraccha/bin/386 /bin ※Linux aufs unionfs
  35. 35. • % foo foo 151: suicide: sys: trap: page fault pc=0x00001025 % ps | grep foo glenda 151 0:00 0:00 8K Broken foo • acid(1) % acid 151 /proc/151/text: 386 plan 9 executable : acid: stk() • /proc import
  36. 36. Plan 9 • Web http://plan9.bell-labs.com/ sources/plan9/sys/src/ • git git://github.com/ ericvh/plan-9.git sys -- src |-- 9 # kernel | |-- pc | `-- port |-- cmd # uesr command `-- libc # libc library
  37. 37. Plan9 http://d.hatena.ne.jp/oraccha/

×