Weitere ähnliche Inhalte Ähnlich wie Plan 9のお話 (20) Mehr von Ryousei Takano (20) Kürzlich hochgeladen (20) Plan 9のお話2. • Plan 9 OS
•
• Plan 9
• Plan 9 (@go_vm )
3. Plan 9
UNIX
OS
Phil Winterbottom
Dave Presotto
Dennis Ritchie Rob Pike
1995
4. Plan 9
UNIX
OS
Phil Winterbottom Jim McKie
Dave Presotto
Dennis Ritchie Rob Pike
1995 2004
5. Plan 9 Google
• Rob Pike Ken Thompson Russ Cox
Google
Plan 10
Plan 9
Plan 11?
Google OS
http://undergoogle.com/tools/GoogleMasterPlanEN.html
7. Plan 9
“Not only is UNIX dead,
it’s starting to smell really bad.”
-- Rob Pike, 1991
8. UNIX Plan 9
“the most dangerous enemy of
a better solution is an existing
codebase that is just good
enough”
-- Eric Raymond,
“The art of UNIX Programming”
Linux Plan 9 @IT (2009)
9. UNIX
• proc
•
•
• rfork clone
•
•
• UTF-8
10. OS Plan 9 !
=@ DAHAIE@AJ MHIJ=JEI H 2+I ?=A@ JAHE=I E 2= ' JAHECO .ECKHA
IDMIJDA=HH=CAAJ
6AH
1JAHAJ
6AH 6AH 6AH
WS or PC /=JAM=O
-JDAHAJ
WORM jukebox
.EA +27 +27 .EA /=JAM=O
.EAHAJMH
,=J=EJ
SMP
6AH 6AH 6AH
Rob Pike, “Plan 9 from Bell Labs” (1995)
+27 IAHLAHI =@ BEA IAHLAHI ID=HA B=IJ ?==HA=
12. •
• open-read-write-close
13. ...
UNIX
UNIX
• GUI
• X MIT
•
• UCB
14. • UNIX
O /dev/tty, /proc
X network interface, X window system
• Plan 9
O /dev/cons, /proc, network interface, rio
window system, http, ftp, environment variable
X
15. • /dev/screen
• /dev/window
/dev/wsys/*/window
•
16. rio
• /dev/^(cons mouse window)
app.
app.
rio
read /dev/mouse app.
User read /dev/mouse
Kernel #s #m
17. /net
•
net
ether0 tcp udp cs dns
0 1 clone stats
ctl data err listen local remote status
18. /net/tcp
• /net/tcp/N
• ctl
• data
• /net/tcp/clone
% lc /net/tcp
0 1 10 ... clone stats
% lc /net/tcp/0
ctl data err listen local remote status
19. echo
terminal 1:
% cat /net/tcp/clone open(“/net/tcp/clone”) open
5 (“/net/tcp/*/ctl”)
% cat /net/tcp/clone
connect 192.168.182.130!7
terminal 2:
% cat /net/tcp/5/data
% echo hoge /net/tcp/5/data
echo
20. echo
• listen UNIX inetd
•
stdio
% aux/listen1 -t tcp!*!7 /bin/service/tcp7
% cat /bin/service/tcp7
#!/bin/rc
/bin/cat
22. API
•
open-read-write-close
Plan 9 ioctl
• BSD
•
23. echo
int fd, n;
char *name;
name = netmkaddr(“plan9.bell-labs.com”,
“tcp”, “echo”); “204.178.31.2!echo
fd = dial(name, 0, 0, 0);
:
n = write(fd, buf, sizeof(buf));
read(1, buf, n);
24. echo
int acfd, lcfd, dfd, n;
char adir[40], ldir[40] /net/tcp/5
acfd = announce(tcp!*!7, adir);
for (;;) { /net/tcp/6
lcfd = listen(adir, ldir);
switch (fork()) { UNIX
case 0:
dfd = accept(lcfd, ldir);
while ((n = read(dfd, buf, sizeof(buf))) 0)
write(dfd, buf, n);
exits(0);
}
}
25. BSD
Plan 9 BSD socket
dial active open fd
socket
announce passive open fd
dial connect active open
- bind
announce listen
listen/accept accept
reject close
- shutdown
27. Plan 9
•
• +fossil
• Go Plan 9 wiki!
http://plan9.bell-labs.com/wiki/plan9/
28. • i386 AMD64 ARM PowerPC ...
• KVM QEMU
Virtual Box VMWare Xen lguest
•
29. UNIX Plan 9
• Plan9port
• Plan 9 UNIX
• 9vx
• a.out
• Plan 9
• Glandix
• Linux
31. • kencc: ANSI C
• acme:
• acid:
• APE: POSIX
32. kencc:
compiler assembler loader
SPARC kc ka kl
Power PC qc qa ql
MIPS (BE) vc va vl
MIPS (LE) 0c 0a 0l
Motorola 68000 1c 1a 1l
Motorola 68020 2c 2a 2l
ARM (LE) 5c 5a 5l
AMD64 Intel 960 6c 6a 6l
DEC Alpha 7c 7a 7l
Intel 386 8c 8a 8l
AMD 29000 9c 9a 9l
34. 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.
35. 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
36. % 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
37. 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
38. % 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
39. ./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
40. % 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
41. •
/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
42. •
% 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
43. FAQ
•
•
• Ctrl-C
• UNIX
• OS
•
• create
•
•
44. Plan 9
An army of Glendas take over IBM’s Blue Gene!!
45. • 2/23 VM IIJ
• Plan 9
• 3 Plug 9 @
Plan 9
46. Plan9 http://d.hatena.ne.jp/oraccha/
@glenda9p
47. Plan 9
“Narrowness of experience
leads to narrowness of
imagination..”
-- Rob Pike,
“Systems Software Research is Irrelevant”,
2000