Download presentation
Presentation is loading. Please wait.
1
Media Access Protocols
2
Medium Access Sublayer
3
What is “Media” Any resource which requires parties to exclusively
access in order to communicate Shared Wire Radio Ring
4
Medium Access Sub layer
Network Layer Medium Access Sublayer Data Link Layer Physical Layer
5
Medium Access Sublayer (cont’d)
Medium access (MAC) sublayer is not important on point-to-point links The MAC sublayer is only used in broadcast or shared channel networks Examples: Satellite, Ethernet, Cellular
6
Contents Fixed Assignment Protocols Demand Assignment Protocols
Contention Access Protocols IEEE 802 LANs Token Ring protocols
7
Fixed Assignment Protocols
Static and predetermined allocation of channel access: independent of user activity Idle users may be assigned to the channel, in which case channel capacity is wasted Examples: TDMA, FDMA, WDMA
8
Demand Assignment Protocols
Allocate channel capacity to hosts on a demand basis (i.e., only to active users) Requires methods for measuring the demand for the channel Polling Reservation schemes
9
Polling A central controller interrogates each host and allocates channel capacity to those who need it Good for systems with: Short propagation delay Small polling messages Non-bursty traffic
10
Reservation Schemes Hosts independently reserve the channel for period of time Reservations are usually piggybacked on data messages passing along the channel Good for systems with : short propagation delay no central controller node non-bursty traffic
11
Reservation Protocols (cont’d)
Reservation protocol examples: Bit-Map Protocol Binary Countdown Protocol
12
Bit-Map Protocol Contention and data transmission periods alternate
The contention period is divided into slots, with 1 bit-wide slots for each host in the network. If a host wants to transmit a packet, it sets its contention slot equal to 1. Otherwise, it sets it to 0. The slots pass all hosts in sequence, so every host is aware of who will transmit 1 1 1 1 2 4 5 6 1 1 4 data frame
13
Bit-Map Protocol (cont’d)
But what if there are a large number of hosts in the network? The contention period will have to grow to include them all With a large number of hosts, the contention period may be very long, leading to inefficiency
14
Binary Countdown Protocol
During contention period, each host broadcasts its binary address one bit at a time, starting with the most significant bit bits transmitted simultaneously are boolean OR’d together Arbitration rule: If a host sent a zero bit but the boolean OR results in a one bit, the host gives up and stops sending address bits Whichever host remains after the entire address has been broadcast gets access to the medium
15
Binary Countdown (cont’d)
Host Addresses Bit Time
16
Binary Countdown: Fairness
Stations with the highest addresses will always win. This is good if you want to implement priority, but bad if you want to give all hosts fair access to the channel Used in CAN-bus networks (cars) Solution: Change the address of a host after a successful transmission
17
Binary Countdown: Permuting Addresses
After host A successful transmission, all hosts with addresses less than host A add one to their address, improving their priority Host A changes its address to zero, giving it the lowest priority
18
Contention Access Protocols
Single channel shared by a large number of hosts No coordination between hosts Control is completely distributed Examples: ALOHA, CSMA, CSMA/CD
19
Contention Access (cont’d)
Advantages: Short delay for bursty traffic Simple (due to distributed control) Flexible to fluctuations in the number of hosts Fairness
20
Contention Access (cont’d)
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
21
Contention Access Methods
Pure ALOHA Slotted ALOHA CSMA 1-Persistent CSMA Non-Persistent CSMA P-Persistent CSMA CSMA/CD
22
Pure ALOHA Originally developed for ground-based packet radio communications in 1970 Goal: let users transmit whenever they have something to send
23
The Pure ALOHA Algorithm
1. Transmit whenever you have data to send 2. Listen to the broadcast 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
24
t : one packet transmission time
Pure ALOHA (cont’d) 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. t : one packet transmission time Vulnerable period: 2t t t0 t0+t t0+2t t0+3t Vulnerable
25
Pure ALOHA (cont’d) Due to collisions and idle periods, pure ALOHA is limited to approximately 18% throughput in the best case Can we improve this?
26
Slotted ALOHA Slotted ALOHA cuts the vulnerable period for packets from 2t to t. This doubles the best possible throughput from 18.4% to 36.8% How? Time is slotted. Packets must be transmitted within a slot
27
The Slotted ALOHA Algorithm
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 destroyed 3. If there was a collision, wait a random number of slots and try to send again
28
Carrier Sense Multiple Access (CSMA)
We could achieve better throughput if we could listen to the channel before transmitting a packet This way, we would stop avoidable collisions. To do this, we need “Carrier Sense Multiple Access,” or CSMA, protocols
29
Assumptions with CSMA Networks
1. Constant length packets 2. No errors, except those caused by collisions 3. No capture effect 4. Each host can sense the transmissions of all other hosts 5. The propagation delay is small compared to the transmission time
30
CSMA (cont’d) There are several types of CSMA protocols:
1-Persistent CSMA Non-Persistent CSMA P-Persistent CSMA
31
1-Persistent CSMA Sense the channel. If collision occurs,
If busy, keep listening to the channel and transmit immediately when the channel becomes idle. If idle, transmit a packet immediately. If collision occurs, Wait a random amount of time and start over again.
32
1-Persistent CSMA (cont’d)
The protocol is called 1-persistent because the host transmits with a probability of 1 whenever it finds the channel idle.
33
The Effect of Propagation Delay on CSMA
packet A B carrier sense = idle Transmit a packet Collision
34
Propagation Delay and CSMA
Contention (vulnerable) period in Pure ALOHA Two* packet transmission times Contention period in Slotted ALOHA one packet transmission time Contention period in CSMA up to 2 x end-to-end propagation delay Performance of CSMA > Performance of Slotted ALOHA > Performance of Pure ALOHA
35
1-Persistent CSMA with Satellite Systems
Satellite system: long prop. delay (270 msec) Carrier sense makes no sense It takes 270 msecs to sense the channel, which is a really long time Vulnerability time = 540 msec (1/2 a second is forever in a network!)
36
1-Persistent CSMA (cont’d)
Even if prop. delay is zero, there will be collisions Example: If stations B and C become ready in the middle of A’s transmission, B and C will wait until the end of A’s transmission and then both will begin transmitted simultaneously, resulting in a collision. If B and C were not so greedy, there would be fewer collisions
37
Non-Persistent CSMA Sense the channel. If collision occurs
If busy, wait a random amount of time and sense the channel again If idle, transmit a packet immediately If collision occurs wait a random amount of time and start all over again
38
Tradeoff between 1- and Non-Persistent CSMA
If B and C become ready in the middle of A’s transmission, 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 transmission, 1-Persistent: B succeeds as soon as A ends Non-Persistent: B may have to wait
39
P-Persistent CSMA Optimal strategy: use P-Persistent CSMA
Assume channels are slotted One slot = contention period (i.e., one round trip propagation delay)
40
P-Persistent CSMA (cont’d)
1. 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. 2. Detect collisions If a collision occurs, wait a random amount of time and go to step 1
41
P-Persistent CSMA (cont’d)
Consider p-persistent CSMA with p=0.5 When a host senses an idle channel, it will only send a packet with 50% probability If it does not send, it tries again in the next slot.
42
Comparison of CSMA and ALOHA Protocols
(Number of Channel Contenders)
43
CSMA/CD In CSMA protocols In CSMA/CD protocols
If two stations begin transmitting at the same time, each will transmit its complete packet, thus wasting the channel for an entire packet time In CSMA/CD protocols The transmission is terminated immediately upon the detection of a collision CD = Collision Detect
44
CSMA/CD Sense the channel Collision detection
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
45
CSMA/CD (cont’d) Carrier sense Collision detection
reduces the number of collisions Collision detection reduces the effect of collisions, making the channel ready to use sooner
46
Collision detection time
How long does it take to realize there has been a collision? Worst case: 2 x end-to-end prop. delay packet A B
47
Ethernet MAC Sublayer Protocol
48
4. IEEE 802 LANs LAN: Local Area Network What is a local area network?
A LAN is a network that resides in a geographically restricted area LANs usually span a building or a campus
49
Characteristics of LANs
Short propagation delays Small number of users Single shared medium (usually) Inexpensive
50
Common LANs Bus-based LANs Ring-based LANs Switch-based LANs
Ethernet (*) Token Bus (*) Ring-based LANs Token Ring (*) Switch-based LANs Switched Ethernet ATM LANs (*) IEEE 802 LANs
51
IEEE 802 Standards 802.1: Introduction
802.2: Logical Link Control (LLC) 802.3: CSMA/CD (Ethernet) 802.4: Token Bus 802.5: Token Ring 802.6: DQDB 802.11: CSMA/CA (Wireless LAN)
52
IEEE 802 Standards (cont’d)
802 standards define: Physical layer protocol Data link layer protocol Medium Access (MAC) Sublayer Logical Link Control (LLC) Sublayer
53
OSI Layers and IEEE 802 OSI layers IEEE 802 LAN standards
Higher Layers Higher Layers 802.2 Logical Link Control Medium Access Control Data Link Layer CSMA/CD Token-passing Token-passing bus bus ring Physical Layer
54
IEEE 802 LANs (cont’d) Ethernet Token Ring
55
Ethernet (CSMA/CD) IEEE 802.3 defines Ethernet
Layers specified by 802.3: Ethernet Physical Layer Ethernet Medium Access (MAC) Sublayer
56
Ethernet (cont’d) Possible Topologies: 1. Bus
2. Branching non-rooted tree for large Ethernets
57
Minimal Bus Configuration
Coaxial Cable Transceiver Terminator Transceiver Cable Host
58
Typical Large-Scale Configuration
Repeater Host Ethernet segment
59
4.1.1 Ethernet Physical Layer
Transceiver Transceiver Cable 4 Twisted Pairs 15 Pin Connectors Channel Logic Manchester Phase Encoding 64-bit preamble for synchronization
60
Ethernet Physical Configuration (for thick coaxial cable)
Segments of 500 meters maximum Maximum total cable length of 1500 meters between any two transceivers Maximum of 2 repeaters in any path Maximum of 100 transceivers per segment Transceivers placed only at 2.5 meter marks on cable
61
Manchester Encoding 1 bit = high/low voltage signal
Data stream Encoded bit pattern 1 bit = high/low voltage signal 0 bit = low/high voltage signal
62
Manchester Encoding How to determine data from stuck-at fault?
Data stream Encoded bit pattern How to determine data from stuck-at fault? Continuous differential
63
Ethernet Synchronization
64-bit frame preamble used to synchronize reception 7 bytes of followed by a byte containing Manchester encoded, the preamble appears like a sine wave
64
Ethernet Cabling Options
10Base5: Thick Coax 10Base2: Thin Coax (“cheapernet”) 10Base-T: Twisted Pair 10Base-F: Fiber optic Each cabling option carries with it a different set of physical layer constraints (e.g., max. segment size, nodes/segment, etc.)
65
Ethernet: MAC Layer Data encapsulation Link Management Frame Format
Addressing Error Detection Link Management CSMA/CD Backoff Algorithm
66
MAC Layer Ethernet Frame Format
Multicast bit Destination (6 bytes) Source (6 bytes) Length (2 bytes) Data ( bytes) Pad Frame Check Seq. (4 bytes)
67
Ethernet MAC Frame Address Field
Destination and Source Addresses: 6 bytes each Two types of destination addresses Physical address: Unique for each user Multicast address: Group of users First bit of address determines which type of address is being used 0 = physical address 1 = multicast address
68
Ethernet MAC Frame Other Fields
Length Field 2 bytes in length determines length of data payload Data Field: between 0 and 1500 bytes Pad: Filled when Length < 46 Frame Check Sequence Field 4 bytes Cyclic Redundancy Check (CRC-32)
69
CSMA/CD Recall: CSMA/CD is a “carrier sense” protocol.
If channel is idle, transmit immediately If busy, wait until the channel becomes idle CSMA/CD can detect collections. Abort transmission immediately if there is a collision Try again later according to a backoff algorithm
70
CSMA/CD (cont’d) Carrier sense reduces the number of collisions
Collision detection reduces the impact of collisions
71
CSMA/CD and Ethernet Ethernet: Ethernet access protocol:
Short end-to-end propagation delay Broadcast channel Ethernet access protocol: 1-Persistent CSMA/CD with Binary Exponential Backoff Algorithm
72
Ethernet Backoff Algorithm: Binary Exponential Backoff
If collision, Choose one slot randomly from 2k slots, where k is the number of collisions the frame has suffered. One contention slot length = 2 x end-to-end propagation delay This algorithm can adapt to changes in network load.
73
Binary Exponential Backoff (cont’d)
slot length = 2 x end-to-end delay = 50 ms A B t=0ms: Assume A and B collide (kA = kB = 1) A, B choose randomly from 21 slots: [0,1] Assume A chooses 1, B chooses 1 t=100ms: A and B collide (kA = kB = 2) A, B choose randomly from 22 slots: [0,3] Assume A chooses 2, B chooses 0 t=150ms: B transmits successfully t=250ms: A transmits successfully
74
Binary Exponential Backoff (cont’d)
In Ethernet, Binary exponential backoff will allow a maximum of 15 retransmission attempts If 16 backoffs occur, the transmission of the frame is considered a failure.
75
4.1.4 Ethernet Performance
76
4.1.3 Ethernet Features and Advantages
1. Passive interface: No active element 2. Broadcast: All users can listen 3. Distributed control: Each user makes own decision Simple Reliable Easy to reconfigure
77
Ethernet Disadvantages
Lack of priority levels Cannot perform real-time communication Security issues
78
Why Ethernet switching?
LANs may grow very large The switch has a very fast backplane It can forward frames very quickly to the appropriate subnet Cheaper than upgrading all host interfaces to use a faster network
79
Token Ring IEEE 802.5 Standard Layers specified by 802.5:
Token Ring Physical Layer Token Ring MAC Sublayer
80
Token Ring (cont’d) Token Ring, unlike Ethernet, requires an active interface Host Ring interface
81
Token Ring Configuration
82
4.2.1 Token Ring Physical Layer
Ring Interfaces Listen and Transmit Modes Channel Logic Differential Manchester Encoding
83
Token Ring Interface Modes
Listen Mode Transmit Mode one-bit delay To station From station To station From station
84
Differential Manchester Encoding
Transitions take place at midpoint of interval 1 bit: the initial half of the bit interval carries the same polarity as the second half of the previous interval 0 bit: a transition takes place at both the beginning and the middle of the bit interval
85
Token Ring MAC Sublayer
Token passing protocol Frame format Token format
86
Token Passing Protocol
A token (8 bit pattern) circulates around the ring Token state: Busy: Idle:
87
Token Passing Protocol (cont’d)
General Procedure: Sending host waits for and captures an idle token Sending host changes the token to a frame and circulates it Receiving host accepts the frame and continues to circulate it Sending host receives its frame, removes it from the ring, and generates an idle token which it then circulates on the ring
88
Token Ring Frame and Token Formats
Bytes SD AC ED Token Format / / unlimited SC AC FC Destination Address Source Address Data Checksum ED FS Frame Format
89
Token Ring Delimiters SD = Starting Delimiter ED = Ending Delimiter
AC ED SC AC FC Destination Address Source Address Data Checksum ED FS SD = Starting Delimiter ED = Ending Delimiter They contains invalid differential Manchester codes
90
Token Ring Access Control Field
SD AC ED (Note: The AC field is also used in frames) P P P T M R R R P = Priority bits provides up to 8 levels of priority when accessing the ring T = Token bit T=0: Token T=1: Frame
91
Token Ring Access Control Field (cont’d)
SD AC ED P P P T M R R R M = Monitor Bit Prevents tokens and frames from circulating indefinitely All frames and tokens are issued with M=0 On passing through the “monitor station,” M is set to 1 All other stations repeat this bit as set A token or frame that reaches the monitor station with M=1 is considered invalid and is purged
92
Token Ring Access Control Fields (cont’d)
SD AC ED P P P T M R R R R = Reservation Bits Allows stations with high priority data to request (in frames and tokens as they are repeated) that the next token be issued at the requested priority
93
Token Ring Frame Control Field
SC AC FC Destination Address Source Address Data Checksum ED FS FC = Frame Control Field Defines the type of frame being sent Frames may be either data frames or some type of control frame. Example control frames: Beacon: Used to locate breaks in the ring Duplicate address test: Used to test if two stations have the same address
94
Token Ring Address & Data Fields
SC AC FC Destination Address Source Address Data Checksum ED FS Address Fields: Indicate the source and destination hosts Broadcast: Set all destination address bits to 1s. Data No fixed limit on length Caveat: Hosts may only hold the token for a limited amount of time (10 msec)
95
Token Ring Checksum and Frame Status
SC AC FC Destination Address Source Address Data Checksum ED FS Checksum: 32-bit CRC FS = Frame Status Contains two bits, A and C When the message arrives at the destination, it sets A=1 When the destination copies the data in the message, it sets C=1
96
The Token Ring Monitor Station
One station on the ring is designated as the “monitor station” The monitor station: marks the M bit in frames and tokens removes marked frames and tokens from the ring watches for missing tokens and generates new ones after a timeout period
97
Using Priority in Token Ring
If a host wants to send data of priority n, it may only grab a token with priority value n or lower. A host may reserve a token of priority n by marking the reservation bits in the AC field of a passing token or frame Caveat: The host may not make the reservation if the token or frame’s AC field already indicates a higher priority reservation The next token generated will have a priority equal to the highest reserved priority
98
Priority Transmission: Example
B D C Host B has 1 frame of priority 3 to send to A Host C has 1 frame of priority 2 to send to A Host D has 1 frame of priority 4 to send to A Token starts at host A with priority 0 and circulates clockwise Host C is the monitor station
99
Example (cont’d) Event Token/Frame AC Field
A generates a token P=0, M=0, T=0, R=0 B grabs the token and sets the message destination to A P=3, M=0, T=1, R=0 Frame arrives at C, and C reserves priority level 2. Monitor bit set. P=3, M=1, T=1, R=2 Frame arrives at D, and D attempts to reserve priority level 4: P=3, M=1, T=1, R=4 Frame arrives at A, and A copies it P=3, M=1, T=1, R=4 Frame returns to B, so B removes it, and generates a new token P=4, M=0, T=0, R=0 Token arrives at C, but its priority is too high. C reserves priority 2. M bit. P=4, M=1, T=0, R=2
100
Example (cont’d) Event Token/Frame AC Field
Token arrives at D, and D grabs it, sending a message to A P=4, M=0, T=1, R=2 Frame arrives at A, and A copies it P=4, M=0, T=1, R=2 Frame arrives at B, which does nothing to it P=4, M=0, T=1, R=2 Frame arrives at C, which sets the monitor bit P=4, M=1, T=1, R=2 Frame returns to D, so D removes it and generates a new token with P=2 P=2, M=0, T=0, R=0 etc… Attempt to complete this scenario on your own.
101
A simple example of switched Ethernet.
102
The original fast Ethernet cabling.
103
Gigabit Ethernet (a) A two-station Ethernet. (b) A multistation Ethernet.
104
Gigabit Ethernet cabling.
105
IEEE 802.2: Logical Link Control
(a) Position of LLC. (b) Protocol formats.
106
Ethernet Switching Connect many Ethernet through an “Ethernet switch”
Each Ethernet is a “segment” Make one large, logical segment to segment 4 to segment 1 to segment 3 to segment 2
107
Data Link Layer Switching
Bridges from 802.x to 802.y Local Internetworking Spanning Tree Bridges Remote Bridges Repeaters, Hubs, Bridges, Switches, Routers, Gateways Virtual LANs
108
Bridges A bridge connects networks at layer 2
Work to make a single logical layer 2 address Some bridges can connect different 802.X network types Ethernet to token ring
109
Data Link Layer Switching
Multiple LANs connected by a backbone to handle a total load higher than the capacity of a single LAN.
110
Operation of a LAN bridge from 802.11 to 802.3.
Bridges from 802.x to 802.y Operation of a LAN bridge from to
111
The IEEE 802 frame formats. The drawing is not to scale.
Bridges from 802.x to 802.y (2) The IEEE 802 frame formats. The drawing is not to scale.
112
Local Internetworking
A configuration with four LANs and two bridges.
113
Two parallel transparent bridges.
Spanning Tree Bridges Two parallel transparent bridges.
114
Spanning Tree Bridges (2)
(a) Interconnected LANs. (b) A spanning tree covering the LANs. The dotted lines are not part of the spanning tree.
115
Remote bridges can be used to interconnect distant LANs.
116
Repeaters, Hubs, Bridges, Switches, Routers and Gateways
(a) Which device is in which layer. (b) Frames, packets, and headers.
117
Repeaters, Hubs, Bridges, Switches, Routers and Gateways (2)
(a) A hub. (b) A bridge. (c) a switch.
118
Learning MAC addresses ( flooding)
switch B E A,B,C D,E,F F C Host Per-port routing table Z G Switch adds hosts to routing table when it sees a packet with a given source addess H Ethernet segment
Similar presentations
© 2025 SlidePlayer.com Inc.
All rights reserved.