24

Plan 9 (modified from slides by Reynald Affeldt) Worst movie ever made (by Ed Wood) An operating system and associated utilities (by the people who made

  • View
    215

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Plan 9 (modified from slides by Reynald Affeldt) Worst movie ever made (by Ed Wood) An operating system and associated utilities (by the people who made
Page 2: Plan 9 (modified from slides by Reynald Affeldt) Worst movie ever made (by Ed Wood) An operating system and associated utilities (by the people who made

Plan 9 (modified from slides by Reynald Affeldt)

• 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

Page 3: Plan 9 (modified from slides by Reynald Affeldt) Worst movie ever made (by Ed Wood) An operating system and associated utilities (by the people who made

Outline

1. A typical Plan 9 installation2. A traditional file server3. Some unusual file servers4. Namespace5. Overview of the 9P protocol6. User interface7. Programming under Plan98. The Inferno operating system9. The Limbo programming language

Page 4: Plan 9 (modified from slides by Reynald Affeldt) Worst movie ever made (by Ed Wood) An operating system and associated utilities (by the people who made

A Typical Plan 9 Installation

CPU server

Terminal

File serverCPU server

Fiber Network

Ethernet

Terminal

Gateway

Terminal

Page 5: Plan 9 (modified from slides by Reynald Affeldt) Worst movie ever made (by Ed Wood) An operating system and associated utilities (by the people who made

The File System

WORM media

Emelie

SCSI disks

Page 6: Plan 9 (modified from slides by Reynald Affeldt) Worst movie ever made (by Ed Wood) An operating system and associated utilities (by the people who made

The Backup Service

/n

0418

usr

glenda

foo

/dump

/2001

5060708090100

0416

usr

foo

glenda

0417

usr

glenda

foo

% grep ‘mouse bug fix’ 2000/*/sys/src/cmd/rio/file.c…% bind /n/dump/2000/0416/sys/include /sys/include…

Page 7: Plan 9 (modified from slides by Reynald Affeldt) Worst movie ever made (by Ed Wood) An operating system and associated utilities (by the people who made

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 ○ …

Page 8: Plan 9 (modified from slides by Reynald Affeldt) Worst movie ever made (by Ed Wood) An operating system and associated utilities (by the people who made

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 > /tmp/newtime

% bind /tmp/newtime /dev/time

Page 9: Plan 9 (modified from slides by Reynald Affeldt) Worst movie ever made (by Ed Wood) An operating system and associated utilities (by the people who made

Environment Device: /env or #e

• Environment variables and their values• /env/prompt: user’s prompt

% cd ‘#e’

% echo newprompt > prompt

Page 10: Plan 9 (modified from slides by Reynald Affeldt) Worst movie ever made (by Ed Wood) An operating system and associated utilities (by the people who made

• /net/dns: domain name lookup

• A machine with a Datakit interface can use the TCP interface of another machine

Network Protocols over IP: /net or #I

% echo www.yahoo.co.jp!http > /net/dns

% import harp /net

% telnet tcp!www.yahoo.co.jp

Page 11: Plan 9 (modified from slides by Reynald Affeldt) Worst movie ever made (by Ed Wood) An operating system and associated utilities (by the people who made

Network Protocols over IP: /net or #I

#I

tcp

clone 0

ctl status data

udp

local remote listen

% cd /net/tcp% cat clone% cd 0% echo connect ip_address!port_number > ctl

• /net contains one directory per protocol

Page 12: Plan 9 (modified from slides by Reynald Affeldt) Worst movie ever made (by Ed Wood) An operating system and associated utilities (by the people who made

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

Page 13: Plan 9 (modified from slides by Reynald Affeldt) Worst movie ever made (by Ed Wood) An operating system and associated utilities (by the people who made

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 > /dev/wctl

% lp /dev/wsys/0/window

Page 14: Plan 9 (modified from slides by Reynald Affeldt) Worst movie ever made (by Ed Wood) An operating system and associated utilities (by the people who made

Serial Communication Control: /dev or #t

• Command a serial port – of a machine running Linux’s Inferno– from another running Windows’ Inferno

% mount tcp!piccolo.is.s.u-tokyo.ac.jp!styx/n/linux

% bind /n/linux/dev/eia0ctl /dev/eia0ctl

% echo b1200 > /dev/eia0ctl

Page 15: Plan 9 (modified from slides by Reynald Affeldt) Worst movie ever made (by Ed Wood) An operating system and associated utilities (by the people who made

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 tablefrom_file to_file/bin /$cputype/bin, /rc/bin/n/remote tcp!piccolo.is.s.u-tokyo.ac.jp!9p

Page 16: Plan 9 (modified from slides by Reynald Affeldt) Worst movie ever made (by Ed Wood) An operating system and associated utilities (by the people who made

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

9P

UDP TCP ILFiber

IP

URP

DK

Page 17: Plan 9 (modified from slides by Reynald Affeldt) Worst movie ever made (by Ed Wood) An operating system and associated utilities (by the people who made

9P Transaction

Tattach 50

Tclone 50 70Twalk 70 “dev”

Twalk 70 “cons”Topen 70

Rattach 100

mount(“tcp!ip_address”)

mount tablefid

qid50

10070

120

9P client 9P server

Ropen 120

Tsession

open(“/dev/cons”, OREAD)

the client’s kerneluser process

100

110

120

file tree

Page 18: Plan 9 (modified from slides by Reynald Affeldt) Worst movie ever made (by Ed Wood) An operating system and associated utilities (by the people who made

9P Authenticationthe client’s kernel

9P server

user processauthorization

server

challenge_c

challenge_s,id_s

challenge_s, id_s,id_c

key_c{challenge_s, id_c, nonce}

key_s{challenge_s, id_c, nonce}

nonce{challenge_s}

nonce{challenge_c}

Tattach ()

Rattach ()

Rsession ()

Tsession ()

9P client

Ok, id_c can speak to id_s

Ok, id_c isauthenticated

Ok, id_s isauthenticated

Page 19: Plan 9 (modified from slides by Reynald Affeldt) Worst movie ever made (by Ed Wood) An operating system and associated utilities (by the people who made

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

Page 20: Plan 9 (modified from slides by Reynald Affeldt) Worst movie ever made (by Ed Wood) An operating system and associated utilities (by the people who made

Programming

• A new make: mk– Simplified

• New Linkers– 8l, kl, …– Perform instruction selection, branch folding,

instruction scheduling, executable writing– Don’t require indications on which library to load– Don’t do dynamic linking!

• A new debugger: acid• A new shell: rc

Page 21: Plan 9 (modified from slides by Reynald Affeldt) Worst movie ever made (by Ed Wood) An operating system and associated utilities (by the people who made

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

Page 22: Plan 9 (modified from slides by Reynald Affeldt) Worst movie ever made (by Ed Wood) An operating system and associated utilities (by the people who made
Page 23: Plan 9 (modified from slides by Reynald Affeldt) Worst movie ever made (by Ed Wood) An operating system and associated utilities (by the people who made

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

Page 24: Plan 9 (modified from slides by Reynald Affeldt) Worst movie ever made (by Ed Wood) An operating system and associated utilities (by the people who made

Limbo

• User applications run above the DIS virtual machine

• A C-like language that compiles to bytecodes and that runs– Over the VM (30/40 times slower than C)– JIT compilation (2/3 times slower than C)