22
Naming CSCI 4780/6780

Naming CSCI 4780/6780. Attribute-based Naming Flat and structured names provide location transparency Structured names are also human-friendly Increasingly,

Embed Size (px)

Citation preview

Page 1: Naming CSCI 4780/6780. Attribute-based Naming Flat and structured names provide location transparency Structured names are also human-friendly Increasingly,

Naming

CSCI 4780/6780

Page 2: Naming CSCI 4780/6780. Attribute-based Naming Flat and structured names provide location transparency Structured names are also human-friendly Increasingly,

Attribute-based Naming

• Flat and structured names provide location transparency

• Structured names are also human-friendly

• Increasingly, users and application want to locate for resources based on features, contents, characteristics• Web search• P2P search

Page 3: Naming CSCI 4780/6780. Attribute-based Naming Flat and structured names provide location transparency Structured names are also human-friendly Increasingly,

Attribute-based Naming

• Describe entities as (attribute, value) pairs

• Queries specify constraints on attributes

• In P2P music search:• Title = “Four seasons”

• Composer = “Vivaldi”

• Orchestra = “Royal Philharmonic”

Page 4: Naming CSCI 4780/6780. Attribute-based Naming Flat and structured names provide location transparency Structured names are also human-friendly Increasingly,

Directory Services• Naming systems for attribute-based names

• Entities associated with a set of attributes that are searchable

• Resource description framework (RDF)• Triplet consisting of (subject, predicate, object)

• Subjects, predicates and objects can themselves be resources

• Obtain information about subject using predicates and objects

• RDFs can be implemented in a distributed fashion, but costs can be quite high

Page 5: Naming CSCI 4780/6780. Attribute-based Naming Flat and structured names provide location transparency Structured names are also human-friendly Increasingly,

LDAP• Lightweight Directory Access Protocol

• Hierarchical implementation• Combines structured naming and attribute-based naming

• Consists of number of records• Collection of (attribute, value) pairs

• Single-valued and multiple-valued attributes

• Directory Information Base (DIB) – Collection of directory entries

• Relative Distinguished Name

/C=NL/O=Vrije Universiteit/OU=Comp. sc.

Page 6: Naming CSCI 4780/6780. Attribute-based Naming Flat and structured names provide location transparency Structured names are also human-friendly Increasingly,

LDAP Directory Entry

Page 7: Naming CSCI 4780/6780. Attribute-based Naming Flat and structured names provide location transparency Structured names are also human-friendly Increasingly,

Directory Information Tree

Page 8: Naming CSCI 4780/6780. Attribute-based Naming Flat and structured names provide location transparency Structured names are also human-friendly Increasingly,

LDAP

Two directory entries having Host_Name as RDN.

Page 9: Naming CSCI 4780/6780. Attribute-based Naming Flat and structured names provide location transparency Structured names are also human-friendly Increasingly,

Lookups in LDAP• Read – Reads a particular entry

• List – Lists all outgoing edges from a node

• LDAP implementation is similar to DNS implementation

• Supports richer sets of queries

Search(“&(C=NL)(O=Vrije Universiteit)(OU=*)(CN = Main Server)

• Searching is expensive

• Research on DHT-based implementation of attribute-based naming

Page 10: Naming CSCI 4780/6780. Attribute-based Naming Flat and structured names provide location transparency Structured names are also human-friendly Increasingly,

Synchronization

CSCI 4780/6780

Page 11: Naming CSCI 4780/6780. Attribute-based Naming Flat and structured names provide location transparency Structured names are also human-friendly Increasingly,

Importance of Clocks & Synchronization

• Avoiding simultaneous access of resources– Cooperate to grant exclusive access for small durations

• Process may need to agree upon ordering of events– First person to complete assignment will receive bonus– How to infer who completed first?

• Synchronization & ordering is difficult in distributed setting

Page 12: Naming CSCI 4780/6780. Attribute-based Naming Flat and structured names provide location transparency Structured names are also human-friendly Increasingly,

Chapter Outline• Actual time-based synchronization

– Physical clocks– Synchronizing multiple clocks

• Relative ordering-based synchronization– Logical clocks, Lamport’s algorithm, Vector time stamps

• Global state

• Leader election algorithms (time permitting)

• Mutual exclusion in distributed systems

• Distributed transactions

Page 13: Naming CSCI 4780/6780. Attribute-based Naming Flat and structured names provide location transparency Structured names are also human-friendly Increasingly,

Clocks in Systems• Notion of time in centralized system is unambiguous

– Do a system call to get current time

• Important property of time – Always moves forward– If B executes the system call after A, B will never get a

lower value

• Many system operations need some notion of time for correctness

• Example – “Make” program in Unix– Re-compiles only files that were changed since last

compilation– What happens when there is no global agreement on time?

Page 14: Naming CSCI 4780/6780. Attribute-based Naming Flat and structured names provide location transparency Structured names are also human-friendly Increasingly,

Clock Synchronization

When each machine has its own clock, an event that occurred after another event may nevertheless be assigned an earlier time.

Page 15: Naming CSCI 4780/6780. Attribute-based Naming Flat and structured names provide location transparency Structured names are also human-friendly Increasingly,

System Clocks & Clock Skew• Almost all computers have clocks (timers)

• A precisely cut quartz crystal kept under tension– Oscillates at a well-defined frequency

• Two registers – Counter & holding register– Each oscillation of crystal decrements counter by 1– Interrupt when counter is zero & reload from holding reg.– Each interrupt is a tick

• Clocks at multiple CPUs cannot be guaranteed to oscillate at exact same frequency

• Difference between various clocks – Clock Skew

Page 16: Naming CSCI 4780/6780. Attribute-based Naming Flat and structured names provide location transparency Structured names are also human-friendly Increasingly,

How is Time Actually Measured?• Solar time – Based on earth’s rotation

– Transit of sun: Sun reaching the highest apparent in sky

– Solar day: Time b/w two consecutive sun transits

– Solar second: 1/86400th of a solar day

– Mean solar second: 1/86400th of a mean solar day

• Atomic time– Second: Time for cesium-133 atom to make 9,192,631,770

transitions

– International atomic time (TAI)

• Leap seconds to resolve difference b/w TAI & solar time (UTC)

• NIST broadcasts UTC on radio station (WWV)

Page 17: Naming CSCI 4780/6780. Attribute-based Naming Flat and structured names provide location transparency Structured names are also human-friendly Increasingly,

Physical Clocks (1)

Computation of the mean solar day.

Page 18: Naming CSCI 4780/6780. Attribute-based Naming Flat and structured names provide location transparency Structured names are also human-friendly Increasingly,

Physical Clocks (2)

TAI seconds are of constant length, unlike solar seconds. Leap seconds are introduced when necessary to keep in phase with

the sun.

Page 19: Naming CSCI 4780/6780. Attribute-based Naming Flat and structured names provide location transparency Structured names are also human-friendly Increasingly,

Clock Synchronization Algorithms

• Two related problems– If one machine has WWV receiver: synchronize all

machines to machine with the WWV receiver– No WWV receiver: Keep all machines relatively

synchronized

• Many algorithms with some key assumptions– Each machine has timer that causes interrupt H times/sec– Increments software clock on each interrupt

– Cp(t) indicates clock value when UTC time is t

– In ideal world dC/dt = 1

Page 20: Naming CSCI 4780/6780. Attribute-based Naming Flat and structured names provide location transparency Structured names are also human-friendly Increasingly,

Drift & Max. Drift Rate

The relation between clock time and UTC when clocks tick at different rates.

• In real world dC/dt is not one

• Maximum drift rate: ρ such that 1- ρ ≤ dC/dt ≤ 1 + ρ– Specified by manufactures

Page 21: Naming CSCI 4780/6780. Attribute-based Naming Flat and structured names provide location transparency Structured names are also human-friendly Increasingly,

Clock Synchronization Algorithms• Two clocks drifting from UTC in opposite

directions at rate of ρ need to be synchronized every δ/2ρ secs.

• Christian’s Algorithm:– Suited when one machine has WWV receiver– Each machine sends a request to time server periodically

(period < δ/2ρ ) seconds– Time server responds with its current time (CUTC)

• Simple scheme– Set receivers time to CUTC

– Two problems• Clock might run backward !!!• Doesn’t consider processing time

Page 22: Naming CSCI 4780/6780. Attribute-based Naming Flat and structured names provide location transparency Structured names are also human-friendly Increasingly,

Cristian's Algorithm• Introduce change gradually – Reduce time by a small

amount

(T2 – T1) + (T4 - T3)

θ = T3 + ---------------------------- - T4

2