CS Atlas GATE 2027
Computer Networks course
0 / 90 complete

Computer Networks/Phase 1 · Layering, Switching & Performance

Lesson 1.1.1 · Item 10 of 90

Why layer: protocol, service, interface, peers

Read at your own pace. Try the questions before opening the answers.

On this page

Recall warm-up

  1. 5 senders each speak with probability 0.2. P(exactly one)?
    Stuck? Peek at 0.2.4 Exponents, logarithms and basic probability
    • 2ᵃ·2ᵇ = 2ᵃ⁺ᵇ; 2¹⁰ ≈ 10³ (estimates only).
    • log₂ x = power of 2 giving x; bits for N values = ⌈log₂ N⌉.
    • P(none) = (1−p)ⁿ · P(≥ 1) = 1 − (1−p)ⁿ · P(exactly 1) = n·p·(1−p)ⁿ⁻¹.
    • (1 − 1/n)ⁿ → 1/e ≈ 0.368; 1/(2e) ≈ 0.184.
    • 1 + 2 + … + 2ᵏ⁻¹ = 2ᵏ − 1; expected tries = 1/p.

    Read lesson 0.2.4

  2. 1 Mbps is how many bits per second, exactly?
    Stuck? Peek at 0.2.1 Bits, bytes and prefixes: powers of 10 for rates, powers of 2 for sizes
    • 1 B = 8 b. Lower-case b = bit, upper-case B = byte.
    • Rates: k = 10³, M = 10⁶, G = 10⁹ (bps).
    • Sizes: K = 2¹⁰, M = 2²⁰, G = 2³⁰ (bytes) — unless the question says 1000.
    • Time to push out = (size in bits) ÷ (rate in bit/s).
    • ms = 10⁻³ s, µs = 10⁻⁶ s, ns = 10⁻⁹ s.

    Read lesson 0.2.1

  3. Where does the meaning of bits come from?
    Stuck? Peek at 0.1.1 Why networks exist: hosts, links and sending data
    • Network = devices + links that exchange data.
    • Host = where a message starts or ends (laptop, phone, server).
    • Link = physical path: copper (voltage), fibre (light), wireless (radio).
    • All content → bits → signals → bits → content; meaning comes from an agreed encoding.
    • One link per pair of n hosts: n(n − 1)/2 links — too many, so links are shared.

    Read lesson 0.1.1

The Hook

Sending a letter abroad involves you (writing), the post office (sorting and stamping), the airline (flying bags), customs, and a postman at the other end. You never talk to the airline, and the pilot never reads your letter. Each party does one job and trusts the next one. Networks are built exactly like this: as a stack of layers, each doing one job for the layer above it.

Predict First

A company replaces copper cables with optical fibre. Should the e-mail program on your laptop need to change? Guess yes or no, and why.

,

No. The e-mail program only talks to the layer directly beneath it through a fixed set of requests ("send these bits to that machine"). How the bits travel — copper or light — is hidden inside lower layers. Hiding changes behind a fixed boundary is the whole point of layering.

Core Concept

The problem: one giant job

Getting a message from your laptop to a server involves turning it into bits, carrying bits across a wire, choosing a route through many networks, putting chunks back in order, and handing the result to the right program. Writing that as one huge piece of software would be impossible to build, test or upgrade. So engineers split it into layers, each solving one part of the problem.

Your programwants: "deliver this message"
…a layer that…gets it to the right program
…a layer that…finds a route across networks
…a layer that…moves it to the next box
…a layer that…turns bits into signals
One big job split into jobs stacked on top of each other.

Protocol

Protocol: the set of rules two peers (the same layer on two different machines) follow when they talk: the format of what they exchange, its meaning, and what to do in response.

This gives a name to the "agreed rules" from Lesson 0.1.1. Every layer has its own protocol, spoken only with its peer layer on the other machine.

Format
what the exchanged units look like
Meaning
what each part says
Behaviour
what to do next, and when
A protocol fixes three things.

Service and interface

  • A layer offers a service to the layer above: "give me data and an address; I will deliver it".
  • The interface is the exact set of requests the upper layer may make of the lower one at that boundary.

Rule of thumb: service = what a layer does for the layer above; protocol = how it does it with its peer; interface = where and through which calls the two adjacent layers meet.

TermBetweenQuestion it answers
Servicelayer n → layer n + 1 (same machine)What do you do for me?
Interfaceboundary between layers n and n + 1How do I ask you?
Protocollayer n ↔ layer n on another machineHow do peers cooperate?
Three words GATE likes to swap. Learn the "between" column.

Peer-to-peer (logical) vs actual flow

Each layer behaves as if it talks directly to its peer: the sender's layer 4 "talks to" the receiver's layer 4. That is logical (peer-to-peer) communication. In reality, data moves down the stack on the sender, across the physical link, and up the stack on the receiver. Only the bottom layer actually touches the wire.

Sender stackReceiver stacklayer n ↔ layer n (logical, dashed)actual: down through every lower layerbits on the wire (bottom layer only)actual: up through every layer to layer n
Peers talk logically; the real path goes down, across, and up.

Why layering wins (and what it costs)

  • Modularity: change one layer (copper → fibre) without touching the others.
  • Reuse: many programs share the same lower layers.
  • Simpler design and testing: each layer is a small problem.

Cost: each layer adds its own bookkeeping (extra bits on every message) and some duplicated work. We measure that overhead in Lesson 1.1.3.

Gains
modularity · reuse · simpler design
Costs
extra bits per message · some repeated work
Layering trades a little efficiency for a lot of simplicity.

Putting it together

  • Big job → stack of layers, each with one responsibility.
  • Peers share a protocol; neighbours share an interface; a layer offers a service upward.
  • Communication between peers is logical; actual data goes down, across, and up.

Visual

Sender machineReceiver machine
Layer 3L3⟷ protocol 3 ⟷L3
↓ interface↑ interface
Layer 2L2⟷ protocol 2 ⟷L2
↓ interface↑ interface
Layer 1L1═══ physical link ═══L1
Horizontal = protocols between peers (logical). Vertical = interfaces between neighbouring layers on one machine. Only layer 1 uses the real link.

Worked Examples

Easy

Classify each as service, interface or protocol: (a) "Layer 2 promises to deliver data to the next machine." (b) "Two layer-2 peers agree that every unit starts with a special start pattern." (c) "Layer 3 calls the function send(data, next_machine) of layer 2."

Show the full solution

(a) Service — what layer 2 does for layer 3. (b) Protocol — rules between peers. (c) Interface — the call through which layer 3 asks layer 2.

Medium

A university upgrades every link from copper to fibre. Which parts must change: the lowest layer, the programs on laptops, both?

Show the full solution

Only the lowest layer (and its peer on each neighbouring machine) changes, because only it touches the medium. The interface it offers upward stays the same, so every layer above — and every program — is untouched. That is the modularity benefit.

GATE

Which statements are correct? (i) Peers on different machines communicate directly through their own protocol over a direct physical path. (ii) A layer's service is defined independently of how its protocol works. (iii) Two adjacent layers on the same machine use a protocol to talk to each other.

Show the full solution

(i) False — peer communication is logical; the real path goes down, across the link, and up. (ii) True — the service says what, the protocol says how; the protocol can be replaced without changing the service. (iii) False — adjacent layers on one machine meet at an interface, not a protocol.

GATE Traps

  • Protocol and service are not synonyms: the service is the promise upward; the protocol is the method between peers.
  • Peer-to-peer communication in layering is logical; only the bottom layer actually sends signals.
  • Layering is not free — every layer adds bookkeeping bits to each message.

Memory Hook

"Service is the menu, interface is the waiter, protocol is the recipe the two kitchens share."

Connect the Dots

Phase 0 said bits only make sense through agreed rules; now those rules are protocols, organised in layers. Next (1.1.2): how many layers do real networks use, and which job sits in which layer?

Self-Test

  1. MCQ

    Rules followed by two peer layers on different machines are called:

    1. an interface
    2. a service
    3. a protocol
    4. a topology
  2. MSQ

    Which are benefits of layering?

    1. A layer can be changed without changing the others.
    2. Messages get shorter.
    3. Design and testing become simpler.
    4. Many programs can share the same lower layers.
  3. MCQ

    Layer 3 asks layer 2 to send data by calling a fixed set of operations. That set is the:

    1. protocol of layer 2
    2. interface between layers 2 and 3
    3. peer of layer 3
    4. physical link
  4. MCQ

    In the layered model, which layer actually transmits signals on the medium?

    1. Every layer
    2. Only the top layer
    3. Only the bottom layer
    4. Only the middle layer

Rule Card

  • Layer: one job in the stack; serves the layer above, uses the layer below.
  • Protocol: rules between peers (same layer, different machines): format, meaning, behaviour.
  • Service: what a layer does for the layer above. Interface: how the layer above asks for it.
  • Peer talk is logical; the real path is down → link → up.
  • Layering = modularity + reuse − some overhead.

Concept Ledger

  • layer
  • protocol
  • peer
  • service
  • interface
  • logical (peer-to-peer) vs actual flow

Answer Vault

Try the questions first. Open when you are ready to check.

Warm-up answers

  1. 5 × 0.2 × 0.8⁴ = 0.4096.
  2. 10⁶.
  3. From rules (an encoding) agreed in advance by sender and receiver.

Self-test answers

  1. C — Peers on different machines follow a protocol.
    • A: An interface is between adjacent layers on one machine.
    • B: A service is what a layer offers to the layer above.
    • D: Topology is the shape of the network.
  2. ACD — Modularity, simplicity and reuse.
    • B: Each layer adds bookkeeping bits, so messages get longer, not shorter.
  3. B — The calls at the boundary of two adjacent layers form the interface.
    • A: A protocol is between peers on different machines.
    • C: A peer is the same layer on another machine.
    • D: The physical link is below layer 1's job.
  4. C — Higher layers communicate logically; only the bottom layer touches the medium.
    • A: Higher layers pass data down; they do not drive the wire.
    • B: The top layer is the furthest from the wire.
    • D: Middle layers also pass data down.

Flashcards

  1. Protocol vs interface?
    Reveal answerProtocol: between peers on different machines. Interface: between adjacent layers on the same machine.
  2. Service?
    Reveal answerWhat a layer promises to do for the layer above.
  3. Which layer touches the medium?
    Reveal answerOnly the bottom (physical) layer.

Exam shortcuts

  • "Between" test: same machine, neighbouring layers → interface/service. Same layer, different machines → protocol. — any question that asks which term applies to an interaction.

Ready for the next idea?

Mark this item complete when you’ve finished reading and working through it.