Your SlideShare is downloading. ×
Upcoming SlideShare
Loading in...5

Thanks for flagging this SlideShare!

Oops! An error has occurred.

Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply



Published on

  • Be the first to comment

No Downloads
Total Views
On Slideshare
From Embeds
Number of Embeds
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

No notes for slide


  • 1. Topic 2 Data Link Layer Part C The majority of the slides in this course are adapted from the accompanying slides to the books by Larry Peterson and Bruce Davie and by Jim Kurose and Keith Ross. Additional slides and/or figures from other sources and from Vasos Vassiliou are also included in this presentation.
  • 2. Media Access Control
    • Where
      • Central
        • Greater control
        • Simple access logic at station
        • Avoids problems of co-ordination
        • Single point of failure
        • Potential bottleneck
      • Distributed
    • How
      • Synchronous
        • Specific capacity dedicated to connection
      • Asynchronous
        • In response to demand
  • 3. Asynchronous Systems
    • Round robin
      • Good if many stations have data to transmit over extended period
    • Reservation
      • Good for stream traffic
    • Contention
      • Good for bursty traffic
      • All stations contend for time
      • Distributed
      • Simple to implement
      • Efficient under moderate load
      • Tend to collapse under heavy load
  • 4. Multiple 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)
      • traditional Ethernet
      • upstream HFC
      • 802.11 wireless LAN
  • 5. Multiple Access protocols
    • single shared broadcast channel
    • two or more simultaneous transmissions by nodes: interference
      • collision if node receives two or more signals at the same time
    • multiple access protocol
    • distributed algorithm that 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
  • 6. Ideal Mulitple Access Protocol
    • Broadcast channel of rate R bps
    • 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/M
    • 3. Fully decentralized:
      • no special node to coordinate transmissions
      • no synchronization of clocks, slots
    • 4. Simple
  • 7. MAC Protocols: a taxonomy
    • Three broad classes:
    • Channel Partitioning
      • divide channel into smaller “pieces” (time slots, frequency, code)
      • allocate piece to node for exclusive use
    • Random Access
      • channel not divided, allow collisions
      • “ recover” from collisions
    • “ Taking turns”
      • Nodes take turns, but nodes with more to send can take longer turns
  • 8. Channel Partitioning MAC protocols: TDMA
    • TDMA: time division multiple access
    • access to channel in "rounds"
    • each station gets fixed length slot (length = pkt trans time) in each round
    • unused slots go idle
    • example: 6-station LAN, 1,3,4 have pkt, slots 2,5,6 idle
    • TDM (Time Division Multiplexing): channel divided into N time slots, one per user; inefficient with low duty cycle users and at light load.
    • FDM (Frequency Division Multiplexing): frequency subdivided.
  • 9. Channel Partitioning MAC protocols: FDMA
    • FDMA: frequency division multiple access
    • channel spectrum divided into frequency bands
    • each station assigned fixed frequency band
    • unused transmission time in frequency bands go idle
    • example: 6-station LAN, 1,3,4 have pkt, frequency bands 2,5,6 idle
    • TDM (Time Division Multiplexing): channel divided into N time slots, one per user; inefficient with low duty cycle users and at light load.
    • FDM (Frequency Division Multiplexing): frequency subdivided.
    frequency bands time
  • 10. 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 MAC protocol specifies:
      • how to detect collisions
      • how to recover from collisions (e.g., via delayed retransmissions)
    • Examples of random access MAC protocols:
      • slotted ALOHA
      • ALOHA
  • 11. Slotted ALOHA
    • Assumptions
    • all frames same size
    • time is divided into equal size slots, time to transmit 1 frame
    • nodes start to transmit frames only at beginning of slots
    • nodes are synchronized
    • if 2 or more nodes transmit in slot, all nodes detect collision
    • Operation
    • when node obtains fresh frame, it transmits in next slot
    • no collision, node can send new frame in next slot
    • if collision, node retransmits frame in each subsequent slot with prob. p until success
  • 12. Slotted ALOHA
    • Pros
    • single active node can continuously transmit at full rate of channel
    • highly decentralized: only 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
  • 13. Slotted Aloha efficiency
    • Suppose N nodes with many frames to send, each transmits in slot with probability p
    • probability that node 1 has success in a slot = p(1-p) N-1
    • probability that any node has a success = Np(1-p) N-1
    • For max efficiency with N nodes, find p* that maximizes Np(1-p) N-1
    • For many nodes, take limit of Np*(1-p*) N-1 as N goes to infinity, gives 1/e = .37
    Efficiency is the long-run fraction of successful slots when there are many nodes, each with many frames to send At best: channel used for useful transmissions 37% of time!
  • 14. Pure (unslotted) ALOHA
    • unslotted Aloha: simpler, no synchronization
    • when frame first arrives
      • transmit immediately
    • collision probability increases:
      • frame sent at t 0 collides with other frames sent in [t 0 -1,t 0 +1]
  • 15. Pure ALOHA (2)
    • Vulnerable period for the shaded frame.
  • 16. Pure Aloha efficiency
    • P(success by given node) = P(node transmits) .
    • P(no other node transmits in [p 0 -1,p 0 ] .
    • P(no other node transmits in [p 0 -1,p 0 ]
    • = p . (1-p) N-1 . (1-p) N-1
    • = p . (1-p) 2(N-1)
    • … choosing optimum p and then letting n -> infty ...
    • = 1/(2e) = .18
    Even worse !
  • 17. ALOHA Efficiency
    • Throughput versus offered traffic for ALOHA systems.
  • 18. CSMA (Carrier Sense Multiple Access)
    • Propagation time is much less than transmission time
    • All stations know that a transmission has started almost immediately
    • First listen for clear medium (carrier sense)
    • If channel sensed busy, defer transmission
    • If channel sensed idle: transmit entire frame
      • Wait reasonable time (round trip plus ACK contention)
      • No ACK then retransmit
    • If two stations start at the same instant, collision
    • Max utilization depends on propagation time (medium length) and frame length
      • Longer frame and shorter propagation gives better utilization
  • 19. CSMA collisions collisions can still occur: propagation delay means two nodes may not hear each other’s transmission collision: entire packet transmission time wasted spatial layout of nodes note: role of distance & propagation delay in determining collision probability
  • 20. Nonpersistent CSMA
    • If medium is idle, transmit; otherwise, go to 2
    • If medium is busy, wait amount of time drawn from probability distribution (retransmission delay) and repeat 1
    •   Random delays reduces probability of collisions
      • Consider two stations become ready to transmit at same time
        • While another transmission is in progress
      • If both stations delay same time before retrying, both will attempt to transmit at same time
    • Capacity is wasted because medium will remain idle following end of transmission
      • Even if one or more stations waiting
    • Nonpersistent stations deferential
  • 21. 1-persistent CSMA
    • To avoid idle channel time, 1-persistent protocol used
    • Station wishing to transmit listens and obeys following :  
    • If medium idle, transmit; otherwise, go to step 2
    • If medium busy, listen until idle; then transmit immediately
    • 1-persistent stations selfish
    • If two or more stations waiting , collision guaranteed
      • Gets sorted out after collision
  • 22. P-persistent CSMA
    • Compromise that attempts to reduce collisions
      • Like nonpersistent
    • And reduce idle time
      • Like 1-persistent
    • Rules :
    • If medium idle, transmit with probability p, and delay one time unit with probability (1 – p)
      • Time unit typically maximum propagation delay
    • If medium busy, listen until idle and repeat step 1
    • If transmission is delayed one time unit, repeat step 1
    • What is an effective value of p ?
  • 23. Value of p?
    • Avoid instability under heavy load
    • n stations waiting to send
    • End of transmission, expected number of stations attempting to transmit is number of stations ready times probability of transmitting
      • n x p
    • If n x p > 1 on average there will be a collision
    • Repeated attempts to transmit almost guaranteeing more collisions
    • Retries compete with new transmissions
    • Eventually, all stations trying to send
      • Continuous collisions ; zero throughput
    • So nxp < 1 for expected peaks of n
    • If heavy load expected , p small
    • However, as p made smaller, stations wait longer
    • At low loads, this gives very long delays
  • 24. Persistent and Nonpersistent CSMA
    • Comparison of the channel utilization versus load for various random access protocols.
  • 25. Which Persistence Algorithm?
    • IEEE 802.3 uses 1-persistent
    • Both nonpersistent and p-persistent have performance problems
    • 1-persistent ( p = 1 ) seem s more unstable than p-persistent
      • Greed of the stations
      • But wasted time due to collisions is short (if frames long relative to propagation delay
      • With random backoff, unlikely to collide on next tries
      • To ensure backoff maintains stability, IEEE 802.3 and Ethernet use binary exponential backoff
  • 26. CSMA/CD (Collision Detection)
    • With CSMA, collision occupies medium for duration of transmission
    • Stations listen whilst transmitting
    • If medium idle, transmit , otherwise, step 2
    • If busy, listen for idle, then transmit
    • If collision detected, jam then cease transmission
    • After jam, wait random time then start from step 1
  • 27. CSMA/CD
    • CSMA/CD: carrier sensing, deferral as in CSMA
      • collisions detected within short time
      • colliding transmissions aborted, reducing channel wastage
    • collision detection:
      • easy in wired LANs: measure signal strengths, compare transmitted, received signals
      • difficult in wireless LANs: receiver shut off while transmitting
    • human analogy: the polite conversationalist
  • 28. CSMA/CD collision detection
  • 29. CSMA/CD
  • 30. CSMA/CD Operation
  • 31. “Taking Turns” MAC protocols
    • Polling:
    • master node “invites” slave nodes to transmit in turn
    • concerns:
      • polling overhead
      • latency
      • single point of failure (master)
    • Token passing:
    • control token passed from one node to next sequentially.
    • token message
    • concerns:
      • token overhead
      • latency
      • single point of failure (token)
  • 32. Summary of MAC protocols
    • What do you do with a shared media?
      • Channel Partitioning, by time, frequency or code
        • Time Division, Frequency Division
      • Random partitioning (dynamic),
        • 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 a central site, token passing
  • 33. Summary of MAC protocols
    • 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!
  • 34. Ethernet Overview
    • History
      • developed by Xerox PARC in mid-1970s
      • roots in Aloha packet-radio network
      • standardized by Xerox, DEC, and Intel in 1978
      • similar to IEEE 802.3 standard
    Metcalfe’s Ethernet sketch
  • 35. Ethernet
    • “ dominant” wired LAN technology:
    • cheap $20 for 100Mbs!
    • first widely used LAN technology
    • Simpler, cheaper than token LANs and ATM
    • Kept up with speed race: 10 Mbps – 10 Gbps
  • 36. Star topology
    • Bus topology popular through mid 90s
    • Now star topology prevails
    • Connection choices: hub or switch (more later)
    hub or switch
  • 37. Ethernet Frame Structure
    • Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
    • Preamble:
    • 7 bytes with pattern 10101010 followed by one byte with pattern 10101011
    • used to synchronize receiver, sender clock rates
  • 38. Ethernet Frame Structure (more)
    • Addresses: 6 bytes
      • if adapter receives frame with matching destination address, or with broadcast address (eg ARP packet), it passes data in frame to net-layer protocol
      • otherwise, adapter discards frame
    • Type: indicates the higher layer protocol (mostly IP but others may be supported such as Novell IPX and AppleTalk)
    • CRC: checked at receiver, if error is detected, the frame is simply dropped
  • 39. Unreliable, connectionless service
    • Connectionless: No handshaking between sending and receiving adapter.
    • Unreliable: receiving adapter doesn’t send acks or nacks to sending adapter
      • stream of datagrams passed to network layer can have gaps
      • gaps will be filled if app is using TCP
      • otherwise, app will see the gaps
  • 40. Ethernet uses CSMA/CD
    • No slots
    • adapter doesn’t transmit if it senses that some other adapter is transmitting, that is, carrier sense
    • transmitting adapter aborts when it senses that another adapter is transmitting, that is, collision detection
    • Before attempting a retransmission, adapter waits a random time, that is, random access
  • 41. Ethernet CSMA/CD algorithm
    • 1. Adaptor receives datagram from net layer & creates frame
    • 2. If adapter senses channel idle, it starts to transmit frame. If it senses channel busy, waits until channel idle and then transmits
    • 3. If adapter transmits entire frame without detecting another transmission, the adapter is done with frame !
    • 4. If adapter detects another transmission while transmitting, aborts and sends jam signal
    • 5. After aborting, adapter enters exponential backoff : after the mth collision, adapter chooses a K at random from {0,1,2,…,2 m -1}. Adapter waits K · 512 bit times and returns to Step 2
  • 42. Ethernet’s CSMA/CD (more)
    • Jam Signal: make sure all other transmitters are aware of collision; 48 bits
    • Bit time: .1 microsec for 10 Mbps Ethernet ; for K=1023, wait time is about 50 msec
    • Exponential Backoff:
    • Goal : adapt retransmission attempts to estimated current load
      • heavy load: random wait will be longer
    • first collision: choose K from {0,1}; delay is K · 512 bit transmission times
    • after second collision: choose K from {0,1,2,3}…
    • after ten collisions, choose K from {0,1,2,3,4,…,1023}
    See/interact with Java applet on AWL Web site: highly recommended !
  • 43. Collision Detection
    • On baseband bus, collision produces much higher signal voltage than signal
    • Collision detected if cable signal greater than single station signal
    • Signal attenuated over distance
    • Limit distance to 500m (10Base5) or 200m (10Base2)
    • For twisted pair (star-topology) activity on more than one port is collision
    • Special collision presence signal
  • 44. Algorithm (cont)
    • If collision…
      • jam for 32 bits, then stop transmitting frame
      • minimum frame is 64 bytes (header + 46 bytes of data)
      • delay and try again
        • 1st time: 0 or 51.2us
        • 2nd time: 0, 51.2, or 102.4us
        • 3rd time51.2, 102.4, or 153.6us
        • nth time: k x 51.2us, for randomly selected k =0..2 n - 1
        • give up after several tries (usually 16)
        • exponential backoff
  • 45. Binary Exponential Backoff
    • Attempt to transmit repeatedly if repeated collisions
    • First 10 attempts, mean value of random delay doubled
    • Value then remains same for 6 further attempts
    • After 16 unsuccessful attempts, station gives up and reports error
    • As congestion increases, stations back off by larger amounts to reduce the probability of collision.
    • 1-persistent algorithm with binary exponential backoff efficient over wide range of loads
      • Low loads, 1-persistence guarantees station can seize channel once idle
      • High loads, at least as stable as other techniques
    • Backoff algorithm gives last-in, first-out effect
    • Stations with few collisions transmit first
  • 46. Ethernet MAC Sublayer Protocol (2)
  • 47. Ethernet Performance
    • Efficiency of Ethernet at 10 Mbps with 512-bit slot times.
  • 48. CSMA/CD efficiency
    • T prop = max prop between 2 nodes in LAN
    • t trans = time to transmit max-size frame
    • Efficiency goes to 1 as t prop goes to 0
    • Goes to 1 as t trans goes to infinity
    • Much better than ALOHA, but still decentralized, simple, and cheap
  • 49. Ethernet Cabling
    • The most common kinds of Ethernet cabling.
  • 50. Ethernet Cabling (2)
    • Three kinds of Ethernet cabling.
    • (a) 10Base5, (b) 10Base2, (c) 10Base-T.
  • 51. Ethernet Cabling (3)
    • Cable topologies. (a) Linear, (b) Spine, (c ) Tree, (d) Segmented.
  • 52. 10BaseT and 100BaseT
    • 10/100 Mbps rate; latter called “fast ethernet”
    • T stands for Twisted Pair
    • Nodes connect to a hub: “star topology”; 100 m max distance between nodes and hub
    twisted pair hub
  • 53. 100Mbps Fast Ethernet
    • Use IEEE 802.3 MAC protocol and frame format
    • 100BASE-X use physical medium specifications from FDDI
      • Two physical links between nodes
        • Transmission and reception
      • 100BASE-TX use s STP or Cat . 5 UTP
        • May require new cable
      • 100BASE-FX uses optical fiber
      • 100BASE-T4 can use Cat . 3, voice-grade UTP
        • Uses four twisted-pair lines between nodes
        • Data transmission uses three pairs in one direction at a time
    • Star -wire topology
      • Similar to 10BASE-T
  • 54. Fast Ethernet
    • The original fast Ethernet cabling.
  • 55. Gigabit Ethernet
    • Gigabit Ethernet cabling.
  • 56. Ethernet (cont)
    • Addresses
      • unique, 48-bit unicast address assigned to each adapter
      • example: 8:0:e4:b1:2
      • broadcast: all 1 s
      • multicast: first bit is 1
    • Bandwidth: 10Mbps, 100Mbps, 1Gbps
    • Length: 2500m (500m segments with 4 repeaters)
    • Problem: Distributed algorithm that provides fair access
  • 57. Wireless Link Characteristics
    • Differences from wired link ….
      • decreased signal strength: radio signal attenuates as it propagates through matter (path loss)
      • interference from other sources: standardized wireless network frequencies (e.g., 2.4 GHz) shared by other devices (e.g., phone); devices (motors) interfere as well
      • multipath propagation: radio signal reflects off objects ground, arriving ad destination at slightly different times
    • … . make communication across (even a point to point) wireless link much more “difficult”
  • 58. Wireless network characteristics
    • Multiple wireless senders and receivers create additional problems (beyond multiple access):
    • Hidden terminal problem
    • B, A hear each other
    • B, C hear each other
    • A, C can not hear each other
    • means A, C unaware of their interference at B
    • Signal fading:
    • B, A hear each other
    • B, C hear each other
    • A, C can not hear each other interferring at B
    A B C A B C A’s signal strength space C’s signal strength
  • 59. IEEE 802.11 Wireless LAN
    • 802.11b
      • 2.4-5 GHz unlicensed radio spectrum
      • up to 11 Mbps
      • direct sequence spread spectrum (DSSS) in physical layer
        • all hosts use same chipping code
      • widely deployed, using base stations
    • 802.11a
      • 5-6 GHz range
      • up to 54 Mbps
    • 802.11g
      • 2.4-5 GHz range
      • up to 54 Mbps
    • All use CSMA/CA for multiple access
    • All have base-station and ad-hoc network versions
  • 60. Figure 3-12 ISM bands
  • 61. 802.11 LAN architecture
    • wireless host communicates with base station
      • base station = access point (AP)
    • Basic Service Set (BSS) (aka “cell”) in infrastructure mode contains:
      • wireless hosts
      • access point (AP): base station
      • ad hoc mode: hosts only
    BSS 1 BSS 2 hub, switch or router Internet AP AP
  • 62. 802.11: Channels, association
    • 802.11b: 2.4GHz-2.485GHz spectrum divided into 11 channels at different frequencies
      • AP admin chooses frequency for AP
      • interference possible: channel can be same as that chosen by neighboring AP!
    • host: must associate with an AP
      • scans channels, listening for beacon frames containing AP’s name (SSID) and MAC address
      • selects AP to associate with
      • may perform authentication [Chapter 8]
      • will typically run DHCP to get IP address in AP’s subnet
  • 63. IEEE 802.11: multiple access
    • avoid collisions: 2 + nodes transmitting at same time
    • 802.11: CSMA - sense before transmitting
      • don’t collide with ongoing transmission by other node
    • 802.11: no collision detection!
      • difficult to receive (sense collisions) when transmitting due to weak received signals (fading)
      • can’t sense all collisions in any case: hidden terminal, fading
      • goal: avoid collisions: CSMA/C(ollision)A(voidance)
    A B C A B C A’s signal strength space C’s signal strength
  • 64. IEEE 802.11 MAC Protocol: CSMA/CA
    • 802.11 sender
    • 1 if sense channel idle for DIFS then
      • transmit entire frame (no CD)
    • 2 if sense channel busy then
      • start random backoff time
      • timer counts down while channel idle
      • transmit when timer expires
      • if no ACK, increase random backoff interval, repeat 2
    • 802.11 receiver
    • - if frame received OK
    • return ACK after SIFS (ACK needed due to hidden terminal problem)
    sender receiver DIFS data SIFS ACK
  • 65. Avoiding collisions (more)
    • idea: allow sender to “reserve” channel rather than random access of data frames: avoid collisions of long data frames
    • sender first transmits small request-to-send (RTS) packets to BS using CSMA
      • RTSs may still collide with each other (but they’re short)
    • BS broadcasts clear-to-send CTS in response to RTS
    • RTS heard by all nodes
      • sender transmits data frame
      • other stations defer transmissions
    Avoid data frame collisions completely using small reservation packets!
  • 66. Collision Avoidance: RTS-CTS exchange AP A B time defer RTS(A) RTS(B) RTS(A) CTS(A) CTS(A) DATA (A) ACK(A) ACK(A) reservation collision
  • 67. IEEE 802 Standards The 802 working groups. The important ones are marked with *. The ones marked with  are hibernating. The one marked with † gave up.