SlideShare a Scribd company logo
oraccha@Plan9




2010   2   10
•   Plan 9         OS

•
•   Plan 9



•            Plan 9 (@go_vm   )
Plan 9
UNIX
   OS

                         Phil Winterbottom




                         Dave Presotto
        Dennis Ritchie               Rob Pike




                                             1995
Plan 9
           UNIX
                     OS

                 Phil Winterbottom          Jim McKie




                 Dave Presotto
Dennis Ritchie               Rob Pike




                                     1995               2004
Plan 9                Google
• Rob Pike   Ken Thompson Russ Cox
               Google

                                                  Plan 10

                             Plan 9
                                                 Plan 11?
Google OS



             http://undergoogle.com/tools/GoogleMasterPlanEN.html
Gopher
Glen and Glenda




           Illustrated by Renée French
Plan 9

“Not only is UNIX dead,
it’s starting to smell really bad.”
              -- Rob Pike, 1991
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)
UNIX
•   proc

•
•
•   rfork clone

•
•
•   UTF-8
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=
Plan 9

  •
  • 9P
  •
•
•   open-read-write-close
...
                   UNIX
            UNIX

•   GUI
    •   X            MIT

•
    •       UCB
•   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
•           /dev/screen

•                   /dev/window
    /dev/wsys/*/window


•
rio
     •   /dev/^(cons mouse window)



                     app.
         app.
                                       rio
 read /dev/mouse app.
User                                 read /dev/mouse

Kernel          #s                     #m
/net
     •
                             net


     ether0        tcp       udp       cs   dns


         0     1         clone stats

ctl data err listen local remote status
/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
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
echo
  •   listen      UNIX inetd

      •
          stdio
% aux/listen1 -t tcp!*!7 /bin/service/tcp7 

% cat /bin/service/tcp7

#!/bin/rc

/bin/cat
tcpdump
#!/bin/rc
clonefile=/net/ether0/clone
[4] $clonefile {
	 netdir=`{basename -d $clonefile} ^ /
^ `{cat /fd/4}
	 echo connect -1 $netdir/ctl || exit
'cannot connect'
	 cat $netdir/data | xd -u -x2
}
API
•
    open-read-write-close

    Plan 9   ioctl

•   BSD



•
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);
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);
    }
}
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
UNIX     I/O


Plan 9

 •
 •
Plan 9
•
    •              +fossil



•   Go Plan 9 wiki!
    http://plan9.bell-labs.com/wiki/plan9/
•   i386   AMD64 ARM PowerPC ...

•                         KVM QEMU
    Virtual Box   VMWare Xen   lguest

•
UNIX                     Plan 9
•   Plan9port
    •  Plan 9               UNIX

•   9vx
    •            a.out

    •   Plan 9

•   Glandix
    • Linux
drawterm

•   UNIX   Plan 9 CPU



•             /mnt/term
                mount
•   kencc: ANSI C

•   acme:



•   acid:

•   APE: POSIX
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
acme:
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.
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
% 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
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
% 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
./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
% 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
•
                                   /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
•
    % 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
FAQ
•
•
•   Ctrl-C

•   UNIX

•            OS

•
•   create

•
•
Plan 9




   An army of Glendas take over IBM’s Blue Gene!!
•   2/23               VM   IIJ

    •         Plan 9

•   3      Plug 9      @


           Plan 9
Plan9       http://d.hatena.ne.jp/oraccha/
@glenda9p
Plan 9
“Narrowness of experience
leads to narrowness of
imagination..”
                             -- Rob Pike,
“Systems Software Research is Irrelevant”,
                                     2000

More Related Content

What's hot (20)

分散システムの限界について知ろう by Shingo Omura, has 60 slides with 34107 views.
分散システムの限界について知ろう分散システムの限界について知ろう
分散システムの限界について知ろう
Shingo Omura
60 slides34.1K views
BGP Unnumbered で遊んでみた by akira6592, has 21 slides with 7483 views.
BGP Unnumbered で遊んでみたBGP Unnumbered で遊んでみた
BGP Unnumbered で遊んでみた
akira6592
21 slides7.5K views
Where狙いのキー、order by狙いのキー by yoku0825, has 109 slides with 42918 views.
Where狙いのキー、order by狙いのキーWhere狙いのキー、order by狙いのキー
Where狙いのキー、order by狙いのキー
yoku0825
109 slides42.9K views
SQLアンチパターン 幻の第26章「とりあえず削除フラグ」 by Takuto Wada, has 45 slides with 156739 views.
SQLアンチパターン 幻の第26章「とりあえず削除フラグ」SQLアンチパターン 幻の第26章「とりあえず削除フラグ」
SQLアンチパターン 幻の第26章「とりあえず削除フラグ」
Takuto Wada
45 slides156.7K views
InnoDBのすゝめ(仮) by Takanori Sejima, has 61 slides with 24251 views.
InnoDBのすゝめ(仮)InnoDBのすゝめ(仮)
InnoDBのすゝめ(仮)
Takanori Sejima
61 slides24.3K views
知っているようで知らないNeutron -仮想ルータの冗長と分散- - OpenStack最新情報セミナー 2016年3月 by VirtualTech Japan Inc., has 64 slides with 8187 views.
知っているようで知らないNeutron -仮想ルータの冗長と分散- - OpenStack最新情報セミナー 2016年3月 知っているようで知らないNeutron -仮想ルータの冗長と分散- - OpenStack最新情報セミナー 2016年3月
知っているようで知らないNeutron -仮想ルータの冗長と分散- - OpenStack最新情報セミナー 2016年3月
VirtualTech Japan Inc.
64 slides8.2K views
大規模サービスを支えるネットワークインフラの全貌 by LINE Corporation, has 35 slides with 22523 views.
大規模サービスを支えるネットワークインフラの全貌大規模サービスを支えるネットワークインフラの全貌
大規模サービスを支えるネットワークインフラの全貌
LINE Corporation
35 slides22.5K views
ラズパイでデバイスドライバを作ってみた。 by Kazuki Onishi, has 44 slides with 4640 views.
ラズパイでデバイスドライバを作ってみた。ラズパイでデバイスドライバを作ってみた。
ラズパイでデバイスドライバを作ってみた。
Kazuki Onishi
44 slides4.6K views
Where狙いのキー、order by狙いのキー by yoku0825, has 109 slides with 42918 views.
Where狙いのキー、order by狙いのキーWhere狙いのキー、order by狙いのキー
Where狙いのキー、order by狙いのキー
yoku0825
109 slides42.9K views
SQLアンチパターン 幻の第26章「とりあえず削除フラグ」 by Takuto Wada, has 45 slides with 156739 views.
SQLアンチパターン 幻の第26章「とりあえず削除フラグ」SQLアンチパターン 幻の第26章「とりあえず削除フラグ」
SQLアンチパターン 幻の第26章「とりあえず削除フラグ」
Takuto Wada
45 slides156.7K views
知っているようで知らないNeutron -仮想ルータの冗長と分散- - OpenStack最新情報セミナー 2016年3月 by VirtualTech Japan Inc., has 64 slides with 8187 views.
知っているようで知らないNeutron -仮想ルータの冗長と分散- - OpenStack最新情報セミナー 2016年3月 知っているようで知らないNeutron -仮想ルータの冗長と分散- - OpenStack最新情報セミナー 2016年3月
知っているようで知らないNeutron -仮想ルータの冗長と分散- - OpenStack最新情報セミナー 2016年3月
VirtualTech Japan Inc.
64 slides8.2K views
大規模サービスを支えるネットワークインフラの全貌 by LINE Corporation, has 35 slides with 22523 views.
大規模サービスを支えるネットワークインフラの全貌大規模サービスを支えるネットワークインフラの全貌
大規模サービスを支えるネットワークインフラの全貌
LINE Corporation
35 slides22.5K views
ラズパイでデバイスドライバを作ってみた。 by Kazuki Onishi, has 44 slides with 4640 views.
ラズパイでデバイスドライバを作ってみた。ラズパイでデバイスドライバを作ってみた。
ラズパイでデバイスドライバを作ってみた。
Kazuki Onishi
44 slides4.6K views

Similar to Plan 9のお話 (20)

今日から始めるPlan 9 from Bell Labs by Ryousei Takano, has 37 slides with 2719 views.
今日から始めるPlan 9 from Bell Labs今日から始めるPlan 9 from Bell Labs
今日から始めるPlan 9 from Bell Labs
Ryousei Takano
37 slides2.7K views
あなたの知らないネットワークプログラミングの世界 by Ryousei Takano, has 29 slides with 1829 views.
あなたの知らないネットワークプログラミングの世界あなたの知らないネットワークプログラミングの世界
あなたの知らないネットワークプログラミングの世界
Ryousei Takano
29 slides1.8K views
マッコスXで始めるPlan 9 by Ryousei Takano, has 25 slides with 1176 views.
マッコスXで始めるPlan 9マッコスXで始めるPlan 9
マッコスXで始めるPlan 9
Ryousei Takano
25 slides1.2K views
Plan 9でWebプログラミング by Ryousei Takano, has 11 slides with 2474 views.
Plan 9でWebプログラミングPlan 9でWebプログラミング
Plan 9でWebプログラミング
Ryousei Takano
11 slides2.5K views
Open shift by marcolof, has 39 slides with 1722 views.
Open shiftOpen shift
Open shift
marcolof
39 slides1.7K views
Docker by Chen Chun, has 35 slides with 1148 views.
DockerDocker
Docker
Chen Chun
35 slides1.1K views
Unix Ramblings by Bill Miller, has 28 slides with 454 views.
Unix RamblingsUnix Ramblings
Unix Ramblings
Bill Miller
28 slides454 views
Library Operating System for Linux #netdev01 by Hajime Tazaki, has 40 slides with 45537 views.
Library Operating System for Linux #netdev01Library Operating System for Linux #netdev01
Library Operating System for Linux #netdev01
Hajime Tazaki
40 slides45.5K views

More from Ryousei Takano (20)

Error Permissive Computing by Ryousei Takano, has 1 slides with 225 views.
Error Permissive ComputingError Permissive Computing
Error Permissive Computing
Ryousei Takano
1 slide225 views
Opportunities of ML-based data analytics in ABCI by Ryousei Takano, has 19 slides with 1463 views.
Opportunities of ML-based data analytics in ABCIOpportunities of ML-based data analytics in ABCI
Opportunities of ML-based data analytics in ABCI
Ryousei Takano
19 slides1.5K views
ABCI: An Open Innovation Platform for Advancing AI Research and Deployment by Ryousei Takano, has 28 slides with 819 views.
ABCI: An Open Innovation Platform for Advancing AI Research and DeploymentABCI: An Open Innovation Platform for Advancing AI Research and Deployment
ABCI: An Open Innovation Platform for Advancing AI Research and Deployment
Ryousei Takano
28 slides819 views
ABCI Data Center by Ryousei Takano, has 26 slides with 551 views.
ABCI Data CenterABCI Data Center
ABCI Data Center
Ryousei Takano
26 slides551 views
クラウド環境におけるキャッシュメモリQoS制御の評価 by Ryousei Takano, has 22 slides with 1575 views.
クラウド環境におけるキャッシュメモリQoS制御の評価クラウド環境におけるキャッシュメモリQoS制御の評価
クラウド環境におけるキャッシュメモリQoS制御の評価
Ryousei Takano
22 slides1.6K views
USENIX NSDI 2016 (Session: Resource Sharing) by Ryousei Takano, has 16 slides with 1156 views.
USENIX NSDI 2016 (Session: Resource Sharing)USENIX NSDI 2016 (Session: Resource Sharing)
USENIX NSDI 2016 (Session: Resource Sharing)
Ryousei Takano
16 slides1.2K views
User-space Network Processing by Ryousei Takano, has 22 slides with 5689 views.
User-space Network ProcessingUser-space Network Processing
User-space Network Processing
Ryousei Takano
22 slides5.7K views
Flow-centric Computing - A Datacenter Architecture in the Post Moore Era by Ryousei Takano, has 15 slides with 2134 views.
Flow-centric Computing - A Datacenter Architecture in the Post Moore EraFlow-centric Computing - A Datacenter Architecture in the Post Moore Era
Flow-centric Computing - A Datacenter Architecture in the Post Moore Era
Ryousei Takano
15 slides2.1K views

Recently uploaded (20)

Exploring Cloud Computing: Revolutionizing IT Infrastructure with Scalable, F... by chandmoni521, has 9 slides with 19 views.
Exploring Cloud Computing: Revolutionizing IT Infrastructure with Scalable, F...Exploring Cloud Computing: Revolutionizing IT Infrastructure with Scalable, F...
Exploring Cloud Computing: Revolutionizing IT Infrastructure with Scalable, F...
chandmoni521
9 slides19 views
3 Best USA IPTV Providers (2025) - IPTV Service with Free Trial by Maro Review, has 19 slides with 24 views.
3 Best USA IPTV Providers (2025) - IPTV Service with Free Trial3 Best USA IPTV Providers (2025) - IPTV Service with Free Trial
3 Best USA IPTV Providers (2025) - IPTV Service with Free Trial
Maro Review
19 slides24 views
PECB Webinar ISO27001 and how 27032 can help vFinal.pdf by Peter GEELEN ✔, has 83 slides with 20 views.
PECB Webinar ISO27001 and how 27032 can help vFinal.pdfPECB Webinar ISO27001 and how 27032 can help vFinal.pdf
PECB Webinar ISO27001 and how 27032 can help vFinal.pdf
Peter GEELEN ✔
83 slides20 views
[SUDA] maumAI On-device AI (STT-LLM-TTS) by Taejoon Yoo, has 2 slides with 52 views.
[SUDA] maumAI On-device AI (STT-LLM-TTS)[SUDA] maumAI On-device AI (STT-LLM-TTS)
[SUDA] maumAI On-device AI (STT-LLM-TTS)
Taejoon Yoo
2 slides52 views
GDG OC MIT ACSC Orientation Session 2024-25.pdf by Google Developer Groups On Campus MIT Arts,Commerce and Science College,Pune, has 31 slides with 31 views.
GDG OC MIT ACSC Orientation Session 2024-25.pdfGDG OC MIT ACSC Orientation Session 2024-25.pdf
GDG OC MIT ACSC Orientation Session 2024-25.pdf
Google Developer Groups On Campus MIT Arts,Commerce and Science College,Pune
31 slides31 views
A comprehensive guide to Agentic AI Systems by Debmalya Biswas, has 52 slides with 392 views.
A comprehensive guide to Agentic AI SystemsA comprehensive guide to Agentic AI Systems
A comprehensive guide to Agentic AI Systems
Debmalya Biswas
52 slides392 views
Telner UX Design-Portfolio Dec30 2024.pdf by Jason Telner Ph.D., has 47 slides with 56 views.
Telner UX Design-Portfolio Dec30 2024.pdfTelner UX Design-Portfolio Dec30 2024.pdf
Telner UX Design-Portfolio Dec30 2024.pdf
Jason Telner Ph.D.
47 slides56 views
Securiport - Utilizes Innovation And Technology by Securiport , has 8 slides with 54 views.
Securiport - Utilizes Innovation And TechnologySecuriport - Utilizes Innovation And Technology
Securiport - Utilizes Innovation And Technology
Securiport
8 slides54 views
Exploring Cloud Computing: Revolutionizing IT Infrastructure with Scalable, F... by chandmoni521, has 9 slides with 19 views.
Exploring Cloud Computing: Revolutionizing IT Infrastructure with Scalable, F...Exploring Cloud Computing: Revolutionizing IT Infrastructure with Scalable, F...
Exploring Cloud Computing: Revolutionizing IT Infrastructure with Scalable, F...
chandmoni521
9 slides19 views
3 Best USA IPTV Providers (2025) - IPTV Service with Free Trial by Maro Review, has 19 slides with 24 views.
3 Best USA IPTV Providers (2025) - IPTV Service with Free Trial3 Best USA IPTV Providers (2025) - IPTV Service with Free Trial
3 Best USA IPTV Providers (2025) - IPTV Service with Free Trial
Maro Review
19 slides24 views

Plan 9のお話

  • 1. oraccha@Plan9 2010 2 10
  • 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
  • 6. Gopher Glen and Glenda Illustrated by Renée French
  • 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=
  • 11. Plan 9 • • 9P •
  • 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
  • 21. tcpdump #!/bin/rc clonefile=/net/ether0/clone [4] $clonefile { netdir=`{basename -d $clonefile} ^ / ^ `{cat /fd/4} echo connect -1 $netdir/ctl || exit 'cannot connect' cat $netdir/data | xd -u -x2 }
  • 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
  • 26. UNIX I/O Plan 9 • •
  • 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
  • 30. drawterm • UNIX Plan 9 CPU • /mnt/term mount
  • 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
  • 33. acme:
  • 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