Document Sample
MAC Powered By Docstoc
					Medium Access Control
       Zhibin Wu
                        Lecture Overview
   Introduction
   Random Access
    –   Aloha
    –   Slotted Aloha
    –   CSMA
    –   CSMA/CD
    –   CSMA/CA
   Scheduled Access
    – TDMA
    – Dynamic TDMA
   Spread-Spectrum/CDMA
                 Medium Access Sublayer


                                     LLC        Link layer control
           Data link
                                     MAC        Medium access control

   Medium access (MAC) sublayer is not relevant on point-to-point links
   The MAC sublayer is only used in broadcast or shared channel networks
   All communication entities “share” a common channel
   Examples:
     – Wired networks: Ethernet LAN
     – Wireless & Mobile Networks: Satellite, Cellular, Wireless LAN,
     – Packet radio network?
                 Share a Channel Ideally

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
               Random Access Protocols

   Single channel shared by a large number of hosts
   No coordination between hosts
   Control is completely distributed
   Examples: ALOHA, CSMA, CSMA/CD
                 Scenarios of ALOHA

   A group of nodes trying
    to sending frames to a
    central node
   Star-topology.
   Not a complete solution
    for bi-directional
     – For half-duplex
       device, what if a data
       packet arrives while it
       is receiving?
                          Pure Aloha

   In Pure Aloha, frames are transmitted at completely arbitrary
                    Aloha Algorithm

1.   Transmit whenever you have data to send
2.   Listen to the broadcast (probably a separate channel)
     – Because broadcast is fed back, the sending host can
       always find out if its packet was destroyed just by
       listening to the downward broadcast one round-trip
       time after sending the packet
3.   If the packet was destroyed, wait a random amount of
     time and send it again
     – The waiting time must be random to prevent the same
       packets from colliding over and over again
                      Vulnerable Period

   Vulnerable period for the shaded frame is 2t
   Note that if the first bit of a new packet overlaps with the last bit
    of a packet almost finished, both packets are totally destroyed.
    (No capture effect)
                             Analysis of Aloha

   Packet Arrival is Poisson Process
   P [k arrivals in t seconds] = e  t (t ) k
   Let G be the total number of frames attempted in t seconds
     – P [k attempts in t seconds] = Gt k
                                               e   (Gt )
   Conditional successful probability for one attempt is :
     – P0 = P [0 other attempts in 2t seconds] =e-2Gt
   Set t as unit frame time
   Let S be the mean number of successful attempts
   S=GP0=Ge-2G
   S is optimum at G=1/2
   S=1/2e = 0.184
                        Slotted Aloha

   Transmission of frames are synchronized slot by slot.
   Channel feedback about whether packet is received or not
             Slotted Aloha (Continued)

   Slotted ALOHA cuts the vulnerable period for packets
    from 2t to t.
   Time is slotted. Packets must be transmitted within a
   Procedure
    1. If a host has a packet to transmit, it waits until the
       beginning of the next slot before sending
    2. Listen to the broadcast and check if the packet was
    3. If there was a collision, wait a random number of slots
       and try to send again
               Analysis of Slotted ALOHA

   Packet Arrival is Poisson Process
   P [k arrivals in t seconds] =   e  t (  t ) k

   Let G be the total number of frames attempted in t seconds
     – P [k attempts in t seconds] =  e  Gt (Gt ) k
   Successful probability for each slot is :
     P [1 attempts in a t seconds slot] =Ge-Gt
   Set Slot time t as unit time, then S=Ge-G
   S is optimum at G=1
   S=1/e = 0.368
                    Performance of ALOHA

   Throughput versus offered traffic for ALOHA systems
   The main reason for poor channel utilization of ALOHA (pure or slotted) is
    that all stations can transmit at will, without paying attention to what the
    other stations are doing.

   Protocols in which stations listen for a carrier
    (i.e., a transmission) and act accordingly are
    called carrier sense protocols.
   There are several types of CSMA protocols:
    – Non-Persistent CSMA
    – 1-Persistent CSMA
    – P-Persistent CSMA
       Assumptions with CSMA Networks

   Constant length packets
   No errors, except those caused by collisions
   No capture effect
   Each host can sense the transmissions of all
    other hosts
   The propagation delay is small compared to the
    transmission time
                     Propagation Delay

          A          B         C           D

   D only sense A’s transmission after a propagation delay τ
   If τ is larger than packet transmission time, there are too much
    time wastage.
   CSMA in satellite communication? No.

     The size (length) of the network must be limited!
                   Non-persistent CSMA

   To send data, a station first listens to the channel to see if
    anyone else is transmitting.
   If so, the station waits a random period of time (instead of
    keeping sensing until the end of the transmission) and repeats
    the algorithm. Otherwise, it transmits a frame.
   If a collision occurs, the station waits a random amount of time
    and starts all over again.
   propagation delay is a constant common to all nodes:
    –   a is the ratio of propagation delay to packet transmission time
     Analysis of Non-persistent CSMA
           Unsuccessful                       Successful
           transmission                       transmission
           period                             period
                                                                 Normalized Time

    Y          1                              1
     a                         Idle period   Busy period
         Busy period

   S= U/(B+I)
   B = Y + 1 + a , I = 1/G
   U = e-aG                                           Ge  aG
                                             S 
   FY(y)=P{no packet occur in an                G (1  2a )  e  aG
    duration of a-y } = e-G(a-y)
     E (Y )  a            (1  e  aG )
                 Discussion of Collisions

   What's the effect of signal propagation delay a?
    –   The longer the delay, the more the collisions, and the worse the
        performance of the protocol.

   How about zero propagation delay ?
    –   There still exist chances of collisions. S = G/(1+G)

   Is this protocol any better than ALOHA (both pure and
    slotted) ?
    –   Yes, because both stations have the decency to desist from
        interfering with the third station's frame.
                      1-persistent CSMA
1-persistent CSMA (Carrier Sense Multiple Access):
    1. To send data, a station first listens to the channel to see if anyone else is
    2. If so, the station waits (keeps sensing it) until the channel becomes idle.
       Otherwise, it transmits a frame.
    3. If a collision occurs, the station waits a random amount of time and
       starts all over again.

   It is called 1-persistent because the station transmits with a
    probability of 1 whenever it starts sensing the channel and finds
    the channel idle. (Greedy)
   This protocol has worse channel utilization than non-persistent
    Tradeoff between Non-persistent and 1-persistent

   If B and C become ready in the middle of A’s
     – 1-Persistent: B and C collide
     – Non-Persistent: B and C probably do not collide

   If only B becomes ready in the middle of A’s
     – 1-Persistent: B succeeds as soon as A ends
     – Non-Persistent: B may have to wait
                          P-persistent CSMA

   Assume channels are slotted
   One slot = contention period (i.e., one round trip propagation delay)

   Sense the channel
     – If channel is idle, transmit a packet with probability p
            if a packet was transmitted, go to step 2
            if a packet was not transmitted, wait one slot and go to step 1
     – If channel is busy, wait one slot and go to step 1.
     – In other words, wait until idle and then transmit with probability p
   Detect collisions
     – If a collision occurs, wait a random amount of time and go to step 1
Persistent and Non-persistent CSMA

Comparison of the channel utilization versus load for
          various random access protocols.
        CSMA with Collision Detection

CSMA/CD (Carrier Sense Multiple Access with Collision
   Detection) protocol further improves ALOHA by aborting
   transmissions as soon as a collision is detected.

The conceptual model:
•   To send data, a station first listens to the channel to see if anyone else
    is transmitting.
•   If so, the station waits until the end of the transmission (1-persistent)
    or wait a random period of time and repeats the algorithm (non-
    persistent). Otherwise, it transmits a frame.
•   If a collision occurs, the station will detect the collision, abort its
    transmission, waits a random amount of time, and starts all over again.
                      How to Detect Collision

   Prerequisite: A node can listening while talking   Tx   Rx
   Ethernet cables
                      CSMA/CD Continued

•   CSMA/CD can be in one of three states: contention, transmission, or
•   The minimum time to detect the collision is the time it takes the
    signal to propagate from one station to the other.
•   How long could the transmitting station be sure it has seized the
    network ? ( or 2 ? where  is time equal to the full propagation)
•   Model the contention interval as slotted aloha with slot width 2

   Wireless LAN
   How can detect collision if you cannot listening while talking?
   Collision Avoidance
    – Random Backoff (instead of 1-persistent)
    – RTS/CTS
   CS no longer works well
    – Rules:
           carrier    ==> do not transmit
           no carrier ==> OK to transmit
    – But the above rules do not always apply to wireless.
         Problems with carrier sensing

Hidden terminal problem

                                      W finds that medium is free
                                      and it transmits a packet to Z

                no carrier ===> OK to transmit
         Problems with carrier sensing

Exposed terminal problem
                                                Z is transmitting
                                                to W

            X              Y

        Y will not transmit to X
        even though it cannot interfere

         Presence of carrier ===> hold off transmission
    Solving Hidden Node problem with RTS/CTS

- listen RTS             RTS                         CTS
- wait long enough
  for the requested
                         X              Z
  station to respond
  with CTS                                              - listen CTS
- if (timeout) then            Y
     ready to transmit
                                                W       - wait long enough
                                                          for the transmitter
                                                          to send its data

   listen RTS ==> transmitter is close to me
   listen CTS ==> receiver is close to me

 Note: RTS/CTS does not solve exposed terminal problem. In the example above,
 X can send RTS, but CTS from the responder will collide with Y’s data.
                  RTS/CTS exchange example

                  RTS                Frame

                        CTS                          ACK
                  352    304          8192 s         304
                  µs 10 µs                         10 µs
                      µs       µs                  µs
Dest                                NAV (RTS)

                                       NAV (CTS)

    RTS + CTS + Frame + ACK exchange invoked when frame size is large
    NAV (Network Allocation Vector)
      – NAV maintains prediction of future traffic on the medium based on duration
        information that is announced in RTS/CTS frames prior to actual exchange of data
          Pros & Cons of Random Access

   Advantages
    – Short delay for bursty traffic
    – Simple (due to distributed control)
    – Flexible to fluctuations in the number of hosts
    – Fairness
   Disadvantages
    – Low channel efficiency with a large number of hosts
    – Not good for continuous traffic (e.g., voice)
    – Cannot support priority traffic
    – High variance in transmission delays
                     Scheduled Access

   TDMA
   Dynamic TDMA
   Widely used
    – cellular,
    – Wi-Fi (HyperLAN),
    – IEEE 802.16
    – Wireless ATM
   Time Division Multiple Access
                      TDMA Continued

   access to channel in "rounds"
   each station gets fixed length slot (length = packet transmission
    time) in each round
   unused slots go idle
   example: 6-station LAN, 1,3,4 have packets, slots 2,5,6 idle
                                            Dynamic TDMA

   In dynamic time division multiple access, a scheduling
    algorithm dynamically reserves a variable number of timeslots
    in each frame to variable user data streams, based on the traffic
    demand of each user data stream.
   Negotiations (beforehand) to determine how to allocate slots
                                                     TDMA Frame
                      TDM Downlink                                               D-TDMA Uplink

                                                             Burst from User A     User B        User C
                Burst from Access Point -> Mobiles
                                                              To Access Point
    Summary of Scheduled Access Protocols

   Avoid of contention/collision; better channel efficiency with a
    large number of hosts

   predetermined channel allocation
   Need centralized control
   Require global synchronization
   Guard time period to protect slots
   Delay?
             Spread Spectrum and CDMA

   What if not divide up the channel by time (as in TDMA), or
    frequency (as in FDMA)? Is collision inevitable?
   Not if collision is no longer damaging!
    – Is there any way to decode bits garbled by other overlapping

CDMA based on Spread Spectrum
 A new perspective to solve multiple access problems

 Spread Spectrum is a PHY innovation, not a MAC technique.

   CDMA encodes data with a special code associated with each
    user and uses the constructive interference properties of the
    special codes to perform the multiplexing.
                   Spread Spectrum

   Idea
     – spread signal over wider frequency band than required
    – originally deigned to thwart jamming
   Frequency Hopping
     – transmit over random sequence of frequencies
    – sender and receiver share…
           pseudorandom number generator
           seed
                Spread Spectrum (cont)

   Direct Sequence
     – for each bit, send XOR of that bit and n random bits
     – random sequence known to both sender and receiver
     – called n-bit chipping code
     – 802.11 defines an 11-bit chipping code

0                                             Data stream: 1010

0                                             Random sequence: 0100101101011001

0                                             XOR of the two: 1011101110101001
      Code Division Multiple Access (CDMA)

   Multiplexing Technique used with spread spectrum
   Start with data signal rate D
     – Called bit data rate
   Break each bit into k chips according to fixed pattern specific to each user
     – User’s code
   New channel has chip data rate kD chips per second
   E.g. k=6, three users (A,B,C) communicating with base receiver R
   Code for A = <1,-1,-1,1,-1,1>
   Code for B = <1,1,-1,-1,1,1>
   Code for C = <1,1,-1,1,1,-1>
CDMA Example
                        CDMA Explanation

   Consider A communicating with base
   Base knows A’s code
   Assume communication already synchronized
   A wants to send a 1
     – Send chip pattern <1,-1,-1,1,-1,1>
            A’s code
   A wants to send 0
     – Send chip[ pattern <-1,1,1,-1,1,-1>
            Complement of A’s code
   Decoder ignores other sources when using A’s code to decode
     – Orthogonal codes
        Topics Not Covered in This Lecture

   Dynamic behavior of Aloha
    – Strict mathematical analysis
    – Stabilize Aloha systems with channel feedback
   Taking Turns MAC protocols
    – Token Ring
   FDMA

Shared By: