1 / 33

CMPT 371

CMPT 371. Data Communications and Networking LANs 2: MAC protocols. Point to point link. Direct connection between two hosts, medium connecting hosts is 100% available to the two endpoint hosts. Broadcast link. The medium connecting the hosts is shared between many hosts.

bob
Télécharger la présentation

CMPT 371

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CMPT 371 Data Communications and Networking LANs 2: MAC protocols

  2. Point to point link • Direct connection between two hosts, medium connecting hosts is 100% available to the two endpoint hosts

  3. Broadcast link • The medium connecting the hosts is shared between many hosts. • Each time a frame is sent (broadcast or unicast) every other host attached to the medium receives a copy • A multiple access protocol is used to define how that sharing is accomplished

  4. Medium Access Control • LAN is a single shared broadcast channel • Transmission of a frame may be initiated at any time, or only at the beginning of defined ‘slots’ • Two or more simultaneous transmissions by nodes on the LAN will collide and cause interference • only one node can successfully send at any given time • communication about channel sharing must use channel itself • stations may or may not be able to ‘sense’ a transmission from another station on the network • Need a distributed set of procedures that determines how to share the channel. Such procedures are defined in a Medium Access Control Protocol (MAC Protocol)

  5. MAC Protocols • Static Channel Allocation or Channel Partitioning • divide channel into time slots, frequency bands, code channels, may use a round robin technique • allocate one to each node for exclusive use • Contention or Random Access • Allow and recover from collisions • for bursty traffic • Straightforward to implement • adequate for light to moderate loads • Taking turns protocols • tightly coordinate shared access to avoid collisions • Reservation methods poll stations each cycle, but reserve transmission slots of for stations with data to transmit. (slightly more overhead than round robin, but improved efficiency due to avoiding empty slots)

  6. Channel Partitioning MAC: TDMA TDMA: time division multiple access (used for some cellular telephones ) • access to channel in “cycles" • each station gets fixed length slot (length = pkt trans time) in each cycle • unused slots go idle, channel utilization may be low • example: 6-station LAN • Frame 1: 1,2,4,5 have pkt, slots 2 and 6 idle • Frame 2: 2,5,6 have pkt, slots 1 ,3,4 idle D D D D D D D 1 frame (6 slots)

  7. Channel Partitioning MAC: FDMA FDMA: frequency division multiple access (used for some cellular telephones ) • Spectrum divided into frequency bands • Each station assigned a fixed frequency band • unused transmission time in frequency bands go idle • example: 6-station LAN • Frame 1: 1,2,4,5 have pkt, slots 2 and 6 idle • Frame 2: 2,5,6 have pkt, slots 1 ,3,4 idle Spectrum of frame 1 (6 bands)

  8. Channel Partitioning (CDMA) CDMA (Code Division Multiple Access) • Used mostly in wireless broadcast channels such as cellular phones • All users share same frequency band. Information from each user is spread throughout that frequency band • Each user has their own orthogonal Walsh code ‘chipping’ sequence to encode data. • encoded signal = (original data) X (Walsh code) • Encoded signals from each channel are added, the summed signal is transmitted • The orthogonal property of Walsh codes guarantees that (ignoring transmission errors) multiplying the received signal by a Walsh code will extract the data for the channel encoded using that Walsh code from the received (summed) signal. • Decoded signal = (received summed signal X Walsh code)

  9. Random Access Protocols • When node has packet to send it transmits that packet at full channel data rate R. • When two or more nodes transmit at the same time a collision occurs • A Random Access MAC protocol specifies how to detect and recover from collisions • Examples of Random Access MAC Protocols: • ALOHA, Slotted ALOHA • CSMA, CSMA/CD

  10. Any packet starting between t0 and t0-1 colides Any packet starting between t0 and t0+1 collides Packet from other station Packet from station i Packet from other station t0-1 t0 t0+1 Pure (unslotted) ALOHA • No synchronization, simplest possible approach • When frame arrives at a station transmit immediately • Listen for an ACK for twice the maximum propagation time between stations in the network plus a small additional time • Retransmit if no ACK is received • A frame of duration (transmission time) 1 sent by station i at time t0. It will collide with frames sent by other stations in the time interval [t0-1,t0+1]

  11. Pure Aloha efficiency • Frames are generated at a rate of N per frame transmission time. If N>1 frames are being generated at a rate faster than they can possibly be transmitted (even in ideal conditions) • Frames may also be retransmitted. The average number of frames (original and retransmitted) transmitted in one frame transmission time is G. • Let P0 be the probability that the frame does not suffer a collision is P0=e-2G (for a Poisson distribution) • The throughput, S, (or efficiency) is the product of P0 and the load presented G S=Ge-2G • At G = 0.5 the maximum value of S (S=0.18) is attained THE BEST WE CAN HOPE FOR IS 18%

  12. All nodes are synchronized so time can be divided into fixed length slots, with the first slot beginning at a reference time Duration of a slot is transmission time of 1 frame When 2 or more nodes transmit in the same slot, all nodes detect the resulting collision A frame begins transmission at the beginning of a slot, After a collision the node retransmits frame. The probability that the frame will be retransmitted in each subsequent slot will be P (until retransmission occurs) Slotted ALOHA

  13. single node can continuously transmit at full rate of channel Slots in nodes need to be in sync between nodes Frames that overlap do so completely, reducing contentions Collisions cause frequent retransmission, idle slots Nodes may be able to detect collision in less than time to transmit packet so extra time is spent transmitted packets known to be corrupted Node 1 Node 1 Node 1 Node 2 Node 2 Node 2 Node 3 Node 3 Node 4 Node 4 Node 4 Retransmit success Retransmit success Retransmit success Retransmit success success collision collision collision Slotted ALOHA

  14. Slotted Aloha efficiency • Utilization is the number of successful transmissions as a fraction of slots available • Let P0 be the probability that the frame does not suffer a collision is P0=e-2G (for a Poisson distribution) • The probability of transmission on the kth try is Pk = P( k-1 collisions) * P( successful transmission) = ( 1-e-2G )k-1 e-2G • The expected number of transmissions for each packet is • The maximum throughput is then the presented load time the expected number of retransmissions S=Ge-G is a minimum, that is G=1 • The channel used for successful transmissions no more than 37% of time

  15. Carrier Sense Multiple Access CSMA: listen (sense channel) before transmit: • If channel sensed idle: Transmit entire frame immediately • If channel sensed busy: • 1-persistant CSMA: Listen until the channel is available then the station transmits as soon as the medium is available (immediately with probability 1) • Non-persistant CSMA: station waits a random time period and the checks the medium again, transmitting immediately if the channel is now free (better U but longer delays) • P-persistant CSMA: Listen until the channel is available, then transmit with probability p. (Probability q=1-p that the station will wait one time period, usually the maximum propagation delay, to transmit) • Channel is not sensed during transmission, whole packet is sent even if a collision occurs

  16. CSMA collisions • collisions can still occur: propagation delay means two nodes may not hear each other’s transmissions • Consider node A starts transmitting packet 1 at time t0. Node C starts transmitting packet 2 at time t1. The propagation time from A to C is 2t1 Collision has occurred but has not been detected Time t2=1.5*t1 C B A Collision detected at station B starting at time 2t1 Time t3=2*t1 A C B A Collision may never detected at station A or station C Time t3=2.5*t1 B C

  17. CSMA/CD (Collision Detection) • A station has a packet to transmit, packets are long enough that transmission time is longer than the end to end propagation time in the network (otherwise becomes no more efficient the plain CSMA) • If the medium is idle, transmit immediately • If the medium is busy listen until the medium is available • If a collision is detected, • transmit a short jamming signal to inform all stations there has been a collision • Then wait a random length of time (referred to as the backoff) and retransmit

  18. Binary Exponential Backoff • When a collision is detected, • transmit a short jamming signal to inform all stations there has been a collision • Then wait a length of time, L, chosen from a random distribution with mean, M. L is referred to as the backoff. After time L retransmit • Each time a collision is detected for a retransmitted frame the mean of the random distribution is doubled. An L is chosen from the new distribution and the frame is retransmitted after time L. • The doubling of the mean of the distribution continues for the first 10 retransmissions. For retransmission attempts 11 to 16 the random distribution remains the same. • After 16 retransmissions the station gives up and reports an error

  19. Collision Detection • Collisions detected within short time • ‘Short time’ • For the detecting station is the propagation time from the sending station to the detecting station • The sending station learns of the collision when the jamming signal reaches it, after a time equal to twice the propagation time. • Easier in wired LANs: measure signal strengths, compare transmitted, received signals. Possible difficulties with attenuation along very long propagations paths, when transmitted signal powers may fall below detection levels. • More difficult in wireless LANs: receiver shut off while transmitting • Reduces channel wastage by reducing amount of time transmitting during contention conditions.

  20. CSMAcollisions and CSMA/CD • Consider node A starts transmitting packet 1 at time t0. Node C starts transmitting packet 2 at time t1. The propagation time from A to C is 2t1 Collision has occurred but has not been detected t2=1.5*t1 C A B Collision detected at stations B t3=2*t1 A A D B C Collision detected by A and C.station A and C send jamming signal t3=3*t1 B A D C

  21. CSMAcollisions and CSMA/CD • Consider node A starts transmitting packet 1 at time t0. Node C starts transmitting packet 2 at time t1. The propagation time from A to C is 2t1 Collision detected by A and C.station A and C send jamming signal t3=3*t1 C D B A jamming signal received by B and D t3=4*t1 C D B A A and C. receive jamming signal t3=5*t1 B A

  22. MAC protocols Network Layer Data Link Layer 802.2 Logical Link Control (LLC) 802.3 Ethernet 802.4 Token Ring 802.11 Wireless 802.5 Token Bus Physical Layer

  23. IEEE 802 Protocol Layers Stallings 2003: fig 15.5

  24. MAC Frame • Preamble: 7 octets of alternating 1’s and 0’s used to establish sychronization • Start Frame Delimiter (SFD): The sequence 10101011 used to indicate the start of the frame. • Destination address (DA): address of the station for which the frame is intended (MAC address of interface) • Source address (SA): The address of the station that sent the frame • Length/Type: Length of the LLC data field (<1500 octets), or the type of protocol (if not 802.3) • Pad: added to make sure the transmission time of the packet is at least as long as the propagation time through the network (required for efficient use of CSMA/CD) • FCS: 32 bit CRC

  25. IEEE 802.3 (Ethernet MAC Frame) IEEE 802.11 (Wireless MAC Frame) Stallings 2000: fig 14.2, 17.8

  26. Taking turns MAC protocols channel partitioning MAC protocols: • share channel efficiently and fairly at high load • inefficient at low load due to ‘idle’ slots Random access MAC protocols • efficient at low load: single node can fully utilize channel • collision overhead increases with load Taking turns protocols • look for best of both • Poll, transmit only when polled or only when told by central station • Use token passing (e.g. a token ring network)

  27. Polling • Eliminate collisions and empty frames • Controlled by a central station which • Sends a Poll message to start selected station transmitting • Watches for the end of the data transmitted by the station (no signal on the link for some limiting time > round trip travel time between the central station and the polled station = delay time) • Repeats the previous 2 steps until all hosts on the broadcast link have been polled • Repeats the polling of the whole set of stations • Addition overhead of delay time for each host, even if host has no data to transmit • If master node fails, whole link fails

  28. Example of Token Passing • Token Ring: Governed by standard 802.5 • Based on the use of a small frame called a token • A station may only transmit when it has possession of a token • Transmission is a three step process • A station grabs the token as it passes (flipping token bit) • The station transmits its frame • The station reemits the token when both • Transmission is complete • The leading edge of the packet has returned to the transmitting station

  29. IEEE 802.5 Frame Format Stallings 2000: fig 14.6

  30. Token Ring Operation • Transmission steps are as follows • A station wishing to transmit waits until the token passes and flips the token bit in the access control field • The station appends the rest of its packet after the ACR field • The station continues to transmit until it has transmitted all its packets or the token holding timer expires. • When the ACR field of the last transmitted frame returns the token bit is turned back on and the end data delimiter is appended • A frame returning to the originating station uses the frame status field to differentiate between • Destination station not active or does not exist (A=0,C=0) • Destination station exists but frame not copied (A=1,C=0) • Frame received (A=1,C=1)

  31. Token Ring Operation Stallings 2000: fig 14.5

  32. Token Ring Operation Stallings 2000: fig 14.5

  33. Token Ring Operation Stallings 2000: fig 14.5

More Related