Plan 9 - PowerPoint PPT Presentation

About This Presentation
Title:

Plan 9

Description:

8c for Intel, kc for SPARC, ... ANSI C goodies (inheritance, ... After all, Unix took 10 years to catch on... (in a world without Windows nor Linux though) ... – PowerPoint PPT presentation

Number of Views:175
Avg rating:3.0/5.0
Slides: 33
Provided by: webYlIs
Category:
Tags: plan

less

Transcript and Presenter's Notes

Title: Plan 9


1
(No Transcript)
2
Plan 9
  • Worst movie ever made (by Ed Wood)
  • An operating system and associated utilities (by
    the people who made Unix and C)
  • Three design principles
  • Resources are represented as file trees
  • Resources are privately assembled by processes
  • Resources are accessed by a standard protocol
  • Inferno is a light version of Plan 9

3
Outline
  1. A typical Plan 9 installation
  2. A traditional file server
  3. Some unusual file servers
  4. Namespace
  5. Overview of the 9P protocol
  6. User interface
  7. Programming under Plan9
  8. The Inferno operating system
  9. The Limbo programming language

4
A Typical Plan 9 Installation
Fiber Network
CPU server
File server
CPU server
Ethernet
Gateway
Terminal
Terminal
Terminal
5
The File System
Emelie
WORM media
SCSI disks
6
The Backup Service
grep mouse bug fix 2000//sys/src/cmd/rio/file
.c bind /n/dump/2000/0416/sys/include
/sys/include
/n
/dump
/2001
50
0418
0416
0417
60
70
usr
usr
usr
80
90
glenda
glenda
glenda
100
foo
foo
foo
7
The File Metaphor
  • Unix most things are files
  • ? /dev/tty network interfaces
  • ? /proc X Windows
  • Plan 9 everything is a file
  • ? emelie ? window system
  • ? backup ? text editor
  • ? /dev/cons ? ftp
  • ? /prog ? tar
  • ? network interfaces ?

8
Console Device /dev or c
  • Keyboard input/output, miscellaneous information
  • /dev/cons is the equivalent of /dev/tty
  • /dev/time current date
  • /dev/cputime process computation time
  • /dev/pid process id
  • /dev/user process owner

echo newtime gt /tmp/newtime bind /tmp/newtime
/dev/time
9
Environment Device /env or e
  • Environment variables and their values
  • /env/prompt users prompt

cd e echo newprompt gt prompt
10
Network Protocols over IP /net or I
  • /net/dns domain name lookup
  • A machine with a Datakit interface can use the
    TCP interface of another machine

echo www.yahoo.co.jp!http gt /net/dns
import harp /net telnet tcp!www.yahoo.co.jp
11
Network Protocols over IP /net or I
  • /net contains one directory per protocol

cd /net/tcp cat clone cd 0 echo connect
ip_address!port_number gt ctl
I
udp
tcp
clone
0
ctl
status
data
local
remote
listen
12
Running Programs /prog or p
  • /prog is the equivalent of Linux /proc
  • Remote debugging
  • A raw ps command

import harp /proc db /prog/0/text /prog/0/mem
cat /prog//status
13
Graphics Device /dev or d
  • This device serves an interface to
  • The graphics system
  • The window system (rio)

cat /dev/draw/new cd 0 lc ctl data refresh
colormap
echo new dx 200 dy 400 cd /sys/src/cmd sam gt
/dev/wctl lp /dev/wsys/0/window
14
Serial Communication Control /dev or t
  • Command a serial port
  • of a machine running Linuxs Inferno
  • from another running Windows Inferno

mount tcp!piccolo.is.s.u-tokyo.ac.jp!styx/n/lin
ux bind /n/linux/dev/eia0ctl /dev/eia0ctl
echo b1200 gt /dev/eia0ctl
15
A Per-process Namespace
  • User processes construct namespace using
  • mount
  • bind
  • union
  • unmount
  • Most services are conventionally located
  • Comparison
  • Unix a global mount table for all processes
  • Plan 9 a mount table per process stored in the
    kernel

mount table from_file to_file /bin /cputyp
e/bin, /rc/bin /n/remote tcp!piccolo.is.s.u-tokyo.
ac.jp!9p
16
(No Transcript)
17
The 9P Protocol
  • The (invisible) glue that holds Plan 9 together
  • Similar to NFS
  • Composed of 17 messages
  • 3 for authentication
  • 14 for object manipulation
  • 14 pages long description

18
9P Transaction
9P client
9P server
the clients kernel
user process
Tsession
mount(tcp!ip_address)
Tattach 50
Rattach 100
Tclone 50 70
Twalk 70 dev
open(/dev/cons, OREAD)
Twalk 70 cons
Topen 70
Ropen 120
mount table fid qid 50 100 70 120
19
9P Authentication
9P client
9P server
authorizationserver
the clients kernel
user process
Tsession ()
challenge_c
Rsession ()
challenge_s,id_s
challenge_s, id_s,id_c
key_cchallenge_s, id_c, nonce
Ok, id_c can speak to id_s
noncechallenge_s
Ok, id_c isauthenticated
key_schallenge_s, id_c, nonce
Tattach ()
Ok, id_s isauthenticated
Rattach ()
noncechallenge_c
20
(No Transcript)
21
Programming
  • New C compilers
  • 8c for Intel, kc for SPARC,
  • ANSI C goodies (inheritance, )
  • Simplified preprocessor (no if, )
  • No nested include files
  • Smaller library
  • Slightly difference syntax (nil, void main ())
  • Preprocessing, parsing, register allocation, code
    generation, assembly

22
Programming
  • A new make mk
  • Simplified
  • New Linkers
  • 8l, kl,
  • Perform instruction selection, branch folding,
    instruction scheduling, executable writing
  • Dont require indications on which library to
    load
  • Dont do dynamic linking!
  • A new debugger acid
  • A new shell rc

23
The File Hierarchy
  • /386/bin Intel binaries
  • /386/include machine dependent
  • /acme acme programs
  • /adm administrative data
  • /dev/drivers device drivers built into the
    kernel
  • /lib databases
  • /lib/keyboard Unicode shortcuts
  • /lib/ndb networking data
  • /mnt user file servers
  • /mnt/plumb plumbing rules
  • /mnt/acme acme configuration
  • /mnt/keys shortcuts
  • /n archives and remote systems
  • /n/tapefs archives
  • /n/ftp ftpfs
  • /n/harp remote system
  • /sys/include machine independent headers
  • /sys/src/9/fs file server
  • /sys/src/9/port portable part of the kernel
  • /sys/src/9/pc Intel specific part of the kernel
  • /sys/src/9/pc/devxxx.c device drivers
  • /sys/src/libc libc
  • /sys/src/libdraw graphics library
  • /sys/src/libio buffered io
  • /usr users

24
User Interface
  • Commands Unix-like
  • Text edition cat, ed, sam, acme
  • Unicode everywhere
  • Mouse centric
  • no cursor-addressed programs
  • 3 buttons unavoidable (chored actions)
  • Plumbing
  • text-based inter application mechanism

25
(No Transcript)
26
(No Transcript)
27
Inferno
  • A small Plan 9
  • Can run
  • As the native operating system
  • As a hosted operating system
  • As a plug-in for Internet Explorer
  • A different looking
  • wm/wm and prefab window managers
  • Graphics with Tk
  • Mostly open source

28
Limbo
  • User applications run above the DIS virtual
    machine
  • A C-like language that compile to bytecodes and
    that run
  • Over the VM (30/40 times slower than C)
  • JIT compilation (2/3 times slower than C)

29
Limbo
  • Garbage collection
  • References counting
  • A special keyword for cyclic data structures
  • Exceptions
  • Dynamically loaded modules
  • OS interface in sys (written in C)
  • Tk 4.0 in draw (written in Limbo)

30
Limbo Syntax
  • Pascal-like type declaration
  • x int
  • x 42
  • C-like assignments
  • Constants
  • EOF con 1
  • Enumeration
  • enum Red, Blue, con iota
  • Strings are not \0 terminated

31
Limbo Data Types
  • Array slices
  • y x13
  • Explicit type cast
  • b byte 20
  • str string 99
  • Lists, tuples
  • Abstract data types can contain functions
  • A ref keyword to build reference out of values

32
Limbo Data Types
  • Return values can be tuples

foo (iint) (int, string) if (good) return
(42, nil) else return (0, error code)
(val, err) foo (x) if (err ! nil) process
(val) else print (err)
33
Limbo Concurrent Programming
  • Thread
  • Start spawn function_name
  • Exit by exit
  • Communication by send/receive above channels
  • channel lt- value
  • value lt- channel

34
Compatibility Issues
  • Compatibility is not an issue (sic)
  • However
  • vt provides vt100 terminals emulation
  • APE ANSI POSIX Environment (ape/psh POSIX
    shell, /bin/cpp an ANSI C preprocessor, cc an
    ANSI C compiler)
  • vnc to use remote X application
  • wm/brutus emulates emacs under Inferno
  • drawterm to use CPU and file servers from Unix
    or Windows
  • u9fs runs on NFS machines and understand 9P
  • Plan 9 has an implementation of X

35
Conclusion
  • My 2? Small implementations suitable for
    educational purposes
  • Systems Software Research is Irrelevant Rob
    Pike
  • I think Plan 9 was a great idea and it shouldve
    been released under an open-source license when
    it was first done, eight years ago () Brian
    Kernighan
  • After all, Unix took 10 years to catch on (in a
    world without Windows nor Linux though)
Write a Comment
User Comments (0)
About PowerShow.com