Computer Engineering is coming soon

We're still writing and reviewing the notes for every subject, and we'll open it when every subject is ready. Meanwhile you can practise aptitude, ask Aria about any subject, or see the branches that are ready.

Naming

Naming maps human or application-level names to network addresses or resources in a way that supports lookup, binding, mobility, scalability and human usability in distributed systems.

Drafted with Aria, reviewed by the AiCanCode.org team · Updated . How we write and check our notes. Spotted an error? Use Give Feedback at the bottom of the page.

Why it matters

Naming is how programs and users find resources in a distributed system. Engineers use naming when building service discovery, distributed file systems, DNS-like resolvers, or middleware (for example, the CORBA Naming Service or an LDAP directory) so that programs can locate servers, files, devices and other objects without hard-coding physical addresses.

Key ideas

Start with simple definitions (every bold term is defined where first used):

  • Name: a token (string, number, or structured value) used by humans or programs to identify an object. A name by itself does not tell where the object resides. (Used throughout.)
  • Identifier: a name that is intended to be unique within some namespace. Example: a UUID. Identifiers are stable labels for an object.
  • Address (locator): information used by the network to deliver messages to the object’s current location (for example, IP address and port). An address can change if the object moves.
  • Binding: an association between a name and some value (often an address). Binding can be transient (temporary) or persistent.
  • Namespace: a set of names together with rules that determine how they are formed and how they map to objects. Examples: the DNS namespace, a file-system path namespace.
  • Name resolution / lookup: the process of taking a name and returning its current binding (e.g., an address or metadata). Aliases (indirection), such as DNS CNAME, may require resolving multiple names to reach the final address.
  • Name space service (naming service): the system (software and data) that maintains bindings and answers lookup requests.
  • Location transparency: property that allows users to reference objects by name without knowing (and being affected by) their physical location.
  • Uniqueness: a property of a naming scheme that ensures two objects do not share the same identifier (within the intended scope).

Core operations for any naming system (state exact operation names and their semantics):

  • bind(name, value): create a binding from name to value. Precondition: name must not be already bound in the target scope unless the system allows rebind.
  • lookup(name): return value(s) currently bound to name. Postcondition: either return current value(s) or indicate name not found.
  • rebind(name, newValue): atomically replace an existing binding with newValue. Precondition: name is bound.
  • unbind(name): remove the binding for name.
  • rename(oldName, newName): atomically change the label for an object; semantics depend on whether rename updates all referencing bindings or just one namespace entry.

Important properties of naming systems (exact statements):

  • Correctness condition (informal but common exam statement): "A lookup returns a value consistent with the latest completed bind or rebind for that name, subject to propagation and caching semantics." When systems use replication, the exact notion of "latest" depends on the consistency model (see other topics: Replication and consistency protocols).
  • Scalability: A naming service is scalable if its average processing cost (time, messages, or state per node) grows sub-linearly with the number of names or nodes. (Common exam derivation: contrast flat vs hierarchical vs distributed hash table schemes.)

Naming schemes (exact types and their trade-offs):

  • Flat naming: Names are single tokens with no structure (example: UUIDs, object IDs). Pros: easy uniqueness, simple binding. Cons: poor human readability, requires a global directory for lookup. Expect O(1) to O(N) search cost in naive directory; DHTs solve this with O(log N) hops on average. Assumption: a directory or distributed index exists.
  • Hierarchical naming: Names have structure and components separated by delimiters (example: /home/alice/docs/file.txt or www.example.com). Pros: human-readable, delegation of authority, good cache locality. Cons: lookups can require multi-step resolution up the hierarchy. Assumption: parent nodes or name servers exist.
  • Attribute-based naming (content-based): Names are described by attributes (metadata) rather than a single token. Lookup is by attribute query. Pros: flexible, supports searches. Cons: requires indexing, ambiguous results, harder to ensure uniqueness.
  • Location-independent identifiers + indirection: A stable identifier (like inode number or UUID) plus a separate mapping service maps IDs to current locations (addresses). This supports mobility and migration.

Resolution strategies and how they work (step descriptions to draw in exams):

  • Centralised directory: draw one server labelled "Directory" and many clients. Label arrows from clients to directory for bind and lookup. Note single-point-of-failure and scalability limits.
  • Hierarchical resolution (example DNS): draw a vertical chain of name servers: Client resolver -> local DNS -> Root -> TLD -> authoritative. Show name "www.example.co.in" and annotate each step: query to local, local caches or forwards to root, then TLD, then authoritative. Indicate possible caching at each node.
  • Distributed hash table (DHT) resolution: draw a ring of nodes labelled with node IDs; show a key k whose responsible node is found by following finger/routing tables with O(log N) hops.

Consistency and caching semantics (exact kinds and what they mean):

  • Strong binding semantics: after a bind completes, subsequent lookups that occur after the bind's completion must see the new binding. This typically requires synchronous updates or global coordination.
  • Weak/ eventual binding semantics: after a bind, lookups may return old values for some time, but all replicas will eventually converge to the new binding if no further updates occur. This is what caches with TTLs and asynchronous replication provide.
  • TTL (time-to-live): a value attached to a binding to control how long caches may consider the binding valid. Clients must re-query the authoritative source after TTL expires.

Security and administrative concerns (short exact points):

  • Authentication and authorization are required for bind/unbind operations; otherwise an attacker can spoof bindings (DNS spoofing is a classic example). Use DNSSEC or signed directories to provide data origin authentication and integrity for lookup responses.
  • Name collisions and namespace partitioning must be handled by delegation and clear administrative policies.

Assumptions that often appear in exam derivations:

  • Assume reliable transport when deriving correctness of a naming protocol unless explicitly modelling message loss.
  • When analysing lookup complexity in DHTs, assume uniform hash distribution of keys and nodes, and that routing tables are maintained correctly.

Formulas

T_lookup = T_client_proc + Σ (RTT_hop_i + T_server_proc_i) — total lookup time as sum over each network hop i; symbols: T_lookup = time for client to get a response (s), T_client_proc = client processing time (s), RTT_hop_i = round-trip time of network hop i (s), T_server_proc_i = processing time at server i (s). Applies to multi-hop hierarchical or DHT lookups.

H_hier = depth(name) — number of resolution steps for a hierarchical name (unit: steps). depth(name) = number of components that require contacting different authority servers. Applies to fully-authoritative step-by-step resolution. In DNS, for a name with L labels, the worst-case number of iterative queries is up to L+1 (including the root), though caching often reduces this.

H_dht = O(log N) — average number of overlay hops in a balanced DHT with N nodes. Symbols: H_dht = expected overlay hops (steps); N = number of nodes. Applies under uniform distribution and correct maintenance of finger tables/routing state.

CacheFreshness ≈ TTL — caches may return stale results for time up to TTL unless a push-invalidation is used. TTL (s) = time-to-live set by authoritative server.

Note: these are simple, high-level formulas useful in exam derivations; constants and exact coefficients depend on protocol implementation and network conditions.

Worked examples

Example 1 — Hierarchical DNS-like resolution (step trace): Problem: Resolve name www.college.edu.in from a resolver that has no cache entries. Steps and diagram to draw: client resolver -> root server -> ".in" TLD -> ".edu.in" authoritative -> "college.edu.in" authoritative -> final IP. Numbered steps:

  1. Client sends query to root server for NS of in.
  2. Root returns NS records for in (reply contains referral to TLD servers).
  3. Client queries one of in TLD servers for NS of edu.in.
  4. in server returns NS for edu.in.
  5. Client queries edu.in server for NS of college.edu.in or directly for A record for www.college.edu.in (depends on delegation layout).
  6. Authoritative server returns IP address for www.college.edu.in.
  7. Client caches the response for the TTL specified. Final answer: IP address (bold the IP if given). Explain where stale data could appear (cached old IPs) and where TTL controls freshness.

Example 2 — Flat naming with a simple directory (concurrency issue): Problem: Two clients concurrently call bind("X", addrA) and bind("X", addrB) without a rebind primitive; directory provides only bind and lookup. Answer (model exam solution):

  1. If bind is non-atomic and directory does not lock, a race exists: final binding depends on which bind arrives last.
  2. To ensure atomic update, directory must provide rebind(name, newValue) or use locks or version numbers: bind-with-version(oldVersion,newValue) that succeeds only if current version equals oldVersion. Show step: client reads version v, proposes v+1, server checks v, applies update atomically.
  3. Without atomicity, clients must detect conflicts (e.g., through get+compare-and-set). Final conclusion: show sequence where client A and client B see v and both attempt update — explain lost update.

Example 3 — Designing names for a distributed file system (short model answer): Question: Choose a naming scheme that supports file movement across servers and easy caching. Answer outline:

  • Use a two-level name: a human-readable path (namespace) mapped to a stable unique identifier (inode-like UUID). The namespace maps path -> UUID; mapping service maintained by a metadata server (possibly replicated). The UUID -> storage location mapping is kept separately (location service). This supports path-based lookups for users, and location independence for data migration. Discuss use of TTL on location mappings for caches and need for invalidation on migration.

Common mistakes

  • Thinking TTL guarantees freshness: TTL bounds staleness but does not eliminate windows of inconsistency caused by delay between rebind and cache expiry.
  • Overlooking concurrency: forgetting to specify atomicity for rebind/rename leads to race conditions in answers.
  • Misstating DHT cost: saying DHT lookup is O(1) instead of O(log N) (unless specialized hardware or extra state is used).

For your exam

Typical question types and what full-marks answers include:

  • Definitions: give concise definitions and short examples (Name, Address, Namespace, Binding). Mention scope when you say "unique".
  • Short notes: compare flat, hierarchical and attribute-based naming. Include pros, cons and complexity trade-offs.
  • Derivations: show the number of resolver queries for a hierarchical name of depth d (answer: d steps if no caching; draw request path). For DHTs, derive O(log N) hops using the finger table halving argument (assume node IDs are uniform).
  • Numericals: compute lookup latency using the T_lookup formula. Show each RTT and processing time, add units, provide final time in seconds or ms.
  • Programs / protocol traces: provide step-by-step traces for bind/lookup or for a DNS resolution. Label each message and its sender/receiver.
  • Diagrams: draw clients, servers or overlay nodes; label arrows with "query" and "response" and annotate caching/TTL.

What full-marks answer always must include: clear definitions, clear assumptions (e.g., assume reliable transport, TTL value, uniform distribution), step-by-step reasoning or trace, and a final statement about trade-offs or limitations.

Quick check

  1. Give one advantage and one disadvantage of hierarchical naming.
  2. What is the difference between an identifier and an address?
  3. In a DHT with N nodes, what is the average number of overlay hops to find a key (state the big-O and the assumption)?

Answers: 1) Advantage: human readability and delegation; Disadvantage: multiple lookup steps and possible latency. 2) Identifier = stable label for an object; Address = current locator used for routing/delivery. 3) O(log N) average hops, assuming uniform ID distribution and correct routing tables maintained.

Finished this topic? Mark it so your progress, study plan and readiness keep up.

Stuck on something here?