2019 term 3 tele3118: network technologies · network technologies 1c-15 n single shared broadcast...

33
2019 term 3 TELE3118: Network Technologies Week 1: Data Link Layer Framing, Error Control, Multiple Access Some slides have been taken from: qComputer Networking: A Top Down Approach Featuring the Internet, 7 th edition. Jim Kurose, Keith Ross. Addison-Wesley, 2016. All material copyright 1996-2016. J.F Kurose and K.W. Ross, All Rights Reserved. qComputer Networks, 5 th edition. Andrew S. Tanenbaum. Prentice-Hall, 2010.

Upload: others

Post on 19-Mar-2020

2 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: 2019 term 3 TELE3118: Network Technologies · Network Technologies 1c-15 n single shared broadcast channel n two or more simultaneous transmissions by nodes: interference q collisionif

2019 term 3TELE3118: Network Technologies

Week 1: Data Link Layer Framing, Error Control, Multiple Access

Some slides have been taken from:qComputer Networking: A Top Down Approach Featuring the Internet, 7th edition. Jim Kurose, Keith Ross. Addison-Wesley, 2016. All material copyright 1996-2016. J.F Kurose and K.W. Ross, All Rights Reserved.qComputer Networks, 5th edition. Andrew S. Tanenbaum. Prentice-Hall, 2010.

Page 2: 2019 term 3 TELE3118: Network Technologies · Network Technologies 1c-15 n single shared broadcast channel n two or more simultaneous transmissions by nodes: interference q collisionif

Link layer: introduction

1c-2

terminology:n hosts and routers: nodesn communication channels

that connect adjacent nodes along communication path: linksq wired linksq wireless linksq LANs

n layer-2 packet: frame, encapsulates datagram

Network Technologies

data-link layer has responsibility of transferring datagram from one node to physically adjacent node over a link

Page 3: 2019 term 3 TELE3118: Network Technologies · Network Technologies 1c-15 n single shared broadcast channel n two or more simultaneous transmissions by nodes: interference q collisionif

Where is the link layer implemented?

1c-3Network Technologies

n in each and every hostn link layer implemented in “adaptor” (aka network interface card NIC) or on a chipq Ethernet card, 802.11

card; Ethernet chipsetq implements link, physical

layern attaches into host’s system

busesn combination of hardware,

software, firmware

controller

physicaltransmission

cpu memory

host bus (e.g., PCI)

network adaptercard

applicationtransportnetwork

link

linkphysical

Page 4: 2019 term 3 TELE3118: Network Technologies · Network Technologies 1c-15 n single shared broadcast channel n two or more simultaneous transmissions by nodes: interference q collisionif

Link Layer Functions

1c-4Network Technologies

n Framingn Error controln Addressing and Multiple-access controln Flow controln Reliable transfer

Page 5: 2019 term 3 TELE3118: Network Technologies · Network Technologies 1c-15 n single shared broadcast channel n two or more simultaneous transmissions by nodes: interference q collisionif

Framing

1c-5Network Technologies

A character stream. (a) Without errors. (b) With one error.

Page 6: 2019 term 3 TELE3118: Network Technologies · Network Technologies 1c-15 n single shared broadcast channel n two or more simultaneous transmissions by nodes: interference q collisionif

Framing (2)

1c-6Network Technologies

(a) A frame delimited by flag bytes.(b) Four examples of byte sequences before and after stuffing.

Page 7: 2019 term 3 TELE3118: Network Technologies · Network Technologies 1c-15 n single shared broadcast channel n two or more simultaneous transmissions by nodes: interference q collisionif

Framing (3)

1c-7Network Technologies

Bit stuffing(a) The original data.(b) The data as they appear on the line.(c) The data as they are stored in receiver’s memory after destuffing.

Page 8: 2019 term 3 TELE3118: Network Technologies · Network Technologies 1c-15 n single shared broadcast channel n two or more simultaneous transmissions by nodes: interference q collisionif

Error detection

1c-8Network Technologies

EDC= Error Detection and Correction bits (redundancy)D = Data protected by error checking, may include header fields

n Error detection not 100% reliable!n protocol may miss some errors, but rarelyn larger EDC field yields better detection and correction

Page 9: 2019 term 3 TELE3118: Network Technologies · Network Technologies 1c-15 n single shared broadcast channel n two or more simultaneous transmissions by nodes: interference q collisionif

Parity checking

1c-9Network Technologies

single bit parity:§ detect single bit

errors

two-dimensional bit parity:§ detect and correct single bit errors

Page 10: 2019 term 3 TELE3118: Network Technologies · Network Technologies 1c-15 n single shared broadcast channel n two or more simultaneous transmissions by nodes: interference q collisionif

Theory: Hamming Distances

1c-10Network Technologies

n Hamming distance of two codewords:q The number of bit positions in which they differq Example: 10001001 and 10110001 have Hamming distance 3

n Hamming distance of a code:q Minimum distance between any two valid codewordsq E.g. the code: 0000000000, 0000011111, 1111100000,

1111111111 has Hamming distance 5n message size n = data bits m + redundant bits r

q Of 2n codewords, only 2m are validn How many redundant bits needed for 1-bit error

correction?q Should satisfy: (n+1)2m ≤2n : why?

Page 11: 2019 term 3 TELE3118: Network Technologies · Network Technologies 1c-15 n single shared broadcast channel n two or more simultaneous transmissions by nodes: interference q collisionif

Cyclic redundancy check

1c-11Network Technologies

n more powerful error-detection codingn view data bits, D, as a binary numbern choose r+1 bit pattern (generator), Gn goal: choose r CRC bits, R, such that

q <D,R> exactly divisible by G (modulo 2) q receiver knows G, divides <D,R> by G. If non-zero remainder: error

detected!q can detect all burst errors less than r+1 bits

n widely used in practice (Ethernet, 802.11 WiFi, ATM)

Page 12: 2019 term 3 TELE3118: Network Technologies · Network Technologies 1c-15 n single shared broadcast channel n two or more simultaneous transmissions by nodes: interference q collisionif

CRC example

1c-12Network Technologies

want:D.2r XOR R = nG

equivalently:D.2r = nG XOR R

equivalently:if we divide D.2r by G, want remainder R to satisfy:

R = remainder[ ]D.2r

G

Page 13: 2019 term 3 TELE3118: Network Technologies · Network Technologies 1c-15 n single shared broadcast channel n two or more simultaneous transmissions by nodes: interference q collisionif

CRC properties

1c-13Network Technologies

n Can catch all errors with odd number of inverted bitsn Odd number of bits in error

q Represented by a polynomial with odd number of terms (e.g. 𝑥" + 𝑥$ + 1 )n No polynomial with odd number of terms has (x+1) as a factor in

modulo 2 n Add (x+1) as a factor in G(x) Jn Can catch all burst errors length ≤ r n Burst error of length k is represented 𝑥' 𝑥()* + ⋯+ 1

q there are k consecutive 1’s in your error

n If G(x) contains an 𝑥, term, it will never have 𝑥' as a factorq G(x) ends with +1 at the end! J

n G(x) = 𝑥-$ + 𝑥$. + 𝑥$- + 𝑥$$ + 𝑥*. + 𝑥*$ + 𝑥** + 𝑥*, + 𝑥/ + 𝑥0 +𝑥" + 𝑥1 + 𝑥$ + 𝑥* + 1

Page 14: 2019 term 3 TELE3118: Network Technologies · Network Technologies 1c-15 n single shared broadcast channel n two or more simultaneous transmissions by nodes: interference q collisionif

Multiple access links, protocols

1c-14Network Technologies

two types of “links”:n point-to-point

q PPP for dial-up accessq point-to-point link between Ethernet switch, host

n broadcast (shared wire or medium)q old-fashioned Ethernetq upstream HFCq 802.11 wireless LAN

shared wire (e.g., cabled Ethernet)

shared RF(e.g., 802.11 WiFi)

shared RF(satellite)

humans at acocktail party

(shared air, acoustical)

Page 15: 2019 term 3 TELE3118: Network Technologies · Network Technologies 1c-15 n single shared broadcast channel n two or more simultaneous transmissions by nodes: interference q collisionif

Multiple access protocols

1c-15Network Technologies

n single shared broadcast channel n two or more simultaneous transmissions by nodes:

interference q collision if node receives two or more signals at the same time

multiple access protocoln distributed algorithm that determines how nodes

share channel, i.e., determine when node can transmitn communication about channel sharing must use channel

itself! q no out-of-band channel for coordination

Page 16: 2019 term 3 TELE3118: Network Technologies · Network Technologies 1c-15 n single shared broadcast channel n two or more simultaneous transmissions by nodes: interference q collisionif

An ideal multiple access protocol

1c-16Network Technologies

given: broadcast channel of rate R bpsdesiderata:

1. when one node wants to transmit, it can send at rate R.2. when M nodes want to transmit, each can send at average rate

R/M3. fully decentralized:

n no special node to coordinate transmissionsn no synchronization of clocks, slots

4. simple

Page 17: 2019 term 3 TELE3118: Network Technologies · Network Technologies 1c-15 n single shared broadcast channel n two or more simultaneous transmissions by nodes: interference q collisionif

MAC protocols: taxonomy

1c-17Network Technologies

three broad classes:n channel partitioning

q divide channel into smaller “pieces” (time slots, frequency, code)

q allocate piece to node for exclusive use

n random accessq channel not divided, allow collisionsq “recover” from collisions

n “taking turns”q nodes take turns, but nodes with more to send can take

longer turns

Page 18: 2019 term 3 TELE3118: Network Technologies · Network Technologies 1c-15 n single shared broadcast channel n two or more simultaneous transmissions by nodes: interference q collisionif

Channel partitioning MAC protocols: TDMA

1c-18Network Technologies

TDMA: time division multiple access

n access to channel in "rounds" n each station gets fixed length slot (length = packet

transmission time) in each round n unused slots go idle n example: 6-station LAN, 1,3,4 have packets to send,

slots 2,5,6 idle

1 3 4 1 3 4

6-slotframe

6-slotframe

Page 19: 2019 term 3 TELE3118: Network Technologies · Network Technologies 1c-15 n single shared broadcast channel n two or more simultaneous transmissions by nodes: interference q collisionif

Channel partitioning MAC protocols: FDMA

1c-19Network Technologies

FDMA: frequency division multiple access n channel spectrum divided into frequency bandsn each station assigned fixed frequency bandn unused transmission time in frequency bands go idle n example: 6-station LAN, 1,3,4 have packet to send,

frequency bands 2,5,6 idle

freq

uenc

y ba

nds

time

FDM cable

Page 20: 2019 term 3 TELE3118: Network Technologies · Network Technologies 1c-15 n single shared broadcast channel n two or more simultaneous transmissions by nodes: interference q collisionif

Random access protocols

1c-20Network Technologies

n when node has packet to sendq transmit at full channel data rate R.q no a priori coordination among nodes

n two or more transmitting nodes ➜ “collision”,n random access MAC protocol specifies:

q how to detect collisionsq how to recover from collisions (e.g., via delayed

retransmissions)n examples of random access MAC protocols:

q slotted ALOHAq ALOHAq CSMA, CSMA/CD, CSMA/CA

Page 21: 2019 term 3 TELE3118: Network Technologies · Network Technologies 1c-15 n single shared broadcast channel n two or more simultaneous transmissions by nodes: interference q collisionif

Slotted ALOHA

1c-21Network Technologies

assumptions:n all frames same sizen time divided into equal

size slots (time to transmit 1 frame)

n nodes start to transmit only slot beginning

n nodes are synchronizedn if 2 or more nodes

transmit in slot, all nodes detect collision

operation:n when node obtains fresh

frame, transmits in next slotq if no collision: node can

send new frame in next slot

q if collision: node retransmits frame in each subsequent slot with prob. p until success

Page 22: 2019 term 3 TELE3118: Network Technologies · Network Technologies 1c-15 n single shared broadcast channel n two or more simultaneous transmissions by nodes: interference q collisionif

Slotted ALOHA

1c-22Network Technologies

Pros:n single active node can

continuously transmit at full rate of channel

n highly decentralized: only slots in nodes need to be in sync

n simple

Cons:n collisions, wasting slotsn idle slotsn nodes may be able to

detect collision in less than time to transmit packet

n clock synchronization

1 1 1 1

2

3

2 2

3 3

node 1

node 2

node 3

C C CS S SE E E

Page 23: 2019 term 3 TELE3118: Network Technologies · Network Technologies 1c-15 n single shared broadcast channel n two or more simultaneous transmissions by nodes: interference q collisionif

Slotted ALOHA: efficiency

1c-23Network Technologies

n max efficiency: find p* that maximizes Np(1-p)N-1

n for many nodes, take limit of Np*(1-p*)N-1 as N goes to infinity, gives:max efficiency = 1/e = 0.37

efficiency: long-run fraction of successful slots (many nodes, all with many frames to send)

at best: channelused for useful transmissions 37%of time! !

n suppose: N nodes with many frames to send, each transmits in slot with probability p

n prob that given node has success in a slot = p(1-p)N-1

n prob that any node has a success = Np(1-p)N-1

Page 24: 2019 term 3 TELE3118: Network Technologies · Network Technologies 1c-15 n single shared broadcast channel n two or more simultaneous transmissions by nodes: interference q collisionif

Pure (unslotted) ALOHA

1c-24Network Technologies

n unslotted Aloha: simpler, no synchronizationn when frame first arrives

q transmit immediately n collision probability increases:

q frame sent at t0 collides with other frames sent in [t0-1,t0+1]

Page 25: 2019 term 3 TELE3118: Network Technologies · Network Technologies 1c-15 n single shared broadcast channel n two or more simultaneous transmissions by nodes: interference q collisionif

Pure ALOHA efficiency

1c-25Network Technologies

P(success by given node) = P(node transmits) .P(no other node transmits in [t0-1,t0] .P(no other node transmits in [t0-1,t0]

= p . (1-p)N-1 . (1-p)N-1

= p . (1-p)2(N-1)

… choosing optimum p and then letting n

= 1/(2e) = 0.18

even worse than slotted Aloha!

Page 26: 2019 term 3 TELE3118: Network Technologies · Network Technologies 1c-15 n single shared broadcast channel n two or more simultaneous transmissions by nodes: interference q collisionif

CSMA (carrier sense multiple access)

1c-26Network Technologies

CSMA: listen before transmit:if channel sensed idle: transmit entire framen if channel sensed busy, defer transmission

n human analogy: don’t interrupt others!

Page 27: 2019 term 3 TELE3118: Network Technologies · Network Technologies 1c-15 n single shared broadcast channel n two or more simultaneous transmissions by nodes: interference q collisionif

CSMA collisions

1c-27Network Technologies

n collisions can still occur: propagation delay means two nodes may not hear each other’s transmission

n collision: entire packet transmission time wastedq distance & propagation

delay play role in determining collision probability

spatial layout of nodes

Page 28: 2019 term 3 TELE3118: Network Technologies · Network Technologies 1c-15 n single shared broadcast channel n two or more simultaneous transmissions by nodes: interference q collisionif

CSMA/CD (collision detection)

1c-28Network Technologies

CSMA/CD: carrier sensing, deferral as in CSMAq collisions detected within short timeq colliding transmissions aborted, reducing channel wastage

n collision detection: q easy in wired LANs: measure signal strengths, compare

transmitted, received signalsq difficult in wireless LANs: received signal strength

overwhelmed by local transmission strength

n human analogy: the polite conversationalist

Page 29: 2019 term 3 TELE3118: Network Technologies · Network Technologies 1c-15 n single shared broadcast channel n two or more simultaneous transmissions by nodes: interference q collisionif

CSMA/CD (collision detection)

1c-29Network Technologies

spatial layout of nodes

Page 30: 2019 term 3 TELE3118: Network Technologies · Network Technologies 1c-15 n single shared broadcast channel n two or more simultaneous transmissions by nodes: interference q collisionif

“Taking turns” MAC protocols

1c-30Network Technologies

channel partitioning MAC protocols:§ share channel efficiently and fairly at high load§ inefficient at low load: delay in channel access,

1/N bandwidth allocated even if only 1 active node!

random access MAC protocols§ efficient at low load: single node can fully utilize

channel§ high load: collision overhead“taking turns” protocols

look for best of both worlds!

Page 31: 2019 term 3 TELE3118: Network Technologies · Network Technologies 1c-15 n single shared broadcast channel n two or more simultaneous transmissions by nodes: interference q collisionif

“Taking turns” MAC protocols

1c-31Network Technologies

polling:n master node “invites”

slave nodes to transmit in turn

n typically used with “dumb” slave devices

n concerns:q polling overhead q latencyq single point of failure

(master)

master

slaves

poll

data

data

Page 32: 2019 term 3 TELE3118: Network Technologies · Network Technologies 1c-15 n single shared broadcast channel n two or more simultaneous transmissions by nodes: interference q collisionif

“Taking turns” MAC protocols

1c-32Network Technologies

token passing:§ control token passed from

one node to next sequentially.

n token messagen concerns:

q token overhead q latencyq single point of failure

(token)

T

data

(nothingto send)

T

Page 33: 2019 term 3 TELE3118: Network Technologies · Network Technologies 1c-15 n single shared broadcast channel n two or more simultaneous transmissions by nodes: interference q collisionif

Summary of MAC protocols

1c-33Network Technologies

n channel partitioning, by time, frequency or codeq Time Division, Frequency Division

n random access (dynamic), q ALOHA, S-ALOHA, CSMA, CSMA/CDq carrier sensing: easy in some technologies (wire), hard in

others (wireless)q CSMA/CD used in Ethernetq CSMA/CA used in 802.11

n taking turnsq polling from central site, token passingq Bluetooth, FDDI, token ring