Datalink Control

25
Data Link Control (DLC)

description

Data link control in Computer Networking. Explains the data link layer.

Transcript of Datalink Control

Page 1: Datalink Control

Data Link Control (DLC)

Page 2: Datalink Control

ALOHA (“free for all”)

Stations transmit whenever they have data to send

Detect Collision or Wait for an acknowledgment

If no acknowledgment (or collision), try again after a random waiting time If no acknowledgment (or collision), try again after a random waiting time

Collision: If more than one node transmit at the same timeIf there is a collision, all nodes have to re-transmit packets

Page 3: Datalink Control

Vulnerable Window

For a given frame, the time when no other frame may be transmitted

if a collision is to be avoided. Assume all packets have same length (L) and require Tp seconds for

transmission

Each packet vulnerable to collisions for time Vp = ??

Suppose packet A sent at time to

If pkt B sent any time between to – Tp and to end of packet B collides If pkt B sent any time between to – Tp and to end of packet B collideswith beginning of packet A

If pkt C sent any time between to and to + Tp start of packet C will collidewith end of packet A

Total vulnerable interval for packet A is 2Tp

t

PacketC

PacketB Tp

PacketA

Tp

Page 4: Datalink Control

What is the throughput of Pure ALOHA?

Based on several assumptions:

1. Traffic Model: transmission attempts follows a Poisson distribution

2. Fixed packet size

Poisson Distribution:

Pr[i customers arrive in t time interval] =P[n(t) =i] = ((t) i e -t)/i!

Where = Average arrival rate ( no of arrival per unit tine)Where = Average arrival rate ( no of arrival per unit tine)

Assume, G = Average number of arrival in time interval T= T, where T =frame time

Page 5: Datalink Control

ALOHA Throughput

Let S = number of successful packet transmissions per frame time (equalschannel utilization)

G (=T in previous expression )= average number of attemptedtransmissions per packet time(user load+retransmissions).Then,with Poissondistribution traffic model

Average no of packet in 2T (Vulnerable window) time=

(2 )P[n(2T) =i] = ((2G) i e –2G)/i!

Now Throughput (S) is = offered load G * Prob that no frame suffers collision

S= G * Pr( that there is no transmission in 2T time interval

i.e Pr( n(2T)=0 ) )

Pr( n(2T)=0 )= e - 2G

S= G* e - 2G

Page 6: Datalink Control

ALOHA and Slotted ALOHAThroughput versus Load

0.15

0.2

0.25

0.3

0.35

0.4

Ge-G

0.184

0.368

S

Peaks at G=.5 ---> max(Throughput) = 1/2e ~ 0.18

ALOHA can achieve maximum throughput of 18.4%

dS/dG = e-2G – 2Ge-2G = 0

Gmax = 1/2 Smax = 1/(2e) ~ 0.184

0

0.05

0.1

0.15

0.0

1563

0.0

3125

0.0

625

0.1

25

0.2

5

0.5 1 2 4 8

Ge-2G

G

Page 7: Datalink Control

Slotted ALOHA

Time is divided into slots (i.e., slot = one packet transmission time at least)

Master station generates synchronization pulses for time-slots. (e.g., use “pip” from asatellite)

Station waits till beginning of slot to send packet.

Stations transmit ONLY at the beginning of a time slot

Collisions will occur because more than one frame can send in the slot n

But collision probability reduces as Vulnerability Window reduced from 2T to T;

Goodput doubles. Goodput doubles.Average no of packet in T (Vulnerable window) time=

P[n(T) =i] = ((G) i e –G)/i!

So S= G * Pr( that there is no transmission in 2T time interval

i.e Pr( n(T)=0 ) )

Pr( n(T)=0 )= e - G

S= G* e - G

Peaks at G=1max(Throughput) = 1/e ~ 0.36

dS/dG = e-G – Ge-G = 0

Gmax = 1.0 Smax = 1/e ~ 0.368

Page 8: Datalink Control

Aloha (contd..) Aloha performance :- not dependent on a

Reservation Aloha for Satellite ( Kesav 152, Gallgher313)

Observations:

ALOHA is an unstable protocol

If G increases to greater than 1 due to fluctuation in offered load, S willdecrease

Reduction in throughput means fewer successful packet transmissions and Reduction in throughput means fewer successful packet transmissions andmore collisions

Number of retransmissions increases, backlogging messages to betransmitted and traffic load G

This in turn decreases S

Results in operating point moving to right and S 0

Random access protocols can be made stable using backoff parameters

Page 9: Datalink Control

Comparison

1.0

0.9

0.8

0.5

0.6

0.7

S(throughputperpackettime)

0.1-persistent CSMA

0.5-persistentCSMA

Nonpersistent CSMA

0.01 persistent CSMA

With small p better s but longer delay

0.5

0.4

0.3

0.2

0.1

01 2 3 4 5 6 7 8 90

S(throughputperpackettime)

G (attempts per packet time)

PureALOHA

SlottedALOHA

1-persistent

CSMA

CSMA

Page 10: Datalink Control

Difference Between Wired and Wireless

A B C

A

B

C

Ethernet LAN Wireless LAN

If both A and C sense the channel to be idle at the same time,they send at the same time.

Collision can be detected at sender in Ethernet.

Half-duplex radios in wireless cannot detect collision at sender.

Page 11: Datalink Control

A and C cannot hear each other.

A sends to B, C cannot receive A.

C wants to send to B, C senses a “free” medium (CS fails)

Collision occurs at B.

Hidden Terminal Problem

BA C

Collision occurs at B.

A cannot receive the collision (CD fails).

A is “hidden” for C.

Page 12: Datalink Control

Exposed Terminal Problem

A B

CD

A starts sending to B.

C senses carrier, finds medium in use and has to wait for A->B toend.

D is outside the range of A, therefore waiting is not necessary.

A and C are “exposed” terminals

Page 13: Datalink Control

CSMA: Distributed, Packet mode scheme

Carrier Sense and its variants:

Use of carrier sensing capability to know if someone else is using themedium

1 persistent

If medium busy, keep sensing

If medium Idle send immediately

p persistent p persistent

If medium busy, keep sensing

If medium becomes Idle after continuous sensing,

– send with probability p, (wait IFS time for 802.11, then do a random back-off)

– in case of no-send (1-p), wait for 1 time slot, and begin medium sensingagain

If medium is free for IFS period, transmit packet.

Non persistent

If medium busy, wait for random time before sensing again

If medium Idle send immediately

Page 14: Datalink Control

Summary of CSMA schemes (Diagramfrom Keshav)

Page 15: Datalink Control

802.11 - MAC layer

Traffic services Asynchronous Data Service (mandatory) – DCF

Time-Bounded Service (optional) - PCF

Access methods DCF CSMA/CA (mandatory)

collision avoidance via randomized back-off mechanism

ACK packet for acknowledgements (not for broadcasts)

DCF w/ RTS/CTS (optional)

avoids hidden/exposed terminal problem, provides reliability

PCF (optional)

access point polls terminals according to a list

Page 16: Datalink Control

t

medium busy

DIFSDIFS

next frame

contention window(randomized back-offmechanism)

802.11 - CSMA/CA

station which has data to send starts sensing the medium (Carrier Sense

slot time

direct access ifmedium is free DIFS

station which has data to send starts sensing the medium (Carrier Sensebased on CCA, Clear Channel Assessment)

if the medium is free for the duration of an Inter-Frame Space (IFS),the station can start sending (IFS depends on service type)

if the medium is busy, the station has to wait for a free IFS plus anadditional random back-off time (multiple of slot-time)

if another station occupies the medium during the back-off time of thestation, the back-off timer stops (fairness)

Page 17: Datalink Control

802.11 DCF – basic access

If medium is free for DIFS time, station sends data

receivers acknowledge at once (after waiting for SIFS) if the packetwas received correctly (CRC)

automatic retransmission of data packets in case of transmission errors

DIFS

t

SIFS

DIFS

data

ACK

waiting time

otherstations

receiver

senderdata

DIFS

contention

Page 18: Datalink Control

Solution to Hidden/Exposed Terminals

A first sends a Request-to-Send (RTS) to B

On receiving RTS, B responds Clear-to-Send (CTS)

Hidden node C overhears CTS and keeps quiet Transfer duration is included in both RTS and CTS

Exposed node overhears a RTS but not the CTS Exposed node overhears a RTS but not the CTS D’s transmission cannot interfere at B

A B C

RTS

CTS CTS

DATA

D

RTS

Page 19: Datalink Control

802.11 - Reliability

Use acknowledgements When B receives DATA from A, B sends an ACK

If A fails to receive an ACK, A retransmits the DATA

Both C and D remain quiet until ACK (to prevent collision ofACK)

Expected duration of transmission+ACK is included in RTS/CTSpacketspackets

A B C

RTS

CTS CTS

DATA

D

RTS

ACK

Page 20: Datalink Control

802.11 –RTS/CTS

If medium is free for DIFS, station can send RTS with reservation parameter(reservation determines amount of time the data packet needs the medium)

acknowledgement via CTS after SIFS by receiver (if ready to receive)

sender can now send data at once, acknowledgement via ACK

other stations store medium reservations distributed via RTS and CTS

DIFSdataRTS

t

SIFS

data

ACK

defer access

otherstations

receiver

senderdata

DIFS

contention

RTS

CTSSIFS SIFS

NAV (RTS)NAV (CTS)

Page 21: Datalink Control

802.11 - Carrier Sensing

In IEEE 802.11, carrier sensing is performed

at the air interface (physical carrier sensing), and

at the MAC layer (virtual carrier sensing)

Physical carrier sensing

detects presence of other users by analyzing all detected packets

Detects activity in the channel via relative signal strength fromother sourcesother sources

Virtual carrier sensing is done by sending MPDU durationinformation in the header of RTS/CTS and data frames

Channel is busy if either mechanisms indicate it to be

Duration field indicates the amount of time (in microseconds) requiredto complete frame transmission

Stations in the BSS use the information in the duration field to adjusttheir network allocation vector (NAV)

Page 22: Datalink Control

802.11 - Collision Avoidance

If medium is not free during DIFS time..

Go into Collision Avoidance: Once channel becomes idle,wait for DIFS time plus a randomly chosen backoff timebefore attempting to transmit

For DCF the backoff is chosen as follows: When first transmitting a packet, choose a backoff interval in the When first transmitting a packet, choose a backoff interval in the

range [0,cw]; cw is contention window, nominally 31

Count down the backoff interval when medium is idle

Count-down is suspended if medium becomes busy

When backoff interval reaches 0, transmit RTS

If collision, then double the cw up to a maximum of 1024

Time spent counting down backoff intervals is part ofMAC overhead

Page 23: Datalink Control

Example - backoff

wait

B1 = 5B1 = 25

data

data

B2 = 15B2 = 20

wait

B1 and B2 are backoff intervalsat nodes 1 and 2

cw = 31

B2 = 10

Page 24: Datalink Control

802.11 - Priorities

defined through different inter frame spaces – mandatory idle timeintervals between the transmission of frames

SIFS (Short Inter Frame Spacing)

highest priority, for ACK, CTS, polling response

SIFSTime and SlotTime are fixed per PHY layer (10 s and 20 srespectively in DSSS)respectively in DSSS)

PIFS (PCF IFS)

medium priority, for time-bounded service using PCF

PIFSTime = SIFSTime + SlotTime

DIFS (DCF IFS)

lowest priority, for asynchronous data service

DCF-IFS: DIFSTime = SIFSTime + 2xSlotTime

Page 25: Datalink Control

802.11 - Congestion Control

Contention window (cw) in DCF: Congestion controlachieved by dynamically choosing cw

large cw leads to larger backoff intervals

small cw leads to larger number of collisions

Binary Exponential Backoff in DCF: Binary Exponential Backoff in DCF: When a node fails to receive CTS in response to its RTS, it

increases the contention window

cw is doubled (up to a bound cwmax =1023)

Upon successful completion data transfer, restore cw to cwmin=31