Anda di halaman 1dari 34

Computer Networks

Part 3 : Medium
Access Control (MAC)
Medium Access Control (MAC)
• Medium Access Control (MAC) :
 mechanism to share the access to a common medium
 MAC used in LAN and packet radio networks
• Assumptions
 N independent stations sharing common channel
 collision when frames are sent simultaneous
 slotted or unslotted access system
 with or without carrier sensing
 centralized or distributed control
ALOHA Protocol : definition

• ALOHA
 packet radio network (Univ. Hawaii, 1970)
 used in many systems (e.g. GSM)
• Operation of ALOHA
 station transmits when frame is available
 station is able to check if a collision occurs
 If a collision occurs, the station waits for a random
time before sending again the frame
(this waiting time is non-deterministic)
ALOHA Protocol : efficiency (1)
• Asumptions
 frame has fixed length
 time needed to transmit a frame is time unit
 S : new frame rate generated by the stations
(=number of new frames per frame time) : S < 1
 G : total frame rate generated by the stations
(=number of new frames and retransmission
generated per frame time)
 Total number of generated frames in T is
Poisson: (GT ) k −GT
P( X = k ) = e
k!
ALOHA Protocol : efficiency (2)
• Efficiency of ALOHA:
 α : the probability that individual frame collides
G = S + αG
S = (1 − α )G
 Probability that at least 1 frame is transmitted in
interval of length 2 : α = 1 − e −2G

S = Ge − 2G
 Maximum for S= 1/(2e) = 0.184, hence G=0.5
 18 %: new frames, 32 %: retransmissions, 50%
waste
Slotted ALOHA

• Slotted ALOHA : Operation


 time divided into equal sized intervals : slots
 frame is sent at start of a slot
 vulnerable period divided by 2
• Efficiency : α = 1− e −G

−G
S = Ge
 Maximum for S= 1/e = 0.368, hence G=1
 36 %: new frames (twice ALOHA throughput)
Slotted ALOHA: Access time
 Probability that k transmissions are needed to
send a frame : Pk = e −G (1 − e −G ) k −1
 Mean number of transmissions needed :
∞ ∞
E= ∑
k =1
k Pk = ∑
k =1
ke −G (1 − e −G ) k −1 = e G

 If w is the average time before retransmission


then the delay in slotted, resp. unslotted system
Ds = (e G − 1)(1 + w ) + 1
Du = (e 2G − 1)(1 + w ) + 1
ALOHA : Throughput
Throughput

0.36 −G
S = Ge
SLOTTED
ALOHA

0.18

S = Ge − 2G UNSLOTTED
ALOHA

0.50 1 G
Carrier Sensing Multiple Access

• CSMA protocols
 to increase efficiency of ALOHA
 each station verifies channel before transmitting
 If occupied : station waits, otherwise : send
• Persistent and non-Persistent CSMA
 1-persistent CSMA :
• station senses the channel if it has data to send
• if channel is free, frame is sent immediately
• in case of collision, wait random time before
retransmission
Carrier Sensing Multiple Access
 Non-Persistent CSMA :
• If channel is idle : the station starts sending
• If channel is used : station waits random time before sensing
• in case of collision, wait random time before retransmission
 p-Persistent CSMA (slotted system)
• If channel is idle : send with probability p, wait till next slot with
probability 1-p; proceed in this way till success
• If channel is not idle anymore : station waits random time and
starts the process again
• If channel is occupied at the start : wait till next slot
CSMA : Comparison (1)
 Non-Persistent CSMA :
• number of collisions mininized
• waste of channel capacity
 1-Persistent CSMA :
• channel capacity is fully used
• probability of collision is high
 p-Persistent CSMA
• trade-off between usage of channel capacity and
mininizing collisions.
• If p decreases, S increases
CSMA : Comparison (1)
0.01-persistent
1
Non-persistent

0.1-persistent

0.5

0.5-persistent
Slotted
1-persistent
Pure ALOHA
ALOHA
1 2 3
CSMA / CD

• CSMA with collision detection


 transmission is aborted as soon as collision is
detected
 less waste of bandwidth
 three states
• transmission
• contention (when collisions may occur)
• wait
 contention period : twice round trip time
IEEE 802 Standard for LANs

• IEEE 802.1 : relationship with ISO


• IEEE 802.2 : logical link control
• IEEE 802.3 : bus with CSMA/CD
• IEEE 802.4 : token bus
• IEEE 802.5 : token ring
• IEEE 802.6 : MANs
• IEEE 802.11 : Wireless LAN
IEEE and ISO Standards
IEEE ISO
Upper
802.1
layers

Data-
802.2 Link
layer

802.3 802.4 802.5 802.6 Physical


layer
IEEE 802.3 (Ethernet): Operation
 Stations sense medium
• two stations sense idle medium : collision
• upon detection of collision : jam signal
 truncated binary exponential backoff
• after collision : divide time in slots
• slot : time a signal needs to travel forth and back (in 10
Mbit/s medium : slot = 51.2 µsec)
• after collision wait 0 or 1 slot (with probability 1/2)
• after i-th collision wait chose a number {0,1,…,2i-1} and
skip this number of slots before transmission
• after 10 collisions, maximum number of slots is 1023
• after 16 attempts : handed to higher-layer protocol
IEEE 802.3 : Frame
• IEEE 802.3 : 1-persistent CSMA/CD protocol
7 1 2 or 6 2 or 6 2 0 - 1500 0-46 4

Pre Destina- Source Pad- Frame


b l Data
-ambl tion address ding check
e address

 address : 2 or 6 bytes ; 0 : normal address, 1:


multicasting; all 1’s : broadcasting
 Padding : total frame length (from destination address up
to frame check is > 64 bytes); Pad field at most 46 bytes
 Frame check : CRC code
IEEE 802.3 : Efficiency (1)
 Heavy traffic conditions (k stations ready)
 Probability of retransmission p (fixed)
 Probability that station obtains channel :
k −1
A = kp(1 − p )
 A is maximal for p=1/k and
lim k → ∞ A = 1 / e
j −1
 Probability contention period is j slots A(1 − A )

 with mean ∑j =0
j A(1 − A) j −1 = 1 / A
IEEE 802.3 : Efficiency (2)
 Mean contention period w=2τ/A
 For optimal p (=1/k) : w= 2τe = 5.4τ
 Let P be the time needed to transmit a frame
P 1
E= =
P + 2τ / A 1 + 2 BLe / cF
• F : frame length
• B : bandwidth
• L : cable length
• c : speed of the signal
 Efficiency low for large BL (long cable, high bandwidth;
e.g. in MAN)
Ethernet Technologies

• 4 major technologies:
 10Base2: coaxial cable, bus topology, 10Mbit/s
 10BaseT: twisted pair copper, star topology,
10Mbit/s
 100BaseT: twisted pair copper, star topology,
100Mbit/s
 Gigabit Ethernet: optical fiber, 1 Gbit/s
10BaseT and 100BaseT Ethernet

• Capacity of 10Mbit/s or 100Mbit/s


• Star topology; nodes connected to a hub by
means of two pairs of twisted pair copper
• Connector similar to RJ-45 telephone
• Maximum distance between hub and node is
100m
• Hub is acting as a repeater
• In addition hub provides management and
monitor functions
Gigabit Ethernet
• Rate of 1 Gbit/s
• Uses optical fiber
• Star topology with hub or switch at the center
• Used a backbone to connect 10BaseT or 100BaseT
Ethernet networks
• Uses the standard Ethernet frame format and is compatible
with 10BaseT and 100BaseT
• Both point-to-point (using switches) and shared channels
(using hubs)
IEEE 802.11 LAN

• IEEE 802.11 protocol for Wireless LAN


• IEEE 802.11 specifies physical layer and MAC layer
• Frequency range
 900 MHz
 2.4 GHz
 5 GHz
• Bit rates
 1 or 2 Mbit/s, 11 Mbit/s (802.11b) , 54 Mbit/s (802.11a and
g)
History
IEEE Speed Frequency Year
Standard Band
802.11 1, 2 Mbps 2.4 Ghz 1997(1999
revisited),
802.11a Up to 54 5 Ghz 1999
Mbps
802.11b Up to 2.4 Ghz 1999
11Mbps
802.11g Up to 54 2.4 Ghz 2003
Mbps
Type of networks
Ad hoc mode Infrastructure mode
IEEE 802.11 MAC (1)

• IEEE 802.11 MAC : CSMA/CA


 CA : collision avoidance
 Before sending frame : PHY layer monitors
energy of medium : idle / occupied
 If channel is idle
• If remains idle during Distributed Inter Frame Space
(DIFS), send the frame
• If received correctly, the receiving station sends ACK
after waiting Short Inter Frame Spacing (SIFS) (in order
to avoid collisions)
IEEE 802.11 MAC (2)
IEEE 802.11 MAC (3)
 If channel is occupied:
• the station waits until medium becomes idle
• If the channel is idle for a time DIFS, then the station
computes an additional random back-off time
• If after this time the channel is idle, frame is sent
• If a collision occurs : use exponential back-off algorithm
 the time interval over which the back-off timer is randomized is
doubled
 This doubling continuous after each collision
IEEE 802.11 MAC: Exponential Back-off

• Back-off time = Random() * slot time


• Random() = pseudorandom integer drawn from a uniform
distribution over the interval [0, Contention Window(CW)].
CWmin ≤ CW ≤ CWmax
• CW = ascending powers of 2, minus 1. CW increases after
every unsuccessful (re)transmission untill CWmax is
reached.
• Initially CW = CWmin
• A station freezes its back-off counter when the medium
becomes busy.
IEEE 802.11: collision avoidance (1)

• Collision avoidance instead of detection


 collision detection requires the ability to send and
receive a signal at the same time
 collision can not always be detected due to
• the hidden terminal problem
• fading
IEEE 802.11: collision avoidance (2)
IEEE 802.11: NAV

• To decrease collisions
 IEEE 802.11 frame contains duration field
 Other stations can determine the time they should
defer their access to the channel
 This time is called the Network Allocation Vector
(NAV)
IEEE 801.11: TRS and CTS (1)

• To reserve channel : Request to Send (RTS)


control frame indicates the duration of the
frame
• The receiving station sends a Clear to Send
(CTS) control frame
• These control frames are used to decrease
collisions
IEEE 801.11: TRS and CTS (1)

Anda mungkin juga menyukai