Вы находитесь на странице: 1из 50
Networks and Operating Systems Cha pter 11 : Namin g (252 ‐ 0052 ‐ 00)
Networks and Operating Systems Cha pter 11 : Namin g (252 ‐ 0052 ‐ 00)

Networks and Operating Systems Cha pter 11: Namin g

(252005200)

Gustavo Alonso & Timothy Roscoe Frühjahrssemester 2010

© Systems Group | Department of Computer Science | ETH Zürich

Overview:

Naming in Computer Systems

Introduction

Indirection

Binding

Naming model

Scheme, namespace, etc.

– Binding • Naming model – Scheme, namespace, etc. • Naming operations • Types of lookup
– Binding • Naming model – Scheme, namespace, etc. • Naming operations • Types of lookup

Naming operations

Types of lookup

Default and explicit contexts, qualified names

Path names, naming networks, recursive resolution

Multiple lookup

Name discover y

Introduction

Introduction
Introduction

Background

Much of this lecture is from Chapter 2 of Saltzer and Kaashoek

Namin g is much sim p ler in Computer Science (and Mathematics) than the real world!

Evidence:

(and Mathematics) than the real world! • Evidence: – Course in General Lin guistics (Ferdinand de
(and Mathematics) than the real world! • Evidence: – Course in General Lin guistics (Ferdinand de
(and Mathematics) than the real world! • Evidence: – Course in General Lin guistics (Ferdinand de

Course in General Lin guistics (Ferdinand de Saussure)

A Theory of Semiotics (Umberto Eco)

Philosophy from Wittgenstein onwards

Background

Background • Nevertheless: namin g in computer systems is: – Complex – Fundamental • Computer systems
Background • Nevertheless: namin g in computer systems is: – Complex – Fundamental • Computer systems

Nevertheless: namin g in computer systems is:

Complex

Fundamental

Computer systems are composed of many, many layers of different name systems.

Goal of today

Goal of today • Ex p lain namin g concepts and patterns in systems • Give
Goal of today • Ex p lain namin g concepts and patterns in systems • Give

Ex p lain namin g concepts and patterns in systems

Give you a toolkit for

Understanding

Designing

complex computer systems in terms of names

Basics:

We need to name o bjects

Basics: We nee d to name o bjects Socket clientSocket = new Socket("hostname", 6789); Give it
Basics: We nee d to name o bjects Socket clientSocket = new Socket("hostname", 6789); Give it

Socket clientSocket = new Socket("hostname", 6789);

Give it a name
Give it a name
Create a new object
Create a new
object

Naming provides indirection

Naming provides indirection DataOutputStream outToServer = new DataOutputStream(clientSocket.getOutputStream()); Could
Naming provides indirection DataOutputStream outToServer = new DataOutputStream(clientSocket.getOutputStream()); Could

DataOutputStream outToServer = new DataOutputStream(clientSocket.getOutputStream());

Could be any socket we have now
Could be any socket
we have now

Indirection

Indirection • Well ‐ known quote by David Wheeler: “ All problems in com p uter
Indirection • Well ‐ known quote by David Wheeler: “ All problems in com p uter

Wellknown quote by David Wheeler:

All problems in computer science can be solved by another level of indirection”

Might be less elegantly paraphrased as:

“Any problem in computer science can be recast as a sufficiently complex naming problem”

Binding

Binding • The association between a name and a value is called a binding . •
Binding • The association between a name and a value is called a binding . •

The association between a name and a value is called a binding .

In most cases, the binding isn t immediately visible

Most peopl e mi ss it, or don’ t know it exi sts

Often conflated with creating the value itself

Sometimes bindings are explicit , and are objects themselves.

A General Naming Model
A General Naming Model

A General Naming Model

A general model of naming

A general model of naming • Designer creates a namin g scheme . 1. Name space:
A general model of naming • Designer creates a namin g scheme . 1. Name space:

Designer creates a namin g scheme.

1. Name space: what names are valid?

2 . Universe of values: what values are valid?

3. Name mapping algorithm: what is the association of names to va lues?

Mapping algorithm also known as a resolver

Requires a contex t

General model

General model N1 N2 Name ma pp in g algorithm Foo N3 N4 Bar Gronk N5
N1 N2 Name ma pp in g algorithm Foo N3 N4 Bar Gronk N5 N6
N1
N2
Name ma pp in g
algorithm
Foo
N3
N4
Bar Gronk
N5
N6
N7
Baz
Context A

Context

Context • “ you ”, “ here ”, “ Herr Blocher ” are names that require
Context • “ you ”, “ here ”, “ Herr Blocher ” are names that require

“ you ”, “ here”, “ Herr Blocher are names that require a context to be useful

Any naming scheme must have 1 context

Context may not be stated: always look for it!

Example naming scheme:

Virtua l a dd ress space

Name space:

scheme: Virtua l a dd ress space • Name space: – Virtual memory addresses (e.g. 64
scheme: Virtua l a dd ress space • Name space: – Virtual memory addresses (e.g. 64

Virtual memory addresses (e.g. 64 bit numbers)

Universe of values:

Physical memory addresses (e.g. 64 bit numbers)

Mapping algorithm:

Translation via a page table

Context:

Pa ge table root

Single vs . multiple contexts

IPv4 addresses:

Single vs . multiple contexts • IPv4 addresses: – E.g. 129.132.102.54 – Single (global) context: routable
Single vs . multiple contexts • IPv4 addresses: – E.g. 129.132.102.54 – Single (global) context: routable

E.g. 129.132.102.54

Single (global) context: routable from anywhere

Well, sort of…

ATM v irt ua l circuit/ path id entifi ers

E.g. 43:4435

Local context: only valid on a particular link/port

Many contexts!

Naming o p erations
Naming o p erations

Naming o p erations

Resolution

Basic o p eration:

Resolution • Basic o p eration: – value ← RESOLVE( name , context ) • In
Resolution • Basic o p eration: – value ← RESOLVE( name , context ) • In

value RESOLVE( name, context)

In practice, resolution mechanism depends on context:

value context.RESOLVE( name)

Resolution example

Resolution example • Problem: – How does A determine B’s MAC address given its IP address?
Resolution example • Problem: – How does A determine B’s MAC address given its IP address?

Problem:

How does A determine B’s MAC address given its IP address?

Name space:

IP a dd resses

Universe of values:

Eth ernet MAC a dd resses

Mapping algorithm:

ARP : the Address Resolution protocol

A’s IP addr: 10.10.9.41 Ethernet: 00:1f:3b:3a:73:55

B’s IP addr: 10.10.5.23 Ethernet: 00:1e:c9:74:db:63
B’s IP addr: 10.10.5.23
Ethernet: 00:1e:c9:74:db:63

ARP protocol

ARP protocol • A knows B's IP address, wants MAC address of B • A broadcasts
ARP protocol • A knows B's IP address, wants MAC address of B • A broadcasts

A knows B's IP address, wants MAC address of B

A broadcasts ARP query packet, containing B's IP address

all machines on LAN receive ARP query

B receives ARP packet , replies to A with its (B 's) physical layer address

A caches (saves) IPto physical address pairs until information becomes old (times out)

“Soft state” protocol

information times out (goes away) unless refreshed

Managing bindings

Typical o p erations:

Managing bindings • Typical o p erations: – status ← BIND( name , value , context
Managing bindings • Typical o p erations: – status ← BIND( name , value , context

status BIND( name, value , context)

status UNBIND(name, context)

May fail according to naming scheme rules

Unbind may need a value

Example

Example • Unix file system (more on this later): $ ln target new_link • B in
Example • Unix file system (more on this later): $ ln target new_link • B in

Unix file system (more on this later):

$ ln target new_link

B in d s “ new_li n k” to value o btai ne d by resolving “target” in the current context ( wor king di rectory) $ rm new_link

Removes binding of “new_link” in cwd

Actually called unlink at the system call level

Enumeration

Not always available:

list ENUMERATE( context)

Not always available: – list ← ENUMERATE( context ) • Return all the bindings (or names)
Not always available: – list ← ENUMERATE( context ) • Return all the bindings (or names)

Return all the bindings (or names) in a context

Example enumeration

$ ls

or

C:/> dir

Example enumeration $ ls or C:/> dir
Example enumeration $ ls or C:/> dir

Comparing names

Comparing names – result ← COMPARE( name1, name2 ) • But what does this mean? –
Comparing names – result ← COMPARE( name1, name2 ) • But what does this mean? –

result COMPARE(name1, name2)

But what does this mean?

Are the names themselves the same?

Are they bound to the same object?

Do they refer identical copies of one thing?

All these are different!

Requires a definition of “equality” on objects

In general, impossible…

Examples

Examples • Different names , same referent: /home/troscoe/bio.txt ~/bio.txt • Different names, same content:
Examples • Different names , same referent: /home/troscoe/bio.txt ~/bio.txt • Different names, same content:

Different names, same referent:

/home/troscoe/bio.txt

~/bio.txt

Different names, same content:

cixous.inf.ethz.ch://home/troscoe/hg/personal/websites/

eth/bio.txt

free.inf.ethz.ch://home/troscoe/public_html/bio.txt

Naming p olicy alternatives
Naming p olicy alternatives

Naming p olicy alternatives

How many values for a name? (i n a s i ngl e context)

How many values for a name? (i n a s i ng l e context) •
How many values for a name? (i n a s i ng l e context) •

If 1, ma pp in g is injective or “ 11”

Car number plates

Virtual memory addresses

Otherwise: multiple values for a name

Phone book (people have more than 1 number)

DNS names (can return multiple ‘A’ records)

How many names for a value?

How many names for a value? • Only one name for each value – Names of
How many names for a value? • Only one name for each value – Names of

Only one name for each value

Names of models of car

IP protocol identifiers

M u lti p le names for th e same value

Phone book again (people sharing a home phone)

URLs (multiple links to same page)

Unique identifier spaces and sta bl e bin dings

Unique identifier spaces an d sta bl e b in d ings • At most one
Unique identifier spaces an d sta bl e b in d ings • At most one

At most one value bound to a name

Once created, bindings can never be changed

Usef ul: can always determ ine id entit y of t wo objects

Social security numbers

Ethernet MAC addresses

A8:7B:39:*:*:* Nokia corporation

A8:7B:39:DC:8C:50 Mothy’s phone’s WiFi interface

Types of looku p
Types of looku p

Types of looku p

Name mapping algorithms

1 . Table lookup

Simplest scheme

Analogy: phone book

lookup – Simplest scheme – Analogy: phone book 2. Recursive lookup (pathnames) 3 . M ultiple
lookup – Simplest scheme – Analogy: phone book 2. Recursive lookup (pathnames) 3 . M ultiple
lookup – Simplest scheme – Analogy: phone book 2. Recursive lookup (pathnames) 3 . M ultiple

2. Recursive lookup (pathnames)

3 . Multiple lookup (search paths)

Table lookup: other examples

Table lookup: other examples • Processor registers are named by small integers . • Memory cells
Table lookup: other examples • Processor registers are named by small integers . • Memory cells

Processor registers are named by small integers .

Memory cells are named by numbers.

Ethernet interfaces are named by MAC addresses

IP addresses are named by DNS names

Unix accounts are named by small (16bit) numbers (userids)

Unix userids are named by short strings

Unix sockets are named by small integers

Default and explicit contexts, qualified names
Default and explicit contexts, qualified names

Default and explicit contexts, qualified names

Where is the context ?

Where is the context ? 1. Default (im p licit): su pp lied by the resolver
Where is the context ? 1. Default (im p licit): su pp lied by the resolver

1. Default (im p licit): su pp lied by the resolver

1. Constant: built in to the resolver

2 . Variable: from current environment (state)

2. Explicit: supplied by the object

1. Per object

2. Per name (qualified name)

Constant default context

Constant default context • Universal name space : e.g. DNS • Short answer: gruyere.in.barrelfish.org –
Constant default context • Universal name space : e.g. DNS • Short answer: gruyere.in.barrelfish.org –

Universal name space:

e.g. DNS

Short answer:

gruyere.in.barrelfish.org
gruyere.in.barrelfish.org

context is the DNS root server

Longer answer:

/etc/hosts, plus DNS root server

Even longer answer:

/etc/nsswitch.conf, WINS resolver, domain search path, …

Variable default context

Variable default context • Example: current working director y $ pwd /h ome/troscoe/svn $ ls osnet/
Variable default context • Example: current working director y $ pwd /h ome/troscoe/svn $ ls osnet/

Example: current working director y

$ pwd

/home/troscoe/svn

$ ls

osnet/

$ cd osnet

$ ls

archive/

assignments/ legis/ recitation sessions/

$ ls lecture

chapter1/

chapter10/ chapter3/ chapter6/ chapter9/ chapter11/ chapter4/ chapter7/ dates.xls

$

lecture/ organisation/

svnadmin/

svn-commit.tmp

chapter2/ chapter5/ chapter8/ template.pptx

Explicit per object context

Explicit per ‐ object context • Note: context reference is a name! – Sometimes called a
Explicit per ‐ object context • Note: context reference is a name! – Sometimes called a

Note: context reference is a name!

Sometimes called a base name

Examples :

$ finger troscoe@cixous.ethz.ch

$ dig @129.132.98.12 -q a cixous.ethz.ch

$ dig @ns1.earthlink.net -q a cixous

Explicit per name context

Explicit per ‐ name context • Each name comes with its context – Actually, the name
Explicit per ‐ name context • Each name comes with its context – Actually, the name

Each name comes with its context

Actually, the name of the context

(context,name) = qualified name

Recursive resolution process:

Resolve context to a context object

Resolve name relative to resulting context

Examples:

troscoe@inf.ethz.ch

/var/log/syslog

Path names, naming networks, recursive resolution
Path names, naming networks, recursive resolution

Path names, naming networks, recursive resolution

Path names

Path names • Recursive resolution ⇒ path names • N.B. can be written forwards or backwards
Path names • Recursive resolution ⇒ path names • N.B. can be written forwards or backwards

Recursive resolution path names

N.B. can be written forwards or backwards

Examples:

Recursion must terminate:

Either at a fi xed , known contex t reference

(the root)

Or at another name, namin g a default context

Example: relative pathnames

Syntax gives clue (leading ‘/’)

Naming networks

. / usr home … . .
.
/
usr
home
.
.
troscoe alonso schuepbach …
troscoe
alonso
schuepbach
bin lib share …
bin
lib
share
Naming networks . / usr home … . . troscoe alonso schuepbach … bin lib share
Naming networks . / usr home … . . troscoe alonso schuepbach … bin lib share
Naming networks . / usr home … . . troscoe alonso schuepbach … bin lib share

Soft links

So far, names resolve to values

• “ Soft links ” So far, names resolve to values – Values may be names
• “ Soft links ” So far, names resolve to values – Values may be names

Values may be names in a different naming scheme (usually are)

Names can resolve to other names in the same scheme:

U ni x symboli c li nks ( l n – s ) , Windows “s hor t cuts ”

Forwarding addresses (Die Poste, WWW, Email)

Multiple looku p
Multiple looku p

Multiple looku p

Sometimes, one context is not enoug h…

Sometimes, one context is not enoug h… • Multi p le lookup , or “ search
Sometimes, one context is not enoug h… • Multi p le lookup , or “ search

Multi p le lookup , or search p ath

try several contexts in order

Union mounts: overlay two or more contexts

Examples:

binary directories in Unix

resolving symbols in link libraries

Somewhat controversial…

Note: “search”, but not in the Google sense…

Search path ” example

“ Search path ” example $ echo $PATH /home/troscoe/bin:/local/bin:/usr/local/bin:/usr/bin:
“ Search path ” example $ echo $PATH /home/troscoe/bin:/local/bin:/usr/local/bin:/usr/bin:

$ echo $PATH

/home/troscoe/bin:/local/bin:/usr/local/bin:/usr/bin:

/bin:/sbin:/usr/sbin:/etc:/usr/bin/X11:/etc/local:

/usr/local/sbin:/home/netos/tools/bin:/usr/bin:

/home/netos/tools/i686-pc-linux-gnu/bin

$ which rackboot.sh

/home/netos/tools/bin/rackboot.sh

$

Name Discover y
Name Discover y

Name Discover y

How to find a name in the first pl ace?

Many options:

find a name in the first pl ace? • Many options: – Well ‐ known. –
find a name in the first pl ace? • Many options: – Well ‐ known. –

Wellknown.

Broadcast the name.

Query (google search)

Broa dcast the query.

Resolve some other name to a name space

I ntroducti on

Physical rendezvous

Often reduces to another name lookup…

Warning

Warning • Don ’t get look to closely at names • Almost everything can be viewed
Warning • Don ’t get look to closely at names • Almost everything can be viewed

Don ’t get look to closely at names

Almost everything can be viewed as naming

Thi s does no t mean it s hou ld be. All problems in computer science can be solved by another level of indirection

except “

for the problem of too many layers of indirection.”

A naming model is a good servant, but a poor master.

Conclusion

Conclusion • Namin g is ever y where in Com p uter Systems – Name spaces
Conclusion • Namin g is ever y where in Com p uter Systems – Name spaces

Namin g is ever y where in Comp uter Systems

Name spaces

Contexts

Resolu tion mech an isms

When understanding a system, ask:

What are the namin g schemes?

What’s the context?

What’s the policy?

When designing a system, it will help stop you making (some) silly mistakes!