Upload
sahil-ahuja
View
221
Download
0
Embed Size (px)
Citation preview
7/28/2019 MAC sublayer.pdf
1/38
Switched Networkswitched NetworksChapter 3hapter 3
Medium Access Controledium Access Control Sublayerublayer
Dr.-Ing. Torben WeisUniversity Duisburg-Essen
Institut frInformationstechnik
Torben Weis 2
Channel Allocation Problem (1)hannel Allocation Problem (1)
Multiple stations access one channel How to avoid collisions?
Two different approaches Static Channel Allocation Dynamic Channel Allocation
What do we expect? Static Simple Dynamic Efficient
7/28/2019 MAC sublayer.pdf
2/38
Institut frInformationstechnik
Torben Weis 3
Channel Allocation Problem (2)hannel Allocation Problem (2)
Example: Cocktail party many people gather in a large room Broadcast medium = air
Human protocols: Give everyone a chance to speak Dont speak until you are spoken to Dont monopolize the conversation Raise your hand if you have a question Dont interrupt when someone is speaking Dont fall asleep when someone else is talking
Institut frInformationstechnik
Torben Weis 4
Channel Allocation Problem (3)hannel Allocation Problem (3)
If more than 2 users send at the same timecollision
All collided packets are lostwaste of bandwidth
Ideally, the MAC protocol for a broadcastchannel with R bit/sec should satisfy:
If only 1 node is sending than the throughput is R When M nodes have data to send than the throughput
is R / M Decentralized protocol, i.e. no master Simple & inexpensive to implement
7/28/2019 MAC sublayer.pdf
3/38
Institut frInformationstechnik
Torben Weis 5
Protocol Layerrotocol Layer
Data Link Layer puts frames on the wire What happens if multiple stations want to put
frames on the medium (wire) at the same time?=> Medium Access Control (MAC) is required
Layer 5Layer 5
Layer 4Layer 4
Layer 3Layer 3
Layer 5Layer 5
Layer 4Layer 4
Layer 3Layer 3Layer 3Layer 3 Layer 3Layer 3
Application Layer
Transport Layer
Network Layer Network Layer
Layer 2Layer 2
Layer 1Layer 1
Layer 2Layer 2
Layer 1Layer 1
Layer 2Layer 2
Layer 1Layer 1
Layer 2Layer 2
Layer 1Layer 1
Data Link Layer
Physical Layer
Data Link Layer
Physical Layer
Institut frInformationstechnik
Torben Weis 6
Layer 5Layer 5
Layer 4Layer 4
Layer 3Layer 3
Layer 5Layer 5
Layer 4Layer 4
Layer 3Layer 3Layer 3Layer 3 Layer 3Layer 3
Application Layer
Transport Layer
Network Layer Network Layer
Layer 2Layer 2 Layer 2Layer 2Layer 2Layer 2 Layer 2Layer 2Data Link Layer Data Link Layer
MACMAC MACMACMACMAC MACMAC
Medium Access Controledium Access Control Sublayerublayer
MAC is not part of the OSI Model MAC is a sublayer of the Data Link Layer
Layer 1Layer 1 Layer 1Layer 1Layer 1Layer 1 Layer 1Layer 1Physical Layer Physical Layer
7/28/2019 MAC sublayer.pdf
4/38
Institut frInformationstechnik
Torben Weis 7
Static Channel Allocationtatic Channel Allocation
Frequency Division Multiplexing (FDM) Time Division Multiplexing (TDM)
Institut frInformationstechnik
Torben Weis 8
Frequency Division Multiplexing (1)requency Division Multiplexing (1)
Uses static allocation Channel has a bandwidth of H n stations are connected to the cable
Idea Divide the bandwidth in H/ n frequency bands Assign one band to one station
Result No collisions possible Delay increased by factor n
7/28/2019 MAC sublayer.pdf
5/38
Institut frInformationstechnik
Torben Weis 9
Frequency Division Multiplexing (2)requency Division Multiplexing (2)
(a) The original bandwidths(b) The bandwidths raised in frequency(b) The multiplexed channel
Institut frInformationstechnik
Torben Weis 10
Time Division Multiplexing (1)ime Division Multiplexing (1)
Uses static allocation Channel transfers B bit/sec n stations are connected to the cable
Idea Allocate n time slots of length t Round robin Each station transfers B*t bits per slot
Result No collisions possible Delay increased by factor n
7/28/2019 MAC sublayer.pdf
6/38
Institut frInformationstechnik
Torben Weis 11
Time Division Multiplexing (2)ime Division Multiplexing (2)
Institut frInformationstechnik
Torben Weis 12
Dynamic Channel Allocation (1)ynamic Channel Allocation (1)
Station Model n independent stations Each station wants to send frames is the constant arrival rate Probability of sending a frame in time t is t
7/28/2019 MAC sublayer.pdf
7/38
Institut frInformationstechnik
Torben Weis 13
Dynamic Channel Allocation (2)ynamic Channel Allocation (2)
Single Channel Assumption All stations connected to the same channel All stations are equivalent Every station can send/receive Optional
Priorities can be assigned to stations
Institut frInformationstechnik
Torben Weis 14
Dynamic Channel Allocation (3)ynamic Channel Allocation (3)
Collision Assumption Two stations sending at overlapping time intervals
collisionthe transmitted data is garbled
After a collision, data must be sent again Stations can detect collisions No other errors, only collisions
7/28/2019 MAC sublayer.pdf
8/38
7/28/2019 MAC sublayer.pdf
9/38
Institut frInformationstechnik
Torben Weis 17
Dynamic Channel Allocation (6)ynamic Channel Allocation (6)
Station Model Single Channel Assumption Collision Assumption (a) Continuous Time
(b) Slotted Time (a) Carrier Sense
(b) No Carrier Sense
Institut frInformationstechnik
Torben Weis 18
Multiple Access Protocolsultiple Access Protocols
ALOHA Carrier Sense Multiple Access Protocols Collision-Free Protocols
Limited-Contention Protocols Next week
Wavelength Division Multiple Access Protocols Wireless LAN Protocols
7/28/2019 MAC sublayer.pdf
10/38
Institut frInformationstechnik
Torben Weis 19
ALOHA (1)LOHA (1) Norm Abramson at the Univ. of Hawaii mountainous islands
land network difficult to install
ACK
ACK ACK
ACK
Institut frInformationstechnik
Torben Weis 20
ALOHA (2)LOHA (2)
M nodes can create new frames at any time The node immediately transmits its frame
completely on a shared frequency (Different in slotted ALOHA)
Base station acknowledges packages on adedicated frequency
If the frame collidesNo ACK is received
Retransmission with probability pavoids efficiency to become 0
7/28/2019 MAC sublayer.pdf
11/38
Institut frInformationstechnik
Torben Weis 21
Pure ALOHAure ALOHA
In pure ALOHA, frames are transmitted at completelyarbitrary times.
Institut frInformationstechnik
Torben Weis 22
Pure ALOHA (2)ure ALOHA (2)
Vulnerable period for the shaded frame = 2 t.
7/28/2019 MAC sublayer.pdf
12/38
Institut frInformationstechnik
Torben Weis 23
Slotted ALOHAlotted ALOHA
Idea Create time slots of length t Transmission only at beginning of each time slot
Result Vulnerability reduced from 2 t to t We doubled the throughput
Problem How does everybody agree on time slots?
Institut frInformationstechnik
Torben Weis 24
Pure and Slotted ALOHAure and Slotted ALOHA
Throughput versus offered traffic for ALOHAsystems
7/28/2019 MAC sublayer.pdf
13/38
7/28/2019 MAC sublayer.pdf
14/38
Institut frInformationstechnik
Torben Weis 27
Carrier Sense Multiple Access (2)arrier Sense Multiple Access (2)
If everyone is sensing the medium,how can collisions still occur?
channelpropagationdelay
Institut frInformationstechnik
Torben Weis 28
1-persistent CSMAersistent CSMA
The protocol Listen before transmitting If channel busy, wait until is channel idle If channel idle, transmit If collision occurs, wait a random amount of time and
start all over again It is called 1-persistent because the station
transmits with a probability of 1 whenever itfinds the channel idle.
7/28/2019 MAC sublayer.pdf
15/38
Institut frInformationstechnik
Torben Weis 29
Nonpersistentonpersistent CSMASMA
The protocol Listen before transmitting 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 What is special?
The station does not sense all the timeless greedy than 1-persistent CSMA
Institut frInformationstechnik
Torben Weis 30
pp -persistent CSMAersistent CSMA
Applies to slotted channels The protocol
Listen before transmitting If channel busy, wait until is channel idle If channel idle
Transmit with probability p Wait for next slot with probability q=1- p
If collision occurs, repeat the above procedure
7/28/2019 MAC sublayer.pdf
16/38
Institut frInformationstechnik
Torben Weis 31
Persistent andersistent and Nonpersistentonpersistent CSMASMA
Comparison of the channel utilization versus
load for various random access protocols
Institut frInformationstechnik
Torben Weis 32
Collision Detection (1)ollision Detection (1)
1. Waiting for an acknowledge (ACK) ACK is sent after the frame has been transmitted
Frames with collisions are transmitted completely Waiting for ACK wastes time and bandwidth
2. Sending and receiving Check, whether you receive what you have sent
Collisions can be detected early This is called Collision Detection or just CD
7/28/2019 MAC sublayer.pdf
17/38
Institut frInformationstechnik
Torben Weis 33
Collision Detection (2)ollision Detection (2)
When is a collision detected ? Station A sends at time t
0 Signal needs to the most distant station X At t0+ - station X sends, too
X sensed that the channel is idle The signal of X needs to station A Result: A must wait 2 - before it can detect a
collision Problem: Maximum value of depends on the
maximum distance between stations
Institut frInformationstechnik
Torben Weis 34
CSMA with Collision DetectionSMA with Collision Detection
Senders can detect collisions while sendingCollision Detection
7/28/2019 MAC sublayer.pdf
18/38
Institut frInformationstechnik
Torben Weis 35
Collisionollision -Free Protocols (1)ree Protocols (1)
The basic bit-map protocol
Institut frInformationstechnik
Torben Weis 36
Collisionollision -Free Protocols (2)ree Protocols (2)
The bitmap protocol is a reservation protocol Overhead calculation for the reservation
Every station ( N in total) wants to send a frameOverhead = 1 contention slot per N frames = 1 bit
Only one station wants to send a frameOverhead = 1 contention slot for 1 frame = N bits
7/28/2019 MAC sublayer.pdf
19/38
Institut frInformationstechnik
Torben Weis 37
Collisionollision -Free Protocols (3)ree Protocols (3)
The binary countdown protocol A dash indicates silence
Institut frInformationstechnik
Torben Weis 38
Collisionollision -Free Protocols (4)ree Protocols (4)
Binary countdown is a reservation protocol, too Overhead calculation for the reservation
N stations in total At least one wants to send Contention slot has length log 2 N
Optimization Many frames carry the sender address
Efficiency can become 100%
7/28/2019 MAC sublayer.pdf
20/38
Institut frInformationstechnik
Torben Weis 39
Collisionollision -Free Protocols (5)ree Protocols (5)
Binary countdown uses priorities High addresses always win Low addresses can starve to death Possible fix
Address numbers circulate After sending a frame, address numbers are shifted The sending station gets a low address
Institut frInformationstechnik
Torben Weis 40
Limitedimited -Contention Protocolsontention Protocols
Acquisition probability for asymmetric contention channel
7/28/2019 MAC sublayer.pdf
21/38
Institut frInformationstechnik
Torben Weis 41
Adaptive Tree Walk Protocol (1)daptive Tree Walk Protocol (1)
The tree for eight stations
Institut frInformationstechnik
Torben Weis 42
Adaptive Tree Walk Protocol (2)daptive Tree Walk Protocol (2)
Idea Limit the number of participants in the contention First, everybody may try to send Collision halve the participants
Best of both worlds Low delay when there are few collisions
As good as slotted ALOHA Low delay when many station bid for the channel
Almost as good as reservation protocols
7/28/2019 MAC sublayer.pdf
22/38
Institut frInformationstechnik
Torben Weis 43
Wavelength Division Multiple Access Protocolsavelength Division Multiple Access Protocols
Institut frInformationstechnik
Torben Weis 44
Manchester Code (1)anchester Code (1)
How to represent 0 and 1 on the wire? Idea 1
1 = +5 Volt, 0 = 0 Volt Problem: How to differentiate 00000000 from an idle
sender ? Idea 2
1 = +5 Volt, 0 = -5 Volt Problem: We cannot be sure that all receivers sample
the signal at the same rate (clock drift) We need a self-clocking encoding
7/28/2019 MAC sublayer.pdf
23/38
Institut frInformationstechnik
Torben Weis 45
Manchester Code (2)anchester Code (2)
Encode 1 bit as 2 bits 1 = 10 0 = 01 Good news: the signal oscillates in the middle of
every bit Bad news: We waste half of the bandwidth
This is called Manchester Code It is used by Ethernet
(we will come to that later)
Institut frInformationstechnik
Torben Weis 46
Manchester Code (3)anchester Code (3)
7/28/2019 MAC sublayer.pdf
24/38
Institut frInformationstechnik
Torben Weis 47
Differential Manchester Codeifferential Manchester Code
Encode 1 bit as 2 bits The encoding of bit n depends on the encoding
of bit n -1 If n = 1
n-1 encoded as 10 ? -> n = 01 n-1 encoded as 01 ? -> n = 10
If n = 0 n-1 encoded as 10 ? -> n = 10 n-1 encoded as 01 ? -> n = 01
Advantage: Better noise immunity Disadvantage: Requires more complex
equipment
Institut frInformationstechnik
Torben Weis 48
IEEE Standard 802 for LANsEEE Standard 802 for LANs
Ethernet: IEEE 802.3 Token Bus: IEEE 802.4 Token Ring: IEEE 802.5
Wireless: IEEE 802.11
7/28/2019 MAC sublayer.pdf
25/38
Institut frInformationstechnik
Torben Weis 49
IEEE 802.5 Token RingEEE 802.5 Token Ring
Institut frInformationstechnik
Torben Weis 50
Token Ringoken Ring Physical Length (1)hysical Length (1)
A 3 byte token circulates on the ring Sender must not receive its own token data
before it sends the last token bit
How many bits fit on the ring?
7/28/2019 MAC sublayer.pdf
26/38
Institut frInformationstechnik
Torben Weis 51
Token Ringoken Ring Physical Length (2)hysical Length (2)
Each station buffers 1 bit Problem: station can be taken off the net
The cable carries some bits Data rate of R Mbit/sec
A bit is emitted every 1/ R sec Signal propagation speed 200 m/ sec
Each bit occupies 200/ R m Example: R=1 Mbit/sec, length = 1000m
Each bit occupies 200m 5 bits on the ring cable Additional buffers are required
Institut frInformationstechnik
Torben Weis 52
Token Passing (1)oken Passing (1)
The Tokenrotates aroundthe ring
Station Acaptures theToken andconverts it to aPacket
Station Atransmits thepacket
Staton A waitsfor the Packet
Station Areleases theToken
Release After Reception (RAR)
TK
P K T
P K T
P K T
T K
7/28/2019 MAC sublayer.pdf
27/38
Institut frInformationstechnik
Torben Weis 53
Token Passing (2)oken Passing (2)
Station A transmitsthe Packet andimmediately releasesthe Token
Release After Transmission (RAT)
The Tokenrotates aroundthe ring
TK
Station Acaptures theToken andconverts it to aPacket
P K T
P K T
T K
Institut frInformationstechnik
Torben Weis 54
Token Passing (3)oken Passing (3)
The ring can contain: A token A data frame (or both in release after transmission)
The token must fit on the ring The size of a data frame is not limited
A data frame is not entirely on the ring The sender can receive its own frame while still
sending Can be used for error detection
7/28/2019 MAC sublayer.pdf
28/38
Institut frInformationstechnik
Torben Weis 55
Token Passing (4)oken Passing (4)
Is starvation possible? i.e. a station wants to send but never gets the token ? Answer: No
Stations s 1 , s 2 , s n Station s i fetches the token and transmits data Then, s i issues a new token
s i+1 can get the token Full load round robin Token ring is fair
as long as only one priority is used
Institut frInformationstechnik
Torben Weis 56
bypassrelays
Wire center
Token Ring Wiringoken Ring Wiring
7/28/2019 MAC sublayer.pdf
29/38
Institut frInformationstechnik
Torben Weis 57
Token Ringoken Ring Multistationultistation Access Unit (MSAU)ccess Unit (MSAU)
Institut frInformationstechnik
Torben Weis 58
Token Ringoken Ring - Active Monitorctive Monitor
Some station must inject the token detect circulating frames send a continuous signal
(e.g. Differential Manchester encoded 0)to synchronize all stations
This station is the active monitor (AM) All other stations are standby monitors (SM) The active monitor is elected
The station with the largest MAC wins
7/28/2019 MAC sublayer.pdf
30/38
Institut frInformationstechnik
Torben Weis 59
Joining a Token Ringoining a Token Ring
1. (Lobe Check) - Performs a lobe media check to seewhether frames are received without error.
2. (Physical Insertion) - A station then sends a 5 volt signalto the MSAU to open the relay.
3. (Address Verification) - A station then sends a messageto is own MACIf the Copied flag is set -> The MAC is already used
4. (Participation in Ring Poll) - The station must participatein the periodic (every 7 seconds) ring poll process.
5. (Request Initialization) - Finally a station sends out aspecial request to a parameter server to obtainconfiguration information.
Institut frInformationstechnik
Torben Weis 60
Token Structure (1)oken Structure (1)
SD AC EDSD = Starting DelimiterAC = Access ControlED = Ending Delimiter
1 1 1
JK0JK000 J - Phase Violation JK - Phase Violation K
0 - Binary Zero
PPPTMrrr
PPP - Priority BitsT - Token BitM - Monitor Bitrrr - Reservation Bit
SD
AC
J - Phase Violation JK - Phase Violation K1 - Binary OneI - Intermediate BitE - Error Bit
JK1JK1IEED
7/28/2019 MAC sublayer.pdf
31/38
Institut frInformationstechnik
Torben Weis 61
Token Structure (2)oken Structure (2)
The manchester codeviolation enables areceiver to detect the startof a token
Violation is achieved bynot switching in themiddle of a bit
J K assures that the
signal is still oscillating
SD AC EDSD = Starting DelimiterAC = Access ControlED = Ending Delimiter
1 1 1
JK0JK000 J - Phase Violation JK - Phase Violation K0 - Binary Zero
SD
Institut frInformationstechnik
Torben Weis 62
Data Frame Structureata Frame Structure
SD AC FC DA SA DATA ED FS
SD = Starting Delimiter
AC = Access ControlFC = Frame ControlDA = Destination AddressSA = Source AddressED = Ending DelimiterFS = Frame Status
1 1 1 6 6 n 1 1
FFZZZZZZ FF - Frame TypeZZZZZZ - Control Bits
FC
AC00AC00A = Address
RecognizedC = Frame Copied
FS
7/28/2019 MAC sublayer.pdf
32/38
Institut frInformationstechnik
Torben Weis 63
Token Ring Priorityoken Ring Priority
Institut frInformationstechnik
Torben Weis 64
IEEE Standard 802 for LANsEEE Standard 802 for LANs
Ethernet: IEEE 802.3 Token Bus: IEEE 802.4 Token Ring: IEEE 802.5
Wireless: IEEE 802.11
7/28/2019 MAC sublayer.pdf
33/38
Institut frInformationstechnik
Torben Weis 65
IEEE 802.4 Token BusEEE 802.4 Token Bus
Physical: Bus (solid line)
Logical: Ring (dashed line)
Institut frInformationstechnik
Torben Weis 66
Why Token Bus ?hy Token Bus ?
Combines: Cabling of Ethernet (single wire) Determinism of Token Ring
Different application domains Token Ring / Ethernet: Office Token Bus: Industrial automation
Pushed by General Motors Real-time important
7/28/2019 MAC sublayer.pdf
34/38
Institut frInformationstechnik
Torben Weis 67
Token Busoken Bus Frame Formatrame Format
Comparable to IEEE 802.5 format,but unfortunately different
Institut frInformationstechnik
Torben Weis 68
Token Busoken Bus - Messagesessages
7/28/2019 MAC sublayer.pdf
35/38
Institut frInformationstechnik
Torben Weis 69
Token Busoken Bus MAC Protocol (1)AC Protocol (1)
Initializing a ring
Station 90 wants to join Station 90 detects that there is no traffic Station 90 sends claim_token (90) The station with the highest MAC wins
90
Institut frInformationstechnik
Torben Weis 70
Token Busoken Bus MAC Protocol (2)AC Protocol (2)
Joining a ring
Station 80 wants to join 90 periodically sends solicit_successor (90,70) Station between 90 and 70 may respond 80 sends set_successor (90,80)
90 80 70 60
7/28/2019 MAC sublayer.pdf
36/38
7/28/2019 MAC sublayer.pdf
37/38
Institut frInformationstechnik
Torben Weis 73
Token Busoken Bus MAC Protocol (5)AC Protocol (5)
Leaving a ring
Stations 80 wants to leave 80 waits for the token 80 sends set_successor (90,70)
90 has new successor70 has new predecessor
90 80 70 60
Institut frInformationstechnik
Torben Weis 74
Token Busoken Bus MAC Protocol (6)AC Protocol (6)
Station failure
Station 80 fails 90 sends token . If 80 does not reply, 90 sends again Still no response 90 sends who_follows (90,80) 70 sends set_successor (90,70)
90 80 70 60
7/28/2019 MAC sublayer.pdf
38/38
Institut frInformationstechnik
Torben Weis 75
Token Busoken Bus MAC Protocol (7)AC Protocol (7)
Station failure, part 2
Stations 80 and 70 fail 90 sends token . If 80 does not reply, 90 sends again No response 90 sends who_follows (90,80) No response 90 sends solicit_successor_2 (90) Any alive station sends set_successor (90,xx)
90 80 70 60