Recall warm-up
- Size of a MAC address?
Stuck? Peek at 2.1 Role of the data link layer: hop-to-hop delivery and MAC addresses
- Data link layer = hop-to-hop delivery of frames to the next directly connected node.
- Jobs: framing, link addressing, error detection, medium access (+ error/flow control).
- MAC address: 48 bits, 6 bytes, 12 hex digits; 24-bit vendor prefix; flat.
- A new frame (new MAC addresses) is built on every link; the packet inside is unchanged.
- Foundation: bit stuffing inserts a 0 after five consecutive 1s.
- T_t of a 1500-byte frame at 100 Mbps?
Stuck? Peek at 1.3.1 Bandwidth, data rate, throughput and transmission delay
- Bandwidth / data rate B = link capacity in bps (decimal prefixes).
- Tt = L / B (L in bits) — independent of distance.
- Throughput = bits delivered / time ≤ min link rate on the path (bottleneck).
- a ⊕ a = ?
Stuck? Peek at 0.2.3 XOR, 1's complement addition and modulo-2 division
- AND (mask), OR, NOT (flip), XOR (1 where bits differ).
- a ⊕ a = 0, a ⊕ 0 = a, (a ⊕ k) ⊕ k = a.
- 1's complement = flip all bits; 1's-complement addition wraps the end carry back in.
- Modulo-2: + = − = XOR, no carries; bits ↔ polynomial.
- Mod-2 division: leading 1 → XOR divisor; leading 0 → XOR zeros; remainder = (divisor length − 1) bits.
The Hook
When you read back a phone number, you might add "and the digits add up to 32" so the listener can catch a mistake. Networks do the same: the sender adds a few extra check bits computed from the data; the receiver recomputes them. If they disagree, something was damaged. The cheapest check is a single bit.
Predict First
The sender adds one bit so that every frame contains an even number of 1s. Two bits flip on the way. Will the receiver notice?
,No. Two flips keep the count of 1s even, so the check still passes. A single parity bit detects every odd number of flipped bits and misses every even number.
Core Concept
Kinds of errors
- Single-bit error: exactly one bit flipped.
- Burst error: several bits damaged in a row. The burst length is counted from the first damaged bit to the last damaged bit, inclusive — the bits in between may or may not be flipped.
On fast links, noise lasts longer than one bit time, so bursts are the common case.
Redundancy: dataword and codeword
1-D (simple) parity
Detects all errors that flip an odd number of bits; misses all even-numbered flips. Cost: 1 bit per dataword.
2-D parity
Arrange the data in rows; add a parity bit to every row and every column (plus one corner bit). A single flipped bit breaks exactly one row check and one column check, so the receiver can locate and correct it.
- Detects all 1-, 2- and 3-bit errors.
- Corrects any single-bit error.
- Misses some 4-bit errors: four flips on the corners of a rectangle leave every row and column even.
| c1 | c2 | c3 | c4 | row parity | |
|---|---|---|---|---|---|
| row 1 | 1 | 1 | 0 | 0 | 0 |
| row 2 | 1 | 0 | 1 | 1 | 1 |
| row 3 | 0 | 1 | 1 | 1 | 1 |
| col parity | 0 | 0 | 0 | 0 | 0 |
Putting it together
- Errors are single bits or bursts; detection needs redundant bits.
- One parity bit catches odd numbers of flips only.
- 2-D parity catches up to 3 flips and corrects 1.
Visual
Worked Examples
Find the even and the odd parity bit for 1011001.
Show the full solution
Four 1s. Even parity: 0 (already even). Odd parity: 1.
Compute 2-D even parity for the rows 1100, 1011, 0111.
Show the full solution
Row parities: 1100 → 0, 1011 → 1, 0111 → 1. Columns: (1,1,0) → 0, (1,0,1) → 0, (0,1,1) → 0, (0,1,1) → 0. Corner (parity of the row parities 0,1,1) = 0. Check bits: rows 011, columns 0000, corner 0.
A 28-bit block is arranged as 4 rows × 7 columns with 2-D even parity. (a) How many check bits are added? (b) Which of these error patterns are always detected: a single flip; any 3 flips; 4 flips at the corners of a rectangle?
Show the full solution
(a) 4 row bits + 7 column bits + 1 corner = 12 check bits.
(b) Single flip: always detected (and correctable). Any 3 flips: always detected — some row or column ends up with an odd change. Rectangle of 4: not detected — every row and every column has exactly two flips.
GATE Traps
- Burst length counts from the first to the last damaged bit, including undamaged bits in between.
- Simple parity misses every even number of flips, including 2.
- 2-D parity can correct only a single-bit error; it can detect but not locate two errors.
Memory Hook
"Parity counts heads: an odd number of coin flips always shows; an even number hides."
Connect the Dots
Parity uses very few check bits, but its power is limited. Next (2.2.2): how do we measure how many errors any code can detect or correct? By counting how far apart its codewords are.
Self-Test
- MCQ
Even parity bit for 1101011?
- 1
- 0
- cannot be determined
- 2
- MSQ
A single even-parity bit detects which of these?
- 1 flipped bit
- 2 flipped bits
- 3 flipped bits
- 4 flipped bits
- NAT
Bits 2 and 9 of a frame are flipped (and nothing else). Burst length?
Write your answer before opening the key.
- NAT
Check bits added by 2-D parity on a 6 × 8 block?
Write your answer before opening the key.
- MCQ
Which error pattern can 2-D parity fail to detect?
- One flipped bit
- Two flipped bits in the same row
- Three flipped bits
- Four flipped bits at the corners of a rectangle
Rule Card
- Single-bit vs burst; burst length = first to last damaged bit inclusive.
- Codeword = dataword (k) + r check bits.
- 1-D parity: detects odd numbers of flips only.
- 2-D parity: R + C + 1 check bits; detects all 1–3-bit errors, corrects 1, misses some 4-bit rectangles.
Concept Ledger
- single-bit error
- burst error, burst length
- redundancy, dataword, codeword
- even / odd parity
- 1-D parity
- 2-D parity
Answer Vault
Try the questions first. Open when you are ready to check.
Warm-up answers
- 48 bits.
- 120 µs.
- 0.
Self-test answers
- A — 1101011 has five 1s (an odd count), so the even-parity bit is 1, making six.
- B: 0 would leave five 1s — odd.
- C: Always determined by counting 1s.
- D: A bit is 0 or 1.
- AC — Odd numbers of flips change the parity.
- B: Even number of flips keeps parity.
- D: Even number of flips keeps parity.
- 8 — From bit 2 to bit 9 inclusive: 8.
- 15 — 6 + 8 + 1 = 15.
- D — A rectangle leaves every row and column with two flips.
- A: Always detected.
- B: Their columns change.
- C: Some row or column ends odd.
Flashcards
- What does 1-D parity detect?
Reveal answer
Any odd number of flipped bits. - 2-D parity check bits for R × C?
Reveal answer
R + C + 1. - Burst length definition?
Reveal answer
From the first damaged bit to the last damaged bit, inclusive.
Exam shortcuts
- 1-D parity detects error ⇔ the number of flipped bits is odd. — one parity bit over the whole dataword, even or odd convention.
- 2-D parity check bits for an R × C block = R + C + 1. — one parity bit per row and per column plus the corner bit.