Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 110

DATA LINK LAYER

Unit 2 - Link layer:

• Medium Access • Bluetooth


Control • Data Link Layer Switching
• Addressing and • congestion control
Forwarding
• Channel Allocation
Problem
• Ethernet
Multiple Access

 Broadcast link used in LAN consists of multiple sending and receiving


nodes connected to or use a single shared link

Broadcast links Examples


Figure 12.1 Data link layer divided into two functionality-oriented sublayers

Responsible for error


and flow control

Link Layer Control (LLC)

Control
MAC

Responsible framing
and MAC address and
Multiple Access Control
Multiple Access

 Problem: When two or more nodes transmit at the same time, their
frames will collide and the link bandwidth is wasted during collision

 How to coordinate the access of multiple sending/receiving nodes


to the shared link???
• Solution: We need a protocol to coordinate the transmission of the
active nodes
• These protocols are called Medium or Multiple Access Control
(MAC) Protocols belong to a sublayer of the data link layer called
MAC (Medium Access Control)
• What is expected from Multiple Access Protocols:
Main task is to minimize collisions in order to utilize the bandwidth by:
• Determining when a station can use the link (medium)
Figure 12.2 Taxonomy of multiple-access protocols discussed in this chapter

For wireless not


included with us
Random Access
• Random Access (or contention) Protocols:
No station is superior to another station and none is assigned the control over another.
A station with a frame to be transmitted can use the link directly based on a procedure defined by the protocol
to make a decision on whether or not to send.

• ALOHA Protocols
• Was designed for wireless LAN and can be used for any shared medium
• Pure ALOHA Protocol Description
All frames from any station are of fixed length (L bits)
Stations transmit at equal transmission time (all stations produce frames with equal frame lengths).
A station that has data can transmit at any time
After transmitting a frame, the sender waits for an acknowledgment for an amount of time (time out) equal
to the maximum round-trip propagation delay = 2* tprop(see next slide)

If no ACK was received, sender assumes that the frame or ACK has been destroyed and resends that frame
after it waits for a random amount of time

If station fails to receive an ACK after repeated transmissions, it gives up

Channel utilization or efficiency or Throughput is the percentage of the transmitted frames that arrive
successfully (without collisions) or the percentage of the channel bandwidth that will be used for
transmitting frames without collisions

ALOHA Maximum channel utilization is 18% (i.e, if the system produces F frames/s, then 0.18 * F frames
will arrive successfully on average without the need of retransmission).
Maximum Propagation Delay
• Maximum propagation delay(tprop): time it takes for a bit of a frame
to travel between the two most widely separated stations.

The farthest
station

Station B
receives the
first bit of
the frame at
time t= tprop
Figure 13.4 Procedure for ALOHA protocol
Critical time for pure ALOHA protocol

Tfr= Frame
Transmission time

If the frame transmission time is T sec, then the vulnerable


time is = 2 T sec.
This means no station should send during the T-sec before this
station starts transmission and no station should start sending
during the T-sec period that the current station is sending.
Pure ALOHA

In pure ALOHA, frames are transmitted at completely arbitrary times.


Note

The throughput ( S) for pure ALOHA is


S = G × e −2G .
The maximum throughput
Smax = 0.184 when G= (1/2).
G = Average number of frames generated by the system (all stations) during
one frame transmission time
Random Access – Slotted ALOHA
• Time is divided into slots equal to a frame transmission
time (Tfr)

• A station can transmit at the beginning of a slot only


• If a station misses the beginning of a slot, it has to wait
until the beginning of the next time slot.
• A central clock or station informs all stations about the
start of a each slot
• Maximum channel utilization is 37%
In danger time for slotted ALOHA protocol
Random Access – Slotted ALOHA
Note

The throughput for slotted ALOHA is


S = G × e−G .
The maximum throughput
Smax = 0.368 when G = 1.
Efficiency of Aloha
S = throughput =(success rate)

0.4

0.3
Slotted Aloha
0.2

0.1
Pure Aloha

0.5 1.0 1.5 2.0


G = offered load rate= new frames+ retransmitted
= Total frames presented to the link per
the transmission time of a single frame
 Advantage of ALOHA protocols
 A node that has frames to be transmitted can transmit continuously at the
full rate of channel (R bps) if it is the only node with frames
 Simple to be implemented
 No master station is needed to control the medium

 Disadvantage
 If (M) nodes want to transmit, many collisions can occur and the rate
allocated for each node will not be on average R/M bps
 This causes low channel utilization
Random Access – Carrier Sense Multiple Access (CSMA)
• To improve performance, avoid transmissions that are certain to cause
collisions
• Based on the fact that in LAN propagation time is very small
•  If a frame was sent by a station, All stations knows immediately so they
can wait before start sending

 A station with frames to be sent, should sense the medium for the
presence of another transmission (carrier) before it starts its own
transmission
• This can reduce the possibility of collision but it cannot eliminate it.

Collision can only happen when more than one station begin transmitting
within a short time (the propagation time period)
Random Access – Carrier Sense Multiple Access (CSMA)

 Vulnerable time for CSMA is the maximum propagation time


 The longer the propagation delay, the worse the performance of the
protocol because of the above case.
Types of CSMA Protocols

Different CSMA protocols that determine:


 What a station should do when the medium is idle?
 What a station should do when the medium is busy?

1. Non-Persistent CSMA

2. 1-Persistent CSMA
3. p-Persistent CSMA
Nonpersistent CSMA
 A station with frames to be sent, should sense the medium
1. If medium is idle, transmit; otherwise, go to 2
2. If medium is busy, (backoff) wait a random amount of time and repeat 1
 Non-persistent Stations are deferential (respect others)
 Performance:
 Random delays reduces probability of collisions because two stations with
data to be transmitted will wait for different amount of times.
 Bandwidth is wasted if waiting time (backoff) is large because medium will
remain idle following end of transmission even if one or more stations have
frames to send

Random Waiting
times

Wasted time
1-persistent CSMA
 To avoid idle channel time, 1-persistent protocol used
 Station wishing to transmit listens to the medium:
1. If medium idle, transmit immediately;
2. If medium busy, continuously listen until medium becomes idle; then
transmit immediately with probability 1
 Performance
 1-persistent stations are selfish
 If two or more stations becomes ready at the same time, collision guaranteed
P-persistent CSMA
 Time is divided to slots where each Time unit (slot) typically equals maximum
propagation delay
 Station wishing to transmit listens to the medium:
1. If medium idle,
 transmit with probability (p), OR
 wait one time unit (slot) with probability (1 – p), then repeat 1.
2. If medium busy, continuously listen until idle and repeat step 1
3. Performance
 Reduces the possibility of collisions like nonpersistent
 Reduces channel idle time like 1-persistent
Flow diagram for three persistence methods
Persistent and Nonpersistent CSMA

Comparison of the channel utilization versus load for various random access
protocols.
CSMA/CD (Collision Detection)
 CSMA (all previous methods) has an inefficiency:
 If a collision has occurred, the channel is unstable until

colliding packets have been fully transmitted


 CSMA/CD (Carrier Sense Multiple Access with Collision

Detection) overcomes this as follows:


 While transmitting, the sender is listening to medium for

collisions.
 Sender stops transmission if collision has occurred

reducing channel wastage .


CSMA/CD is Widely used for bus topology LANs (IEEE 802.3,
Ethernet).
of its own
signal, it means collision occurred
CSMA/CD Protocol
• Use one of the CSMA persistence algorithm
(non-persistent, 1-persistent, p-persistent) for

transmission
• If a collision is detected by a station during its
transmission then it should do the following:
Abort transmission and
Transmit a jam signal (48 bit) to notify other stations of collision so
that they will discard the transmitted frame also to make sure
that the collision signal will stay until detected by the furthest
station

After sending the jam signal, backoff (wait) for a random amount
CSMA/CD
• Question: How long does it take to detect a collision?
• Answer: In the worst case, twice the maximum propagation delay
Note: a = maximum propagation delay
of the medium
CSMA/CD

 Restrictions of CSMA / CD:


 Packet transmission time should be at least as long as the time needed to
detect a collision (2 * maximum propagation delay + jam sequence
transmission time)
 Otherwise, CSMA/CD does not have an advantage over CSMA
Figure 12.14 Flow diagram for the CSMA/CD

N=0

Wait R*slot time

Choose R between
0 & 2k - 1

K=10 K=N

Yes
No

No
N < 10 N==16
N=N+1

Yes

Abort
Link layer:

• Medium Access • Bluetooth


Control • Data Link Layer Switching
• Addressing and • congestion control
Forwarding
• Channel Allocation
Problem
• Ethernet
MAC addresses and ARP

• 32-bit IP address:
 network-layer address
 datagram to destination used to get IP subnet

• MAC (or LAN or physical or Ethernet) address:


 function: get frame from one interface to another physically-connected interface
(same network, in IP-addressing sense)
 48 bit MAC address (for most LANs) burned in NIC ROM, also sometimes
software settable
 e.g.: 1A-2F-BB-76-09-AD
hexadecimal (base 16) notation
(each “number” represents 4 bits)
• Why two addresses for node ??
LAN addresses and ARP

each adapter on LAN has unique LAN address

1A-2F-BB-76-09-AD

LAN
(wired or adapter
wireless)
71-65-F7-2B-08-53
58-23-D7-FA-20-B0

0C-C4-11-6F-E3-98
LAN addresses (more)

• MAC address allocation administered by IEEE


• manufacturer buys portion of MAC address space (to assure
uniqueness)
• analogy:
MAC address: like Social Security Number
IP address: like postal address

• MAC flat address ➜ portability


can move LAN card from one LAN to another

• IP hierarchical address not portable


address depends on IP subnet to which node is attached
ARP: address resolution protocol
Question: how to determine
MAC address of B
knowing B’s IP address? • each IP node (host, router) on

137.196.7.78
LAN has ARP table
1A-2F-BB-76-09-AD IP/MAC address mappings for
137.196.7.23
137.196.7.14 some LAN nodes:
< IP address; MAC address; TTL>
LAN
71-65-F7-2B-08-53
TTL (Time To Live): time after
58-23-D7-FA-20-B0
which address mapping will be
0C-C4-11-6F-E3-98 forgotten (typically 20 min)
137.196.7.88
ARP protocol: same LAN

• A wants to send datagram to B


• B’s MAC address not in A’s ARP
table. • A caches (saves) IP-to-
• A broadcasts ARP query packet, MAC address pair in its
containing B's IP address
ARP table until
• dest MAC address = FF-FF-FF-
FF-FF-FF information becomes old
• all machines on LAN receive ARP (times out)
query • soft state: information that
• B receives ARP packet, replies times out (goes away)
to A with its (B's) MAC address unless refreshed
• frame sent to A’s MAC address
(unicast)
• ARP is “plug-and-play”:
• nodes create their ARP
tables without intervention
from net administrator
Addressing: routing to another
LAN
walkthrough: send datagram from A to B via R
focus on addressing - at both IP (datagram) and MAC layer (frame)

assume A knows B’s IP address


assume A knows IP address of first hop router, R (how?)

assume A knows R’s MAC address (how?)

A B
R
111.111.111.111
222.222.222.222
74-29-9C-E8-FF-55
49-BD-D2-C7-56-2A
222.222.222.220
1A-23-F9-CD-06-9B

111.111.111.112 111.111.111.110 222.222.222.221


CC-49-DE-D0-AB-7D E6-E9-00-17-BB-4B 88-B2-2F-54-1A-0F
Addressing: routing to another
LAN
A creates IP datagram with IP source A, destination B
 A creates link-layer frame with R's MAC address as dest, frame contains A-to-
B IP datagram

MAC src: 74-29-9C-E8-FF-55


MAC dest: E6-E9-00-17-BB-4B
IP src: 111.111.111.111
IP dest: 222.222.222.222

IP
Eth
Phy

A B
R
111.111.111.111
222.222.222.222
74-29-9C-E8-FF-55
49-BD-D2-C7-56-2A
222.222.222.220
1A-23-F9-CD-06-9B

111.111.111.112 111.111.111.110 222.222.222.221


CC-49-DE-D0-AB-7D E6-E9-00-17-BB-4B 88-B2-2F-54-1A-0F
Addressing: routing to another
LAN
 frame sent from A to R
 frame received at R, datagram removed, passed up to IP

MAC src: 74-29-9C-E8-FF-55


MAC dest: E6-E9-00-17-BB-4B
IP src: 111.111.111.111
IP dest: 222.222.222.222
IP src: 111.111.111.111
IP dest: 222.222.222.222

IP IP
Eth Eth
Phy Phy

A B
R
111.111.111.111
222.222.222.222
74-29-9C-E8-FF-55
49-BD-D2-C7-56-2A
222.222.222.220
1A-23-F9-CD-06-9B

111.111.111.112 111.111.111.110 222.222.222.221


CC-49-DE-D0-AB-7D E6-E9-00-17-BB-4B 88-B2-2F-54-1A-0F
Addressing: routing to another
LAN
R forwards datagram with IP source A, destination B
 R creates link-layer frame with B's MAC address as dest, frame contains A-to-
B IP datagram

MAC src: 1A-23-F9-CD-06-9B


MAC dest: 49-BD-D2-C7-56-2A
IP src: 111.111.111.111
IP dest: 222.222.222.222
IP
IP Eth
Eth Phy
Phy

A B
R
111.111.111.111
222.222.222.222
74-29-9C-E8-FF-55
49-BD-D2-C7-56-2A
222.222.222.220
1A-23-F9-CD-06-9B

111.111.111.112 111.111.111.110 222.222.222.221


CC-49-DE-D0-AB-7D E6-E9-00-17-BB-4B 88-B2-2F-54-1A-0F
Addressing: routing to another
LAN
R forwards datagram with IP source A, destination B
 R creates link-layer frame with B's MAC address as dest, frame contains A-to-
B IP datagram
MAC src: 1A-23-F9-CD-06-9B
MAC dest: 49-BD-D2-C7-56-2A
IP src: 111.111.111.111
IP dest: 222.222.222.222

IP
Eth
Phy

A B
R
111.111.111.111
222.222.222.222
74-29-9C-E8-FF-55
49-BD-D2-C7-56-2A
222.222.222.220
1A-23-F9-CD-06-9B

111.111.111.112 111.111.111.110 222.222.222.221


CC-49-DE-D0-AB-7D E6-E9-00-17-BB-4B 88-B2-2F-54-1A-0F
Link layer:

• Medium Access • Bluetooth


Control • Data Link Layer Switching
• Addressing and • congestion control
Forwarding
• Channel Allocation
Problem
• Ethernet
MAC Sublayer

Questions to be answered ?
• In broadcast networks, How the
channel is divided between competing
users?
• What protocols are used for
allocating a multiple access channel ?
MAC Sublayer

the need for determine who gets to use the channel

- When there are two or more users trying to use a


shared single channel there should be an algorithm to
control this access.
- This problem occurs in broadcast networks which are
known as multiaccess channels.
MAC Sublayer
The Channel Allocation Problem

There are two schemes to allocate a single channel


among competing users:

1) Static Channel Allocation.

2) Dynamic Channel Allocation


MAC Sublayer
Static Channel Allocation:
In this scheme a Frequency Division Multiplexing
(FDM) is used for allocating a single channel among
competing users.
Example
if we have N users, the bandwidth will be divided into N
equal-size portions.
++ FDM is a simple and efficient allocation mechanism.
- - Waste of resources when the traffic is bursty, or the
channel is lightly loaded.
MAC Sublayer
Dynamic Channel Allocation:

Before the discussion of algorithms used for dynamic


allocation we need to consider the following
assumptions.
1) Station Model: N independent stations generate
frames for transmission. (Generate >Block
>Transmission)
2) Single channel Assumption: Single channel is
available for all communication.
3) Collision Assumption
4) Continuous Time, or Slotted Time
5) Carrier Sense, or No Carrier sense
Link layer:

• Medium Access • Bluetooth


Control • Data Link Layer Switching
• Addressing and • congestion control
Forwarding
• Channel Allocation
Problem
• Ethernet
LAN Tchnologies

Technology Options
Ethernet
Fast Ethernet
Gigabit Ethernet
10 Gig Ethernet

WLAN
Media Access
Ethernet and Wi-Fi are both “multi-access” technologies
Broadcast medium, shared by many hosts
Simultaneous transmissions will result in collisions
Media Access Control (MAC) protocol required
Rules on how to share medium
The Data Link Layer is divided into two Part MAC Media
Access Control) Sublayer and LLC (Logic Link Control)
Sublayer
LAN Technologies

802.3 Ethernet
Carrier-sense multiple access with collision detection
(CSMA/CD).
CS = carrier sense
MA = multiple access
CD = collision detection
Base Ethernet standard is 10 Mbps.
100Mbps, 1Gbps, 10Gbps standards came later
LAN Technologies

Ethernet CSMA/CD
CSMA/CD (carrier sense multiple access with collision
detection) media access protocol is used.
Data is transmitted in the form of packets.
Sense channel prior to actual packet transmission.
Transmit packet only if channel is sensed idle; else,
defer the transmission until channel becomes idle.
After packet transmission is started, the node monitors
its own transmission to see if the packet has
experienced a collision.
If the packet is observed to be undergoing a collision,
the transmission is aborted and the packet is
retransmitted after a random interval of time using
Binary Exponential Backoff algorithm.
LAN Technologies

Ethernet Address
End nodes are identified by their Ethernet Addresses
(MAC Address or Hardware Address) which is a unique 6
Byte address.
MAC Address is represented in Hexa Decimal format e.g
00:05:5D:FE:10:0A
The first 3 bytes identify a vendor (also called prefix) and
the last 3 bytes are unique for every host or device
LAN Technologies

Ethernet Frame Structure


Preamble:
7 bytes with pattern 10101010 followed by one byte with
pattern 10101011
Used to synchronize receiver, sender clock rates
Addresses: 6 bytes, frame is received by all adapters on a
LAN and dropped if address does not match
Length: 2 bytes, length of Data field
CRC: 4 bytes generated using CR-32, checked at receiver, if
error is detected, the frame is simply dropped
Data Payload: Maximum 1500 bytes, minimum 46 bytes
If data is less than 46 bytes, pad with zeros to 46 bytes

Length
LAN Technologies

Ethernet
10 Base 5 (Thicknet) (Bus Topology)
10 Base 2 (Thinnet) (Bus Topology)
10 Base T (UTP) (Star/Tree Topology)
10 Base FL (Fiber) (Star/Tree Topology)
LAN Technologies

Ethernet BUS Topology

Repeater
LAN Technologies

Ethernet STAR Topology

Hub
LAN Technologies

Ethernet
Physical Media :-
10 Base5 - Thick Co-axial Cable with Bus Topology
10 Base2 - Thin Co-axial Cable with Bus Topology
10 BaseT - UTP Cat 3/5 with Tree Topology
10 BaseFL - Multimode/Singlemode Fiber with Tree
Topology

Maximum Segment Length


10 Base5 - 500 m with at most 4 repeaters (Use Bridge to extend
the network)
10 Base2 - 185 m with at most 4 repeaters (Use Bridge to extend
the network)
10 BaseT - 100 m with at most 4 hubs (Use Switch to extend the
network)
LAN Technologies

Fast Ethernet
100 Mbps bandwidth
Uses same CSMA/CD media access protocol and packet
format as in Ethernet.
100BaseTX (UTP) and 100BaseFX (Fiber) standards
Physical media :-
100 BaseTX - UTP Cat 5e
100 BaseFX - Multimode / Singlemode Fiber
Full Duplex/Half Duplex operations.
LAN Technologies

Fast Ethernet
Provision for Auto-Negotiation of media speed:
10 Mbps or 100Mbps (popularly available for copper
media only).

Maximum Segment Length


100 Base TX - 100 m
100 Base FX - 2 Km (Multimode Fiber)
100 Base FX - 20 km (Singlemode Fiber)
LAN Technologies

Gigabit Ethernet
1 Gbps bandwidth.
Uses same CSMA/CD media access protocol as in Ethernet
and is backward compatible (10/100/100 modules are
available).
1000BaseT (UTP), 1000BaseSX (Multimode Fiber) and
1000BaseLX (Multimode/Singlemode Fiber) standards.
Maximum Segment Length
1000 Base T - 100m (Cat 5e/6)
1000 Base SX - 275 m (Multimode Fiber)
1000 Base LX - 512 m (Multimode Fiber)
1000 Base LX - 20 Km (Singlemode Fiber)
1000 Base LH - 80 Km (Singlemode Fiber)
LAN Technologies

10 Gig Ethernet
10 Gbps bandwidth.
Uses same CSMA/CD media access protocol as in
Ethernet.
Propositioned for Metro-Ethernet
Maximum Segment Length
1000 Base-T - Not available
10GBase-LR - 10 Km (Singlemode Fiber)
10GBase-ER - 40 Km (Singlemode Fiber)
Link layer:

• Medium Access • Bluetooth


Control • Data Link Layer Switching
• Addressing and • congestion control
Forwarding
• Channel Allocation
Problem
• Ethernet
Bluetooth Overview

• Wireless technology for short-range voice and data


communication
• Low-cost and low-power
• Provides a communication platform between a wide range
of “smart” devices
• Not limited to “line of sight” communication
Motivation

Digital Camera
Computer

Scanner

Inkjet
Printer

Home Audio System PDA Cordless Phone


Cell Phone Base Station
Bluetooth Applications

• Automatic synchronization between mobile and stationary


devices
• Connecting mobile users to the internet using bluetooth-
enabled wire-bound connection ports
• Dynamic creation of private networks
Synchronization

• Keep data on different devices synchronized without using a


cable
• Example:
Walk into office and have your PDA synch with your laptop on
your desk without even taking your PDA out of your briefcase
Connecting to Internet

• Being able to gain access to the Internet by using


“Bluetooth access points”
Access point is used as a gateway to the internet
Both the access point and the device are Bluetooth-enabled
An example of Service Discovery Protocol
• Access point provides a service to the device
Ad Hoc Networks

• Up to 8 devices can be actively connected in master/slave


configuration
• Piconets can be combined to form scatternets providing
unlimited device connectivity
Protocol Stack
Link layer:

• Medium Access • Bluetooth


Control • Data Link Layer Switching
• Addressing and • congestion control
Forwarding
• Channel Allocation
Problem
• Ethernet
Overview

• Networks are used to interconnect many devices.


• We have checked with Local Area Networks.

• Now, wide area networks


Since the invention of the telephone, circuit switching has been the
dominant technology for voice communications.
Since 1970, packet switching has evolved substantially for digital data
communications. It was designed to provide a more efficient facility
than circuit switching for bursty data traffic.
• Two types of packet switching:
– Datagram (such as today’s Internet)

– Virtual circuit (such as Frame Relay, ATM)


Switched Communications Networks

• Long distance transmission between stations (called “end


devices”) is typically done over a network of switching
nodes.
• Switching nodes do not concern with content of data. Their
purpose is to provide a switching facility that will move the
data from node to node until they reach their destination
(the end device).
• A collection of nodes and connections forms a
communications network.
• In a switched communications network, data entering the
network from a station are routed to the destination by
being switched from node to node.
Simple Switching Network
Switching Nodes

• Nodes may connect to other nodes, or to some stations.


• Network is usually partially connected
However, some redundant connections are desirable for
reliability

• Two different switching technologies


Circuit switching

Packet switching
Circuit Switching

• Circuit switching:
There is a dedicated communication path between two stations (end-to-
end)
The path is a connected sequence of links between network nodes. On
each physical link, a logical channel is dedicated to the connection.
• Communication via circuit switching has three phases:
Circuit establishment (link by link)
• Routing & resource allocation (FDM or TDM)
Data transfer
Circuit disconnect
• Deallocate the dedicated resources
• The switches must know how to find the route to the
destination and how to allocate bandwidth (channel) to
establish a connection.
Circuit Switching Properties

• Inefficiency
Channel capacity is dedicated for the whole duration of a connection
If no data, capacity is wasted
• Delay
Long initial delay: circuit establishment takes time
Low data delay: after the circuit establishment, information is
transmitted at a fixed data rate with no delay other than the
propagation delay. The delay at each node is negligible.
• Developed for voice traffic (public telephone network) but
can also applied to data traffic.
For voice connections, the resulting circuit will enjoy a high
percentage of utilization because most of the time one party or the
other is talking.
But how about data connections?
Public Circuit Switched Network

Subscribers: the devices that attach to the network.


Subscriber loop: the link between the subscriber and the network.
Exchanges: the switching centers in the network.
End office: the switching center that directly supports subscribers.
Trunks: the branches between exchanges. They carry multiple voice-frequency
circuits using either FDM or synchronous TDM.
Packet Switching Principles

• Problem of circuit switching


designed for voice service
Resources dedicated to a particular call
For data transmission, much of the time the connection is idle (say,
web browsing)

Data rate is fixed

• Both ends must operate at the same rate during the


entire period of connection
• Packet switching is designed to address these problems.
Basic Operation

• Data are transmitted in short packets


Typically at the order of 1000 bytes
Longer messages are split into series of packets
Each packet contains a portion of user data plus some control info

• Control info contains at least


Routing (addressing) info, so as to be routed to the intended
destination
Recall the content of an IP header!

• store and forward


On each switching node, packets are received, stored briefly (buffered)
Use of Packets
Advantages of Packet Switching
• Line efficiency
Single node-to-node link can be dynamically shared by many packets
over time
Packets are queued up and transmitted as fast as possible
• Data rate conversion
Each station connects to the local node at its own speed
• In circuit-switching, a connection could be blocked if there
lacks free resources. On a packet-switching network, even
with heavy traffic, packets are still accepted, by delivery
delay increases.
• Priorities can be used
On each node, packets with higher priority can be forwarded first.
They will experience less delay than lower-priority packets.
Packet Switching Technique

• A station breaks long message into packets


• Packets are sent out to the network sequentially, one at a time
• How will the network handle this stream of packets as it
attempts to route them through the network and deliver them
to the intended destination?
Two approaches

• Datagram approach
• Virtual circuit approach
Datagram

• Each packet is treated independently, with no reference to


packets that have gone before.
Each node chooses the next node on a packet’s path.

• Packets can take any possible route.


• Packets may arrive at the receiver out of order.
• Packets may go missing.
• It is up to the receiver to re-order packets and recover from
missing packets.
• Example: Internet
Datagram
Virtual Circuit

• In virtual circuit, a preplanned route is established before


any packets are sent, then all packets follow the same route.
• Each packet contains a virtual circuit identifier instead of
destination address, and each node on the preestablished
route knows where to forward such packets.
The node need not make a routing decision for each packet.

• Example: X.25, Frame Relay, ATM


Virtual
Circuit

A route between stations is set up


prior to data transfer.
All the data packets then follow the
same route.
But there is no dedicated resources
reserved for the virtual circuit!
Packets need to be stored-and-
forwarded.
Virtual Circuits v Datagram

• Virtual circuits
Network can provide sequencing (packets arrive at the same order) and
error control (retransmission between two nodes).
Packets are forwarded more quickly
• Based on the virtual circuit identifier
• No routing decisions to make
Less reliable
• If a node fails, all virtual circuits that pass through that node fail.
• Datagram
No call setup phase
• Good for bursty data, such as Web applications
More flexible
• If a node fails, packets may find an alternate route
• Routing can be used to avoid congested parts of the network
Comparison of
communication
switching
techniques
Link layer:

• Medium Access • Bluetooth


Control • Data Link Layer Switching
• Addressing and • congestion control
Forwarding
• Channel Allocation
Problem
• Ethernet
Congestion Control

• When one part of the subnet (e.g. one or more


routers in an area) becomes overloaded,
congestion results.
• Because routers are receiving packets faster than
they can forward them, one of two things must
happen:
The subnet must prevent additional packets from entering
the congested region until those already present can be
processed.
The congested routers can discard queued packets to
make room for those that are arriving.
Factors that Cause Congestion

• Packet arrival rate exceeds the outgoing link capacity.


• Insufficient memory to store arriving packets

• Bursty traffic
• Slow processor
Congestion Control vs Flow Control

• Congestion control is a global issue – involves every router


and host within the subnet
• Flow control – scope is point-to-point; involves just sender
and receiver.
Congestion Control, cont.
• Congestion Control is concerned with efficiently
using a network at high load.
• Several techniques can be employed. These include:
Warning bit
Choke packets
Load shedding
Random early discard
Traffic shaping
• The first 3 deal with congestion detection and
recovery. The last 2 deal with congestion
avoidance.
Warning Bit

• A special bit in the packet header is set by the router to warn


the source when congestion is detected.
• The bit is copied and piggy-backed on the ACK and sent to
the sender.
• The sender monitors the number of ACK packets it receives
with the warning bit set and adjusts its transmission rate
accordingly.
Choke Packets
• A more direct way of telling the source to slow down.
• A choke packet is a control packet generated at a
congested node and transmitted to restrict traffic flow.
• The source, on receiving the choke packet must reduce its
transmission rate by a certain percentage.
• An example of a choke packet is the ICMP Source Quench
Packet.
Hop-by-Hop Choke Packets

• Over long distances or at high speeds choke packets are not


very effective.
• A more efficient method is to send to choke packets hop-by-
hop.
• This requires each hop to reduce its transmission even
before the choke packet arrive at the source.
Load Shedding

• When buffers become full, routers simply discard


packets.
• Which packet is chosen to be the victim depends on
the application and on the error strategy used in the
data link layer.
• For a file transfer, for, e.g. cannot discard older
packets since this will cause a gap in the received
data.
• For real-time voice or video it is probably better to
throw away old data and keep new packets.
• Get the application to mark packets with discard
priority.
Random Early Discard (RED)

• This is a proactive approach in which the router discards


one or more packets before the buffer becomes completely
full.
• Each time a packet arrives, the RED algorithm computes
the average queue length, avg.
• If avg is lower than some lower threshold, congestion is
assumed to be minimal or non-existent and the packet is
queued.
RED, cont.

• If avg is greater than some upper threshold, congestion is


assumed to be serious and the packet is discarded.
• If avg is between the two thresholds, this might indicate
the onset of congestion. The probability of congestion is
then calculated.
Traffic Shaping
• Another method of congestion control is to “shape” the
traffic before it enters the network.
• Traffic shaping controls the rate at which packets are sent
(not just how many). Used in ATM and Integrated Services
networks.
• At connection set-up time, the sender and carrier negotiate
a traffic pattern (shape).
• Two traffic shaping algorithms are:
Leaky Bucket
Token Bucket
The Leaky Bucket Algorithm

• The Leaky Bucket Algorithm used to control rate in a


network. It is implemented as a single-server queue with
constant service time. If the bucket (buffer) overflows then
packets are discarded.
The Leaky Bucket Algorithm

(a) A leaky bucket with water. (b) a leaky bucket with


packets.
Leaky Bucket Algorithm, cont.
• The leaky bucket enforces a constant output rate
(average rate) regardless of the burstiness of the
input. Does nothing when input is idle.
• The host injects one packet per clock tick onto the
network. This results in a uniform flow of packets,
smoothing out bursts and reducing congestion.
• When packets are the same size (as in ATM cells),
the one packet per tick is okay. For variable length
packets though, it is better to allow a fixed number
of bytes per tick. E.g. 1024 bytes per tick will allow
one 1024-byte packet or two 512-byte packets or
four 256-byte packets on 1 tick.
Token Bucket Algorithm

• In contrast to the LB, the Token Bucket


Algorithm, allows the output rate to vary,
depending on the size of the burst.
• In the TB algorithm, the bucket holds tokens. To
transmit a packet, the host must capture and
destroy one token.
• Tokens are generated by a clock at the rate of one
token every t sec.
• Idle hosts can capture and save up tokens (up to
the max. size of the bucket) in order to send larger
bursts later.
The Token Bucket Algorithm

5-34

(a) Before. (b) After.


Leaky Bucket vs Token Bucket
• LB discards packets; TB does not. TB discards tokens.
• With TB, a packet can only be transmitted if there are
enough tokens to cover its length in bytes.
• LB sends packets at an average rate. TB allows for large
bursts to be sent faster by speeding up the output.
• TB allows saving up tokens (permissions) to send large
bursts. LB does not allow saving.

You might also like