Top Banner
1 CSCD 330 Network Programming Winter 2016 Lecture 17 Link Layer Hardware and Protocols Reading: Chapter 5 in text Some slides provided courtesy of J.F Kurose and K.W. Ross, All Rights Reserved, copyright 1996-2007 Who is this?
128

CSCD 330 Network Programming - EWUpenguin.ewu.edu/cscd330/CourseNotes/CSCD330-Lecture17...• Main question at this layer • How do I deliver packets or frames between two nodes in

Apr 10, 2018

Download

Documents

truongthien
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: CSCD 330 Network Programming - EWUpenguin.ewu.edu/cscd330/CourseNotes/CSCD330-Lecture17...• Main question at this layer • How do I deliver packets or frames between two nodes in

1

CSCD 330Network ProgrammingWinter 2016

Lecture 17Link Layer

Hardware and Protocols

Reading: Chapter 5 in text

Some slides provided courtesy of J.F Kurose and K.W. Ross, All Rights Reserved, copyright 1996-2007

Who is this?

Page 2: CSCD 330 Network Programming - EWUpenguin.ewu.edu/cscd330/CourseNotes/CSCD330-Lecture17...• Main question at this layer • How do I deliver packets or frames between two nodes in

Robert (Bob) Metcalf – Inventor of Ethernet

Bob Metcalfe Helped build early Internet while still an undergraduateInvented Ethernet—while at Xerox Palo Alto Research

CenterFounded 3Com Corp.Served as publisher at IDG's Infoworld Publishing Co.Wrote three booksSince January 2001 has been a venture capitalist with

Polaris Ventures

Nice article on him … if you want to read ithttp://electronicdesign.com/Articles/Index.cfm?AD=1&ArticleID=2855 2

Page 3: CSCD 330 Network Programming - EWUpenguin.ewu.edu/cscd330/CourseNotes/CSCD330-Lecture17...• Main question at this layer • How do I deliver packets or frames between two nodes in

3

Introduction to Link LayerSo far,

Application Layer - applications interface to people Messages get delivered Transport Layer – application to application

Segments get delivered Network Layer – destination to destination

Datagrams get delivered Link Layer – node to node delivery

Frames are delivered

Page 4: CSCD 330 Network Programming - EWUpenguin.ewu.edu/cscd330/CourseNotes/CSCD330-Lecture17...• Main question at this layer • How do I deliver packets or frames between two nodes in

Link Layer Overview

• Main question at this layer• How do I deliver packets or frames between two

nodes in the network?

• Historical reasons look at other link layer schemes

• But, Ethernet is currently dominant technology 802.11 Wireless another protocol Covered in a different chapter, in a different course and at a future time in a galaxy far away ...

4

Page 5: CSCD 330 Network Programming - EWUpenguin.ewu.edu/cscd330/CourseNotes/CSCD330-Lecture17...• Main question at this layer • How do I deliver packets or frames between two nodes in

5

Link Layer

• 5.1 Introduction and services

• 5.1a NIC Cards• 5.2 Error detection and

correction • 5.3Multiple access

protocols• 5.4 Link-layer

Addressing

• 5.5 Ethernet

Page 6: CSCD 330 Network Programming - EWUpenguin.ewu.edu/cscd330/CourseNotes/CSCD330-Lecture17...• Main question at this layer • How do I deliver packets or frames between two nodes in

6

Link Layer - IntroductionLink Layer Terms• Both Hosts and routers

• Called nodes• Communication channels connect

adjacent nodes along communication path, links• Wired links• Wireless links

• Layer-2 packet is a frame encapsulates datagram

Data-link layer responsible for transferring a frame from one node to adjacent node over a link

Page 7: CSCD 330 Network Programming - EWUpenguin.ewu.edu/cscd330/CourseNotes/CSCD330-Lecture17...• Main question at this layer • How do I deliver packets or frames between two nodes in

Link Layer Services

• The services offered by Link Layer are ....• Framing• Link Access• Reliable Delivery• Flow Control• Error Detection and Correction• Half dupleax and full duplex

7

Page 8: CSCD 330 Network Programming - EWUpenguin.ewu.edu/cscd330/CourseNotes/CSCD330-Lecture17...• Main question at this layer • How do I deliver packets or frames between two nodes in

8

Link Layer Services

• Framing• Encapsulate datagram into frame, add header, trailer• MAC (Media Access Control) addresses used in

frame headers to identify source, destination• Example: 00:13:02:BA:43:56

• Reliable Delivery Between Adjacent Nodes• Wireless links: higher error rates,

• Does more for reliability than wired• Does compute errors

• Wired relies on upper layers to handle it• Channel Access

• Share channel if shared medium• Point to point if not shared

Page 9: CSCD 330 Network Programming - EWUpenguin.ewu.edu/cscd330/CourseNotes/CSCD330-Lecture17...• Main question at this layer • How do I deliver packets or frames between two nodes in

9

Reliable DeliveryQuestion on Reliability

So, why would you need both link-level and transport layer reliability?• Because dealing with reliability at two

levels!• Transport layer reliability

• For end-to-end delivery between two processes

• Link layer reliability • For delivery between two nodes connected by a single link

Page 10: CSCD 330 Network Programming - EWUpenguin.ewu.edu/cscd330/CourseNotes/CSCD330-Lecture17...• Main question at this layer • How do I deliver packets or frames between two nodes in

10

Link Layer Services Continued• Flow control

• Pacing between adjacent sending and receiving nodes

• Error detection• Errors caused by signal attenuation, noise• Receiver detects presence of errors:

• Signals sender for retransmission or drops frame

• Error correction• Receiver identifies and corrects bit error(s)

without resorting to retransmission• Half-duplex and full-duplex

• With half duplex, nodes at both ends of link can transmit, but not at same time

Page 11: CSCD 330 Network Programming - EWUpenguin.ewu.edu/cscd330/CourseNotes/CSCD330-Lecture17...• Main question at this layer • How do I deliver packets or frames between two nodes in

Link Layer Implementation• Where is the link layer implemented?

• Hardware or software?• Separate card or on chip?

• Mostly Implemented• Hardware• Network Interface Card (NIC)

11

Page 12: CSCD 330 Network Programming - EWUpenguin.ewu.edu/cscd330/CourseNotes/CSCD330-Lecture17...• Main question at this layer • How do I deliver packets or frames between two nodes in

Link Layer Implementation

• Alternative to actual NIC card ...• Built in to the motherboard

Page 13: CSCD 330 Network Programming - EWUpenguin.ewu.edu/cscd330/CourseNotes/CSCD330-Lecture17...• Main question at this layer • How do I deliver packets or frames between two nodes in

13

Where is the link layer implemented?

• In each host• Link layer implemented in

“Network adaptor”

Network Interface Card (NIC)• Ethernet card, PCMCI

card, 802.11 card• Implements link and

physical layers

• Attaches to host’s system buses

• Combination of hardware, software, firmware

controller

physical

transmission

cpu memory

host bus (e.g., PCI)

network adaptercard

host schematic

applicationtransportnetwork

link

linkphysical

Page 14: CSCD 330 Network Programming - EWUpenguin.ewu.edu/cscd330/CourseNotes/CSCD330-Lecture17...• Main question at this layer • How do I deliver packets or frames between two nodes in

14

Network Interface Cards (NIC) Basics

• A Network Interface Card (NIC) • Establishes link between computer and network,

and manages link• A NIC performs two crucial tasks:

1. Establishes and manages computer’s network connection2. Encodes and translates digital data into signals

for outgoing messages, and Translates signals into digital computer data for

incoming messages

Page 15: CSCD 330 Network Programming - EWUpenguin.ewu.edu/cscd330/CourseNotes/CSCD330-Lecture17...• Main question at this layer • How do I deliver packets or frames between two nodes in

15

Parallel vs. Serial Transmission

• NICs also manage transformation of network data’s form• Computer bus has series of parallel data lines

(Parallel transmission)• Signals traversing network media consist of a linear

sequence of bits of data (serial transmission)

• NIC takes outgoing transmission in parallel form and recasts them into their serial equivalents For incoming messages, process reverses• Converting between serial and parallel transmission ,

NIC has memory, to hold data temporarily

Page 16: CSCD 330 Network Programming - EWUpenguin.ewu.edu/cscd330/CourseNotes/CSCD330-Lecture17...• Main question at this layer • How do I deliver packets or frames between two nodes in

16

Parallel vs. Serial Transmission

• Bus width - number of parallel lines in a computer bus• Industry Standard Architecture (ISA) bus – 16-bit

obsolete• Peripheral Component Interconnect (PCI) bus – 32-

bit, 64-bit , faster

Bus width

Page 17: CSCD 330 Network Programming - EWUpenguin.ewu.edu/cscd330/CourseNotes/CSCD330-Lecture17...• Main question at this layer • How do I deliver packets or frames between two nodes in

17

Network Interface Card

• Heart of card is a special purpose processor chip• Does framing, link access, flow control and error

detection• Encryption too, for wireless

• Examples• Intel 8254x controller implements Ethernet,• Atheros AR5006 controller handles 802.11

protocol• Trend ... Integrate adapters into motherboard, not

separate cards anymore• Particularly true for laptops and phones devices

Page 18: CSCD 330 Network Programming - EWUpenguin.ewu.edu/cscd330/CourseNotes/CSCD330-Lecture17...• Main question at this layer • How do I deliver packets or frames between two nodes in

18

Link Layer

• 5.1 Introduction and services

• 5.2 Error detection and correction - Later

• 5.3Multiple access protocols

• 5.4 Link-layer Addressing

• 5.5 Ethernet

Page 19: CSCD 330 Network Programming - EWUpenguin.ewu.edu/cscd330/CourseNotes/CSCD330-Lecture17...• Main question at this layer • How do I deliver packets or frames between two nodes in

Error Detection and CorrectionCauses of Transmission Errors

• Signal noise, attenuation or distortion• Both on wired and wireless mediums• See next slide ...

Page 20: CSCD 330 Network Programming - EWUpenguin.ewu.edu/cscd330/CourseNotes/CSCD330-Lecture17...• Main question at this layer • How do I deliver packets or frames between two nodes in

Definitions• What is Signal Attenuation?• Loss of signal strength measured in decibels (dB)

dec•i•bel - Defined a unit used to express differences in power, in acoustics or

electronics: equal to ten times the common logarithm of the ratio of two signals.

• Occurs for several reasons• Range - both wireless and wired transmissions gradually dissipate in strength over longer distance• Interference - on wireless networks, radio interference or

physical obstructions like walls dampen communication signals• Wire size - on wired networks, thinner wires suffer from higher

(more) attenuation than thicker wires

Page 21: CSCD 330 Network Programming - EWUpenguin.ewu.edu/cscd330/CourseNotes/CSCD330-Lecture17...• Main question at this layer • How do I deliver packets or frames between two nodes in

Errors at Link Layer

Two Ideas for Errors at Link LayerError detection – Parity checks, cyclic redundancy codes,

checksumError correction – Send redundant information with frame – When receiving frame incorrectly, receiver makes

“educated guess” about the original frame

Page 22: CSCD 330 Network Programming - EWUpenguin.ewu.edu/cscd330/CourseNotes/CSCD330-Lecture17...• Main question at this layer • How do I deliver packets or frames between two nodes in

Error Detection

• Error Detection• Lets … Receiver

• Determine whether received message has been corrupted• Checksum simplest method• Checksum, function of message, gets

appended to message• Receiver uses same function to calculate

checksum of received message and compare it with appended checksum

Page 23: CSCD 330 Network Programming - EWUpenguin.ewu.edu/cscd330/CourseNotes/CSCD330-Lecture17...• Main question at this layer • How do I deliver packets or frames between two nodes in

DataLink Layer 23

Example of ChecksumInternet Checksum

Goal: Detect “errors” (e.g., flipped bits) in transmitted packet (note: used at transport layer only)

Sender: Treat segment contents as sequence of 16-bit integers Checksum: Addition (1’s complement sum) of segment

contentsOnly done on IP packet header

Receiver: Compute checksum of received segment Check if computed checksum equals checksum field value:

NO - error detected YES - no error detected

Page 24: CSCD 330 Network Programming - EWUpenguin.ewu.edu/cscd330/CourseNotes/CSCD330-Lecture17...• Main question at this layer • How do I deliver packets or frames between two nodes in

24

Error Detection

• Parity Checking – Even Parity • If you get odd number of bits including parity bit

– > A bit changed in transmission• Single parity bit is an error detecting code,• Not an error correcting code

• No way to determine which bit is corrupted• Two-dimensional parity checks parity of both

column and row, pinpoints error and allows for correction

Page 25: CSCD 330 Network Programming - EWUpenguin.ewu.edu/cscd330/CourseNotes/CSCD330-Lecture17...• Main question at this layer • How do I deliver packets or frames between two nodes in

25

Parity Checking Simplest TechniqueSingle Bit ParityDetect single bit errors

Two Dimensional Bit ParityDetect and correct single bit errors

Simple detection

For Even Parity

Number of 1’s in data + parity bit must be an Even number

Can locate and correct errors

1

9 1’s Add a 1

Page 26: CSCD 330 Network Programming - EWUpenguin.ewu.edu/cscd330/CourseNotes/CSCD330-Lecture17...• Main question at this layer • How do I deliver packets or frames between two nodes in

26

Parity Checking

• Comment • Is a limit to parity schemes• A parity bit only guaranteed to detect an odd

number of bit errors One, three, five, and so forth • If even number of bits (two, four, six and so on)

are flipped, the parity bit appears to be correct, even though the data is corrupt• This is for even parity• Odd parity will have the reverse problem

Page 27: CSCD 330 Network Programming - EWUpenguin.ewu.edu/cscd330/CourseNotes/CSCD330-Lecture17...• Main question at this layer • How do I deliver packets or frames between two nodes in

27

Checksumming Cyclic Redundancy Check (CRC)• Want algorithm detects some number of changed bits• Ideally ... implemented in hardware• CRC Scheme

• CRC algorithms treat message as an enormous binary number,

• Divide it by another fixed binary number,• Make remainder from this division the checksum

• Widely used in practice (Ethernet, 802.11 WiFi, ATM)• It has better powers of detection than bit parity or

checksums … uses entire number, handle more bit errors – nice example below

http://www.repairfaq.org/filipg/LINK/F_crc_v3.html

Page 28: CSCD 330 Network Programming - EWUpenguin.ewu.edu/cscd330/CourseNotes/CSCD330-Lecture17...• Main question at this layer • How do I deliver packets or frames between two nodes in

28

Link Layer

• 5.1 Introduction and services

• 5.2 Error detection and correction

• 5.3 Multiple access protocols

• 5.4 Link-layer Addressing

• 5.5 Ethernet

Page 29: CSCD 330 Network Programming - EWUpenguin.ewu.edu/cscd330/CourseNotes/CSCD330-Lecture17...• Main question at this layer • How do I deliver packets or frames between two nodes in

29

Access Links and Protocols

Two types of “links”• Point-to-point

• PPP for dial-up access• Point-to-Point link between Ethernet switch and host

• Broadcast (shared wire or medium)• Old-fashioned Ethernet• 802.11 wireless LAN• Satellite

shared wire (e.g., cabled non-switch Ethernet)

shared RF (e.g., 802.11 WiFi)

shared RF(satellite)

humans at acocktail party

(shared air, acoustical)

Page 30: CSCD 330 Network Programming - EWUpenguin.ewu.edu/cscd330/CourseNotes/CSCD330-Lecture17...• Main question at this layer • How do I deliver packets or frames between two nodes in

Communication Between Nodes• Point to Point Links

• These are dedicated channels between a node and switch or modem

• No need to share the link• Broadcast Links

• Multiple sending and receiving nodes all connected to single broadcast channel

• Central problem at link layer• How to “share” the link between nodes• Must coordinate access between competing

nodes• Known as Multiple Access Problem

Page 31: CSCD 330 Network Programming - EWUpenguin.ewu.edu/cscd330/CourseNotes/CSCD330-Lecture17...• Main question at this layer • How do I deliver packets or frames between two nodes in

Multiple Access Problem

• Question is• How do you fairly share the medium at the Link

level?• Everyone is connected to same network• All want to send their data all the time.• How do we fairly share the medium?

Page 32: CSCD 330 Network Programming - EWUpenguin.ewu.edu/cscd330/CourseNotes/CSCD330-Lecture17...• Main question at this layer • How do I deliver packets or frames between two nodes in

32

Multiple Access Protocols• Idea is .... can send and receive in both directions

single shared broadcast channel • Two or more simultaneous transmissions by nodes

means interference • Collision if node receives two or more signals at

the same time … gibberish, must retransmit, BAD!Multiple Access Protocol• Distributed algorithm, determines how nodes share

channel, i.e., determine when node can transmit• Communication about channel sharing must use

channel itself! • No out-of-band channel for coordination

Page 33: CSCD 330 Network Programming - EWUpenguin.ewu.edu/cscd330/CourseNotes/CSCD330-Lecture17...• Main question at this layer • How do I deliver packets or frames between two nodes in

33

Ideal Multiple Access Protocol

Rules - Broadcast Channel, Rate = R bps1. When one node wants to transmit, can send at full

rate R2. When M nodes want to transmit, each can send at average rate R/M ... Fair3. Fully decentralized

• No special node to coordinate transmissions• No synchronization of clocks, slots

4. Simple

In a perfect world ...

Page 34: CSCD 330 Network Programming - EWUpenguin.ewu.edu/cscd330/CourseNotes/CSCD330-Lecture17...• Main question at this layer • How do I deliver packets or frames between two nodes in

Examine Following Strategies

• Look at each of the strategies and see how close each meets the IDEAL Multiple Access Channel properties ...

Page 35: CSCD 330 Network Programming - EWUpenguin.ewu.edu/cscd330/CourseNotes/CSCD330-Lecture17...• Main question at this layer • How do I deliver packets or frames between two nodes in

35

Multiple Access Protocols: A TaxonomyThree broad classes1.Channel Partitioning

• Divide channel into smaller pieces• Time slots, frequency, code division

• Allocate piece to node for exclusive use

2. Random Access• Channel not divided, allow collisions• Recover from collisions

3. Taking turns• Nodes take turns, but nodes with more to send can take longer turns

Page 36: CSCD 330 Network Programming - EWUpenguin.ewu.edu/cscd330/CourseNotes/CSCD330-Lecture17...• Main question at this layer • How do I deliver packets or frames between two nodes in

Channel Partitioning

Page 37: CSCD 330 Network Programming - EWUpenguin.ewu.edu/cscd330/CourseNotes/CSCD330-Lecture17...• Main question at this layer • How do I deliver packets or frames between two nodes in

37

Channel Partitioning Protocols: TDMATDMA: Time Division Multiple Access • Access to channel in "rounds" • Each station gets fixed length slot

Length = packet transit time, in each round• Whats the problem?

• Unused slots wasted• Example: 6-station LAN, 1,3,4 have pkt, slots 2,5,6 idle

1 3 4 1 3 4

6-slotframe

Page 38: CSCD 330 Network Programming - EWUpenguin.ewu.edu/cscd330/CourseNotes/CSCD330-Lecture17...• Main question at this layer • How do I deliver packets or frames between two nodes in

38

TDMA: Time Division Multiple Access

• Analogy• Take turns talking• Fix each person a time slot• All get a turn even when they have nothing to

say

• Our class – 5 slot limit

Jordan, Audry Jose Kevin MatheusTalks Silent Talks Silent Talks

Wasted two slots where others could have had useful things to say …

Page 39: CSCD 330 Network Programming - EWUpenguin.ewu.edu/cscd330/CourseNotes/CSCD330-Lecture17...• Main question at this layer • How do I deliver packets or frames between two nodes in

39

Channel Partitioning Protocols: FDMAFDMA: frequency division multiple access • Channel spectrum divided into frequency bands• Each station assigned fixed frequency band• Whats the problem? Some frequency bands are idle, limited to your

band• Example: 6-station LAN, 1,3,4 have pkt, frequency

bands 2,5,6 idle freq

uen

cy b

an

ds

time

FDM cable

Page 40: CSCD 330 Network Programming - EWUpenguin.ewu.edu/cscd330/CourseNotes/CSCD330-Lecture17...• Main question at this layer • How do I deliver packets or frames between two nodes in

Random Access Protocols

Page 41: CSCD 330 Network Programming - EWUpenguin.ewu.edu/cscd330/CourseNotes/CSCD330-Lecture17...• Main question at this layer • How do I deliver packets or frames between two nodes in

41

Random Access Protocols• When node has packet to send

• Transmit at full channel data rate R• No a priori coordination among nodes

• Two or more transmitting nodes - collision• Random access Medium Access Control

protocol specifies• Key Problems

• How to detect collisions• How to recover from collisions

• Examples• Slotted ALOHA• ALOHA• CSMA, CSMA/CD, CSMA/CA

Page 42: CSCD 330 Network Programming - EWUpenguin.ewu.edu/cscd330/CourseNotes/CSCD330-Lecture17...• Main question at this layer • How do I deliver packets or frames between two nodes in

Aloha Protocol

• Simple protocol developed by Norman Abramson and colleagues at University of Hawaii, in 1968• Used low-cost amateur radio-like systems to create

a computer network linking distributed campuses of the University

• Protocol allows every system to send a frame if its ready to send

• Based on a shared medium network• This was basis for Ethernet !!!!

Page 43: CSCD 330 Network Programming - EWUpenguin.ewu.edu/cscd330/CourseNotes/CSCD330-Lecture17...• Main question at this layer • How do I deliver packets or frames between two nodes in

Pure ALOHA

In pure ALOHA, frames are transmitted at completely arbitrary times.

Page 44: CSCD 330 Network Programming - EWUpenguin.ewu.edu/cscd330/CourseNotes/CSCD330-Lecture17...• Main question at this layer • How do I deliver packets or frames between two nodes in

44

Slotted ALOHAImprovement on Aloha

Assumptions• All frames same size• Time divided into equal size slots

• Time to transmit 1 frame• Nodes transmit only at slot beginning • Nodes are now synchronized• If 2 or more nodes transmit in slot, all nodes

detect collision

Page 45: CSCD 330 Network Programming - EWUpenguin.ewu.edu/cscd330/CourseNotes/CSCD330-Lecture17...• Main question at this layer • How do I deliver packets or frames between two nodes in

Slotted ALOHA

Operation• When node obtains fresh frame, transmits in

next slot• If no collision, node can send new frame in

next slot• If collision, node retransmits frame in each

subsequent slot with probability p until success

• Probability is key and is between 0 and 1

Page 46: CSCD 330 Network Programming - EWUpenguin.ewu.edu/cscd330/CourseNotes/CSCD330-Lecture17...• Main question at this layer • How do I deliver packets or frames between two nodes in

46

Slotted ALOHA

• Probability is key • Probability p means each node independently

tosses a coin, heads or tails• P – says how likely it is node gets a head

• Node transmits under this event• (1-p) – is the probability of getting tail on a

coin• Means node skips a slot and tosses

again in next slot

Page 47: CSCD 330 Network Programming - EWUpenguin.ewu.edu/cscd330/CourseNotes/CSCD330-Lecture17...• Main question at this layer • How do I deliver packets or frames between two nodes in

Slotted Aloha C – collisionE – emptyS - Success

Page 48: CSCD 330 Network Programming - EWUpenguin.ewu.edu/cscd330/CourseNotes/CSCD330-Lecture17...• Main question at this layer • How do I deliver packets or frames between two nodes in

48

Slotted ALOHA

Pros• Single active node can

continuously transmit at full rate of channel

• Highly decentralized: Slots in nodes need to be in sync

• Simple

Cons• Collisions, wasting

slots• Idle slots• Nodes may be able to

detect collision in less than time to transmit packet

• Clock synchronization

C – collisionE – emptyS - Success

Takes 9 slots

Page 49: CSCD 330 Network Programming - EWUpenguin.ewu.edu/cscd330/CourseNotes/CSCD330-Lecture17...• Main question at this layer • How do I deliver packets or frames between two nodes in

49

Slotted Aloha efficiency

• Suppose: N nodes with many frames to send, each transmits in slot with probability p

• Probability that given node has success in a slot =

p(1-p)N-1

• Prob that any node has a success = Np(1-p)N-1

• Max efficiency: find p* that maximizes, successful nodesNp(1-p)N-1

• For many nodes, take limit of Np*(1-p*)N-1 as N goes to infinity, gives:

Max efficiency = 1/e = .37

Whats the Efficiency of Aloha?Efficiency : long-run fraction of successful slots (many nodes, all with many frames to send)

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

!

Page 50: CSCD 330 Network Programming - EWUpenguin.ewu.edu/cscd330/CourseNotes/CSCD330-Lecture17...• Main question at this layer • How do I deliver packets or frames between two nodes in

Slotted ALOHA

Throughput versus offered traffic for ALOHA systems.

Page 51: CSCD 330 Network Programming - EWUpenguin.ewu.edu/cscd330/CourseNotes/CSCD330-Lecture17...• Main question at this layer • How do I deliver packets or frames between two nodes in

51

CSMA (Carrier Sense Multiple Access)

• Max throughput achievable by slotted ALOHA is 0.368.

• CSMA improved throughput compared to Aloha protocols.

• Big Improvement ....

• Listen before you speak!• Listens to the channel before transmitting a

packet (avoid avoidable collisions)

Page 52: CSCD 330 Network Programming - EWUpenguin.ewu.edu/cscd330/CourseNotes/CSCD330-Lecture17...• Main question at this layer • How do I deliver packets or frames between two nodes in

52

Assumptions with CSMA Networks

1. Constant length packets2. No errors, except those caused by collisions3. Each host can sense the transmissions of all other

hosts4. The propagation delay is small compared to the

transmission time

Page 53: CSCD 330 Network Programming - EWUpenguin.ewu.edu/cscd330/CourseNotes/CSCD330-Lecture17...• Main question at this layer • How do I deliver packets or frames between two nodes in

53

CSMA (Carrier Sense Multiple Access)

CSMA: Listen before transmit:

If channel sensed idle• Transmit entire frameIf channel sensed busy• Defer transmission • Human analogy: Don’t interrupt others!

Page 54: CSCD 330 Network Programming - EWUpenguin.ewu.edu/cscd330/CourseNotes/CSCD330-Lecture17...• Main question at this layer • How do I deliver packets or frames between two nodes in

54

CSMA collisions

Collisions can still occur:propagation delay means two nodes may not heareach other’s transmission

Collision:entire packet transmission time wasted

spatial layout of nodes

Page 55: CSCD 330 Network Programming - EWUpenguin.ewu.edu/cscd330/CourseNotes/CSCD330-Lecture17...• Main question at this layer • How do I deliver packets or frames between two nodes in

55

CSMA/CD (Collision Detection)

CSMA/CD: Carrier sensing, deferral as in CSMA• Collisions detected within short time• Colliding transmissions aborted, reduces channel

wastage • Collision Detection

• Easy in wired LANs• Measure signal strengths, compare transmitted

and received signals• Difficult in wireless LANs: received signal strength

overwhelmed by local transmission strength

Page 56: CSCD 330 Network Programming - EWUpenguin.ewu.edu/cscd330/CourseNotes/CSCD330-Lecture17...• Main question at this layer • How do I deliver packets or frames between two nodes in

56

CSMA/CD collision detection

Page 57: CSCD 330 Network Programming - EWUpenguin.ewu.edu/cscd330/CourseNotes/CSCD330-Lecture17...• Main question at this layer • How do I deliver packets or frames between two nodes in

57

CSMA/CD

• Sense the channel• If idle, transmit immediately• If busy, wait until the channel becomes idle

• Collision detection• Abort a transmission immediately if a collision is

detected• Try again later after waiting a random amount of time

• Will revisit this later when we describe Ethernet ...

Page 58: CSCD 330 Network Programming - EWUpenguin.ewu.edu/cscd330/CourseNotes/CSCD330-Lecture17...• Main question at this layer • How do I deliver packets or frames between two nodes in

58

Taking Turns

Page 59: CSCD 330 Network Programming - EWUpenguin.ewu.edu/cscd330/CourseNotes/CSCD330-Lecture17...• Main question at this layer • How do I deliver packets or frames between two nodes in

59

“Taking Turns” MAC protocols

Polling: • Master node “invites”

slave nodes to transmit in turn

• Typically used with “dumb” slave devices

• Bluetooth uses polling• Concerns:

• Polling overhead • Latency• Single point of

failure (master)

master

slaves

poll

data

data

Page 60: CSCD 330 Network Programming - EWUpenguin.ewu.edu/cscd330/CourseNotes/CSCD330-Lecture17...• Main question at this layer • How do I deliver packets or frames between two nodes in

Token Passing Protocols

• Token Ring protocol was developed by IBM mid-1980s• Access method involves token-passing• In Token Ring, computers are connected so that signal

travels around the network from one computer to another in a logical ring

• A single electronic token moves around ring from one computer to the next

• If computer does not have information to transmit, it simply passes the token on to the next workstation

• If computer wishes to transmit and receives an empty token, it attaches data to the token

Page 61: CSCD 330 Network Programming - EWUpenguin.ewu.edu/cscd330/CourseNotes/CSCD330-Lecture17...• Main question at this layer • How do I deliver packets or frames between two nodes in

Token Passing Protocols

• Token Ring protocol requires a star-wired ring using twisted pair or fiber optic cable

• It operates, transmission speeds of 4 Mbps or 16 Mbps• Due to the increasing popularity of Ethernet,• Use of Token Ring in decreased dramatically

http://en.wikipedia.org/wiki/IBM_token_ring

Page 62: CSCD 330 Network Programming - EWUpenguin.ewu.edu/cscd330/CourseNotes/CSCD330-Lecture17...• Main question at this layer • How do I deliver packets or frames between two nodes in

62

“Taking Turns” MAC protocols

Token passing:• Control token

passed from one node to next sequentially.

• Token message• Concerns:

• Token overhead

• Latency• Single point of failure (token)

T

data

(nothingto send)

T

Page 63: CSCD 330 Network Programming - EWUpenguin.ewu.edu/cscd330/CourseNotes/CSCD330-Lecture17...• Main question at this layer • How do I deliver packets or frames between two nodes in

63

Summary of Protocols

• Channel partitioning, by time, frequency or code• Time Division, Frequency Division

• Random access (dynamic), • ALOHA, S-ALOHA, CSMA, CSMA/CD• Carrier sensing: easy in some technologies

(wire), hard in others (wireless)• CSMA/CD used in Ethernet• CSMA/CA used in 802.11

• Taking turns• Polling from central site, token passing• Bluetooth, FDDI, IBM Token Ring

Page 64: CSCD 330 Network Programming - EWUpenguin.ewu.edu/cscd330/CourseNotes/CSCD330-Lecture17...• Main question at this layer • How do I deliver packets or frames between two nodes in

64

End

Page 65: CSCD 330 Network Programming - EWUpenguin.ewu.edu/cscd330/CourseNotes/CSCD330-Lecture17...• Main question at this layer • How do I deliver packets or frames between two nodes in

1

Page 66: CSCD 330 Network Programming - EWUpenguin.ewu.edu/cscd330/CourseNotes/CSCD330-Lecture17...• Main question at this layer • How do I deliver packets or frames between two nodes in
Page 67: CSCD 330 Network Programming - EWUpenguin.ewu.edu/cscd330/CourseNotes/CSCD330-Lecture17...• Main question at this layer • How do I deliver packets or frames between two nodes in

3

Page 68: CSCD 330 Network Programming - EWUpenguin.ewu.edu/cscd330/CourseNotes/CSCD330-Lecture17...• Main question at this layer • How do I deliver packets or frames between two nodes in
Page 69: CSCD 330 Network Programming - EWUpenguin.ewu.edu/cscd330/CourseNotes/CSCD330-Lecture17...• Main question at this layer • How do I deliver packets or frames between two nodes in

5

Page 70: CSCD 330 Network Programming - EWUpenguin.ewu.edu/cscd330/CourseNotes/CSCD330-Lecture17...• Main question at this layer • How do I deliver packets or frames between two nodes in

6

Page 71: CSCD 330 Network Programming - EWUpenguin.ewu.edu/cscd330/CourseNotes/CSCD330-Lecture17...• Main question at this layer • How do I deliver packets or frames between two nodes in
Page 72: CSCD 330 Network Programming - EWUpenguin.ewu.edu/cscd330/CourseNotes/CSCD330-Lecture17...• Main question at this layer • How do I deliver packets or frames between two nodes in

8

Page 73: CSCD 330 Network Programming - EWUpenguin.ewu.edu/cscd330/CourseNotes/CSCD330-Lecture17...• Main question at this layer • How do I deliver packets or frames between two nodes in
Page 74: CSCD 330 Network Programming - EWUpenguin.ewu.edu/cscd330/CourseNotes/CSCD330-Lecture17...• Main question at this layer • How do I deliver packets or frames between two nodes in

10

Page 75: CSCD 330 Network Programming - EWUpenguin.ewu.edu/cscd330/CourseNotes/CSCD330-Lecture17...• Main question at this layer • How do I deliver packets or frames between two nodes in
Page 76: CSCD 330 Network Programming - EWUpenguin.ewu.edu/cscd330/CourseNotes/CSCD330-Lecture17...• Main question at this layer • How do I deliver packets or frames between two nodes in
Page 77: CSCD 330 Network Programming - EWUpenguin.ewu.edu/cscd330/CourseNotes/CSCD330-Lecture17...• Main question at this layer • How do I deliver packets or frames between two nodes in

13

Page 78: CSCD 330 Network Programming - EWUpenguin.ewu.edu/cscd330/CourseNotes/CSCD330-Lecture17...• Main question at this layer • How do I deliver packets or frames between two nodes in

14

Page 79: CSCD 330 Network Programming - EWUpenguin.ewu.edu/cscd330/CourseNotes/CSCD330-Lecture17...• Main question at this layer • How do I deliver packets or frames between two nodes in

15

Multilane highway single lane road (covert at exit)

Page 80: CSCD 330 Network Programming - EWUpenguin.ewu.edu/cscd330/CourseNotes/CSCD330-Lecture17...• Main question at this layer • How do I deliver packets or frames between two nodes in

16

Page 81: CSCD 330 Network Programming - EWUpenguin.ewu.edu/cscd330/CourseNotes/CSCD330-Lecture17...• Main question at this layer • How do I deliver packets or frames between two nodes in
Page 82: CSCD 330 Network Programming - EWUpenguin.ewu.edu/cscd330/CourseNotes/CSCD330-Lecture17...• Main question at this layer • How do I deliver packets or frames between two nodes in

18

Page 83: CSCD 330 Network Programming - EWUpenguin.ewu.edu/cscd330/CourseNotes/CSCD330-Lecture17...• Main question at this layer • How do I deliver packets or frames between two nodes in
Page 84: CSCD 330 Network Programming - EWUpenguin.ewu.edu/cscd330/CourseNotes/CSCD330-Lecture17...• Main question at this layer • How do I deliver packets or frames between two nodes in
Page 85: CSCD 330 Network Programming - EWUpenguin.ewu.edu/cscd330/CourseNotes/CSCD330-Lecture17...• Main question at this layer • How do I deliver packets or frames between two nodes in
Page 86: CSCD 330 Network Programming - EWUpenguin.ewu.edu/cscd330/CourseNotes/CSCD330-Lecture17...• Main question at this layer • How do I deliver packets or frames between two nodes in
Page 87: CSCD 330 Network Programming - EWUpenguin.ewu.edu/cscd330/CourseNotes/CSCD330-Lecture17...• Main question at this layer • How do I deliver packets or frames between two nodes in

23

Page 88: CSCD 330 Network Programming - EWUpenguin.ewu.edu/cscd330/CourseNotes/CSCD330-Lecture17...• Main question at this layer • How do I deliver packets or frames between two nodes in
Page 89: CSCD 330 Network Programming - EWUpenguin.ewu.edu/cscd330/CourseNotes/CSCD330-Lecture17...• Main question at this layer • How do I deliver packets or frames between two nodes in

25

Page 90: CSCD 330 Network Programming - EWUpenguin.ewu.edu/cscd330/CourseNotes/CSCD330-Lecture17...• Main question at this layer • How do I deliver packets or frames between two nodes in
Page 91: CSCD 330 Network Programming - EWUpenguin.ewu.edu/cscd330/CourseNotes/CSCD330-Lecture17...• Main question at this layer • How do I deliver packets or frames between two nodes in

27

Page 92: CSCD 330 Network Programming - EWUpenguin.ewu.edu/cscd330/CourseNotes/CSCD330-Lecture17...• Main question at this layer • How do I deliver packets or frames between two nodes in

28

Page 93: CSCD 330 Network Programming - EWUpenguin.ewu.edu/cscd330/CourseNotes/CSCD330-Lecture17...• Main question at this layer • How do I deliver packets or frames between two nodes in

29

Page 94: CSCD 330 Network Programming - EWUpenguin.ewu.edu/cscd330/CourseNotes/CSCD330-Lecture17...• Main question at this layer • How do I deliver packets or frames between two nodes in
Page 95: CSCD 330 Network Programming - EWUpenguin.ewu.edu/cscd330/CourseNotes/CSCD330-Lecture17...• Main question at this layer • How do I deliver packets or frames between two nodes in

31

Multiple Access Problem

• Question is• How do you fairly share the medium at the Link

level?• Everyone is connected to same network• All want to send their data all the time.• How do we fairly share the medium?

Page 96: CSCD 330 Network Programming - EWUpenguin.ewu.edu/cscd330/CourseNotes/CSCD330-Lecture17...• Main question at this layer • How do I deliver packets or frames between two nodes in

32

Page 97: CSCD 330 Network Programming - EWUpenguin.ewu.edu/cscd330/CourseNotes/CSCD330-Lecture17...• Main question at this layer • How do I deliver packets or frames between two nodes in

33

Page 98: CSCD 330 Network Programming - EWUpenguin.ewu.edu/cscd330/CourseNotes/CSCD330-Lecture17...• Main question at this layer • How do I deliver packets or frames between two nodes in
Page 99: CSCD 330 Network Programming - EWUpenguin.ewu.edu/cscd330/CourseNotes/CSCD330-Lecture17...• Main question at this layer • How do I deliver packets or frames between two nodes in

35

Page 100: CSCD 330 Network Programming - EWUpenguin.ewu.edu/cscd330/CourseNotes/CSCD330-Lecture17...• Main question at this layer • How do I deliver packets or frames between two nodes in

36

Channel Partitioning

Page 101: CSCD 330 Network Programming - EWUpenguin.ewu.edu/cscd330/CourseNotes/CSCD330-Lecture17...• Main question at this layer • How do I deliver packets or frames between two nodes in

37

Page 102: CSCD 330 Network Programming - EWUpenguin.ewu.edu/cscd330/CourseNotes/CSCD330-Lecture17...• Main question at this layer • How do I deliver packets or frames between two nodes in
Page 103: CSCD 330 Network Programming - EWUpenguin.ewu.edu/cscd330/CourseNotes/CSCD330-Lecture17...• Main question at this layer • How do I deliver packets or frames between two nodes in

39

Page 104: CSCD 330 Network Programming - EWUpenguin.ewu.edu/cscd330/CourseNotes/CSCD330-Lecture17...• Main question at this layer • How do I deliver packets or frames between two nodes in
Page 105: CSCD 330 Network Programming - EWUpenguin.ewu.edu/cscd330/CourseNotes/CSCD330-Lecture17...• Main question at this layer • How do I deliver packets or frames between two nodes in

41

Page 106: CSCD 330 Network Programming - EWUpenguin.ewu.edu/cscd330/CourseNotes/CSCD330-Lecture17...• Main question at this layer • How do I deliver packets or frames between two nodes in
Page 107: CSCD 330 Network Programming - EWUpenguin.ewu.edu/cscd330/CourseNotes/CSCD330-Lecture17...• Main question at this layer • How do I deliver packets or frames between two nodes in
Page 108: CSCD 330 Network Programming - EWUpenguin.ewu.edu/cscd330/CourseNotes/CSCD330-Lecture17...• Main question at this layer • How do I deliver packets or frames between two nodes in

44

Page 109: CSCD 330 Network Programming - EWUpenguin.ewu.edu/cscd330/CourseNotes/CSCD330-Lecture17...• Main question at this layer • How do I deliver packets or frames between two nodes in
Page 110: CSCD 330 Network Programming - EWUpenguin.ewu.edu/cscd330/CourseNotes/CSCD330-Lecture17...• Main question at this layer • How do I deliver packets or frames between two nodes in
Page 111: CSCD 330 Network Programming - EWUpenguin.ewu.edu/cscd330/CourseNotes/CSCD330-Lecture17...• Main question at this layer • How do I deliver packets or frames between two nodes in
Page 112: CSCD 330 Network Programming - EWUpenguin.ewu.edu/cscd330/CourseNotes/CSCD330-Lecture17...• Main question at this layer • How do I deliver packets or frames between two nodes in

48

Page 113: CSCD 330 Network Programming - EWUpenguin.ewu.edu/cscd330/CourseNotes/CSCD330-Lecture17...• Main question at this layer • How do I deliver packets or frames between two nodes in

49

Page 114: CSCD 330 Network Programming - EWUpenguin.ewu.edu/cscd330/CourseNotes/CSCD330-Lecture17...• Main question at this layer • How do I deliver packets or frames between two nodes in

50

Examples and detailed mathematical analysis

Page 115: CSCD 330 Network Programming - EWUpenguin.ewu.edu/cscd330/CourseNotes/CSCD330-Lecture17...• Main question at this layer • How do I deliver packets or frames between two nodes in
Page 116: CSCD 330 Network Programming - EWUpenguin.ewu.edu/cscd330/CourseNotes/CSCD330-Lecture17...• Main question at this layer • How do I deliver packets or frames between two nodes in
Page 117: CSCD 330 Network Programming - EWUpenguin.ewu.edu/cscd330/CourseNotes/CSCD330-Lecture17...• Main question at this layer • How do I deliver packets or frames between two nodes in

53

Page 118: CSCD 330 Network Programming - EWUpenguin.ewu.edu/cscd330/CourseNotes/CSCD330-Lecture17...• Main question at this layer • How do I deliver packets or frames between two nodes in

54

Page 119: CSCD 330 Network Programming - EWUpenguin.ewu.edu/cscd330/CourseNotes/CSCD330-Lecture17...• Main question at this layer • How do I deliver packets or frames between two nodes in

55

Page 120: CSCD 330 Network Programming - EWUpenguin.ewu.edu/cscd330/CourseNotes/CSCD330-Lecture17...• Main question at this layer • How do I deliver packets or frames between two nodes in

56

Page 121: CSCD 330 Network Programming - EWUpenguin.ewu.edu/cscd330/CourseNotes/CSCD330-Lecture17...• Main question at this layer • How do I deliver packets or frames between two nodes in
Page 122: CSCD 330 Network Programming - EWUpenguin.ewu.edu/cscd330/CourseNotes/CSCD330-Lecture17...• Main question at this layer • How do I deliver packets or frames between two nodes in

58

Taking Turns

Page 123: CSCD 330 Network Programming - EWUpenguin.ewu.edu/cscd330/CourseNotes/CSCD330-Lecture17...• Main question at this layer • How do I deliver packets or frames between two nodes in

59

Page 124: CSCD 330 Network Programming - EWUpenguin.ewu.edu/cscd330/CourseNotes/CSCD330-Lecture17...• Main question at this layer • How do I deliver packets or frames between two nodes in
Page 125: CSCD 330 Network Programming - EWUpenguin.ewu.edu/cscd330/CourseNotes/CSCD330-Lecture17...• Main question at this layer • How do I deliver packets or frames between two nodes in
Page 126: CSCD 330 Network Programming - EWUpenguin.ewu.edu/cscd330/CourseNotes/CSCD330-Lecture17...• Main question at this layer • How do I deliver packets or frames between two nodes in

62

Page 127: CSCD 330 Network Programming - EWUpenguin.ewu.edu/cscd330/CourseNotes/CSCD330-Lecture17...• Main question at this layer • How do I deliver packets or frames between two nodes in

63

Page 128: CSCD 330 Network Programming - EWUpenguin.ewu.edu/cscd330/CourseNotes/CSCD330-Lecture17...• Main question at this layer • How do I deliver packets or frames between two nodes in

64