Unit - 3 (Data Link Layer) - Part II
Unit - 3 (Data Link Layer) - Part II
Course Outline:
Medium
Logical Link
Access
Control (LLC)
Control (MAC)
Data Link Layer | Medium Access Control (MAC) Data Link Layer
• Addressing
Physical Device Addressing
• Channelization
TDMA
FDMA
CDMA
Channel Allocation
Static Channel Allocation: Static FDM can be used. But there will be a wastage of bandwidth.
Assumptions
Station Model: In a system ‘N’ nodes are connected & all nodes are independent. All stations
generate frames at the constant rate.
Collision (when more than one frame is travelling in the medium). Collision detection is
analog-based. All stations can detect collisions.
Time: Continuous (Transmission can begin at any instant) OR Slotted (Transmission begin at
the start of a slot).
• Addressing
Physical Device Addressing
• Channelization
TDMA
FDMA
CDMA
Example: 06-01-02-01-2C-4B
Data Link Layer | Medium Access Control (MAC) Data Link Layer
• Addressing
Physical Device Addressing
• Channelization
TDMA
FDMA
CDMA
MAC
Protocols
Collision-based Collision-free
Protocol Protocol
Medium Access Control (MAC) | MAC Protocols
Data Link Layer
MAC
Protocols
Collision-based Collision-free
Protocol Protocol
Slotted Non-
Pure-ALOHA 1-Persistent P-persistent
ALOHA persistent
Medium Access Control (MAC) | MAC Protocols
Data Link Layer
MAC
Protocols
Collision-based Collision-free
Protocol Protocol
Slotted Non-
Pure-ALOHA 1-Persistent P-persistent
ALOHA persistent
Non-Carrier Sensed | ALOHA Protocol
This is a Random Access Protocol.
In random-access methods, no station is superior to another station and none is assigned control
over another.
There is no scheduled time for a station to transmit.
Transmission is random among the stations.
It was designed, at the University of Hawaii, for a wireless LAN, but it can be used on any shared
medium.
When a station sends data, another station may attempt to do so at the same time.
There are potential collisions in this management. The data from the two stations collide and
become garbled.
Pure Slotted
The original ALOHA protocol, which is LAN based.
BASIC IDEA: Each station sends a frame whenever it has a frame to send (multiple access).
Pure Slotted
If the ACK does not arrive after a time-out period, the station assumes that the frame (or the ACK) has
been destroyed and resends the frame.
Pure Slotted
Vulnerable Time
The length of time in which there is a possibility of collision.
Lets assume that the stations send fixed-length frames with each frame taking Tfr seconds to send.
Pure Slotted
Throughput
Let the “Frame Time (t)” denote the amount of time needed to transmit the standard, fixed-length
frame (i.e., the frame length divided by the bit rate).
(Let us assume that the infinite population of users generates new frames according to a Poisson
Distribution with mean ‘S’ frames per frame time.)
If 𝑺 > 𝟏, the user community is generating frames at a higher rate than the channel can handle:
COLLISION.
Pure Slotted
For reasonable throughput: 𝟎 < 𝑺 < 𝟏
Let us assume that the probability of ‘k’ transmission attempts per frame time, old and new
combined, is also Poisson, with mean G per frame time. This means G ≥ S.
At LOW LOAD (i.e., S ≈ 0), there will be few collisions, hence few re-transmissions, so G ≈ S.
At HIGH LOAD, there will be many collisions, so 𝑮 > 𝑺.
Under ALL LOADS, the throughput (S) is just the offered load (G) times the probability (P0) of a
transmission succeeding (without collision), i.e.,
𝑆 = 𝐺 . 𝑃0
The probability that ‘k’ frames are generated during a given frame time is given by the Poisson
Distribution:
𝐺 𝑘 . 𝑒 −𝐺
𝑃𝑟 𝑘 =
𝑘!
So, the probability of zero frames (𝒌 = 𝟎) is just 𝐞−𝐆 .
ALOHA Protocol | Pure ALOHA ALOHA
Pure Slotted
So, the probability of no events occur in that period is just 𝑒 −𝐺 . That is
Vulnerability for a frame = 2t, i.e., within a period of 2t of sending a frame, no new frame should
be generated.
In an interval two frame times long, the mean number of frames generated is 2G. So, the
probability of zero frame being generated during entire vulnerable period (2t) is:
𝑃𝑟 𝑘 = 0 = 𝑒 −2𝐺
Therefore, 𝑆 = 𝐺 . 𝑃0 𝑆 = 𝐺. 𝑒 −2𝐺
Pure Slotted
No rule is defined in pure ALOHA about when the station can send frames.
If a station misses the moment (beginning of a particular slot), it must wait until the beginning of
the next time slot.
ALOHA
There is still the possibility of collision if two stations try to send at the beginning of the same time
slot.
The vulnerable time is now reduced to one-
half, equal to Tfr.
𝑆 = 𝐺. 𝑒 −𝐺
MAC
Protocols
Collision-based Collision-
Protocol free Protocol
Slotted Non-
Pure-ALOHA 1-Persistent P-persistent
ALOHA persistent
MAC Protocols | CSMA Protocol Carrier-
Sensed
Only if the channel is idle, node will send the data (it won’t send data in case of collision or
transmission/busy).
Complexity increases.
Time needed for a signal to propagate from one end of the medium to the other.
If the first bit of the frame reaches the end of the medium, every station will already have heard the bit
and will refrain from sending.
MAC Protocols | CSMA Protocol Carrier-
Sensed
Persistence Methods
CSMA
1- Non- P-
Persistent Persistent Persistent
CSMA Protocol | 1-Persistent CSMA
1- Non- P-
Persistent Persistent Persistent
1-Persistent
Simple and straightforward.
After the station finds the line idle, it sends its frame immediately (with probability 1).
Otherwise, the station continuously sense the channel for its availability.
Highest chance of collision because two or more stations may find the line idle and send their frames
immediately.
CSMA Protocol | Non-Persistent CSMA
1- Non- P-
Non-Persistent Persistent Persistent Persistent
It reduces the chance of collision because it is unlikely that two or more stations will wait the same
amount of time and retry to send simultaneously.
It reduces the efficiency of the network because the medium remains idle when there may be
stations with frames to send.
CSMA Protocol | P-Persistent CSMA
1- Non- P-
Used in the slotted channel with a slot duration equal to or greater than the maximum propagation
time.
• Combines the advantages of 1-persistent (continuously sense) and non-persistent (transmit
with ‘p’ probability i.e., between 0 and 1).
• Reduces the chance of collision and improves efficiency.
After the station finds the line idle, it follows these steps:
2. With probability ‘q = 1 - p’, the station waits for the beginning of the next time slot and
checks the line again:
If the line is busy, it acts as though a collision has occurred and uses the back-off
procedure.
CSMA Protocol | P-Persistent CSMA
1- Non- P-
If P = 0.4, the node will generate a random number (R) between 0 to 1. Persistent Persistent Persistent
P Collision
CSMA Protocol
Comparison of the Channel Utilization versus Load for various Random Access Protocols
Medium Access Control (MAC) | MAC Protocols
Data Link Layer
MAC
Protocols
Collision-based Collision-free
Protocol Protocol
Slotted Non-
Pure-ALOHA 1-Persistent P-persistent
ALOHA persistent
Carrier-
Persistent and non-persistent CSMA protocols are clearly an improvement over ALOHA because
they ensure that no station begins to transmit when it senses the channel busy.
CSMA/CD augments the algorithm to handle the collision. It allows station to aborts the
transmissions as soon as they detect a collision.
If two stations sense the channel to be idle and begin transmitting simultaneously, they will both detect
the collision almost immediately and stops transmitting.
Collision can be detected by looking at the power or pulse width of the received signal and
comparing it to the transmitting signal.
MAC Protocols | CSMA/CD Protocol Carrier-
Sensed
After a station detects a collision, it aborts its transmission, waits a random period of time, and then
tries again, assuming that no other station has started transmitting in the meantime.
Before sending the last bit of the frame, the sending station must detect a collision, if any, and
abort the transmission. This is so because the station, once the entire frame is sent, does not keep a
copy of the frame and does not monitor the line for collision detection.
MAC Protocols | CSMA/CD Protocol Carrier-
Sensed
Suppose that two stations both begins transmitting at exactly time t0. CSMA CSMA/CD CSMA/CA
How long will it take them to realize that there has been a collision?
The minimum time to detect the collisions is then just the time it takes the signal to
propagate from one station to the other.
A station not hearing a collision for a time equal to the full cable propagation time after starting its
transmission could be sure it had seized the cable. By “seized”, it means that all other stations knew it
was transmitting and would not interfere. - WRONG
MAC Protocols | CSMA/CD Protocol Carrier-
Sensed
At 𝝉 − 𝜺, an instant before the signal arrives at the most distant station, that station also begins
transmitting.
• It detects the collision almost instantly and STOPS, but the little noise burst caused by
the collision does not get back to the original station until time 2𝜏 − 𝜀.
• In other words, in the worst-case a station cannot be sure that it has seized the channel until
it has transmitted for 2𝜏 without hearing a collision.
For this reason, it is required to model the contention interval as a Slotted ALOHA system with
slot width 𝟐𝝉.
The frame transmission time Tfr must be at least two times the maximum
propagation time 𝝉.
𝟏 𝒕𝒑𝒓𝒐𝒑
𝑼= ,where a =
𝟏+𝟔.𝟒𝟒𝒂 𝒕𝒕𝒓𝒂𝒏𝒔
MAC Protocols | CSMA/CD Protocol
How randomization is done when a collision occurs?
After a collision, the time is divided into discrete slots whose length is equal to the worst-case
round trip propagation time on the ether (2𝜏).
To accommodate the longest path allowed by Ethernet, the slot time has been set to 512 bit times or
51.2 𝜇sec.
For the 1st collision (c = 1), each sender will wait 0 or 1 slot times.
For the 2nd collision (c = 2), each sender will wait anywhere from 0 or 3 slot times.
For the 3rd collision (c = 3), each sender will wait anywhere from 0 or 7 slot times.
As the number of retransmission attempts increases, the number of possibilities for delay increases
exponentially.
MAC Protocols | CSMA/CD Protocol
After certain number of increases, the exponentiation stops, i.e., the retransmission timeout
reaches a ceiling, and thereafter does not increase any further.
If the randomization interval for all collision was 1023, the chance of two stations colliding for a second
time would be negligible, but the average wait after a collision would be hundreds of slot times,
introducing significant delay.
Medium Access Control (MAC) | MAC Protocols
Data Link Layer
MAC
Protocols
Collision-based Collision-free
Protocol Protocol
Slotted Non-
Pure-ALOHA 1-Persistent P-persistent
ALOHA persistent
Carrier-
CSMA/CD CSMA/CA
• Idle Channel: Station waits for a period of time called the Inter-frame Space or IFS.
• The IFS time allows the front of the transmitted signal by the distant station to reach the
station (which is sensing channel).
CSMA/CD CSMA/CA
• The number of slots in the window changes according to the binary exponential back-off
strategy.
• The station needs to sense the channel after each time slot.
• If the station finds the channel busy, it does not restart the process; it just stops the timer and
restarts it when the channel is sensed as idle. This gives priority to the station with the
longest waiting time.
Acknowledgement
• The positive ACK and time-out timer can help guarantee that the receiver has received the
frame.
MAC Protocols | CSMA/CA Protocol Carrier-
Sensed
CSMA/CD CSMA/CA
What happens if there is a collision during the time when RTS or CTS control frames are in transition, often
called the handshaking period?
Two or more stations may try to send RTS frames at the same time.
There is no mechanism for collision detection. So, the sender assumes there has been a collision if it has
not received a CTS frame from the receiver.
CSMA/CD CSMA/CA
CSMA/CD CSMA/CA
CSMA/CD CSMA/CA
Even if station ‘B’ would have transmitting to station ‘A’, it would not have been a problem at ‘A’ or ‘D’.
CSMA/CA would not allow it to transmit a message to ‘A’, while the two transmission could have gone in
parallel.
Medium Access Control (MAC) | MAC Protocols
Data Link Layer
MAC
Protocols
Collision-based Collision-free
Protocol Protocol
Slotted Non-
Pure-ALOHA 1-Persistent P-persistent
ALOHA persistent
MAC Protocols | Bit-Map Protocol
Collision-free protocol. Also known as Reservation Protocol.
Each contention period consists of exactly N slots (as many number of stations).
If station ‘0’ has a frame to send, it transmit a 1-bit during the 0th slot. No other station is allowed to
transmit during this slot.
Station ‘j’ may announce that it has a frame to send by inserting a 1-bit in to slot ‘j’.
After all ‘N’ slots have passed by, each station has complete knowledge of which stations wish to
transmit.
Desired to transmit is broadcast before the actual transmission are called RESERVATION Protocol.
The overhead per frame is ‘N’ bits, and the amount of data is ‘d’ bits i.e., to transmit ‘d’ bits, (d+N)
bits are required of which ‘N’ bits are required for collision resolution.
d
Efficiency = (Low Load)
d+N
At high load, when all the stations have something to send all the time, the ‘N’ bits contention period
is prorated over ‘N’ frame, yielding an overhead of only 1-bit per frame.
d
Efficiency = (High Load)
d+1
Medium Access Control (MAC) | MAC Protocols
Data Link Layer
MAC
Protocols
Collision-based Collision-free
Protocol Protocol
Slotted Non-
Pure-ALOHA 1-Persistent P-persistent
ALOHA persistent
MAC Protocols | Polling
Polling works with topologies in which one device is designated as a Primary station and the other
devices are Secondary stations.
All data exchanges must be made through the primary device even when the ultimate destination is a
secondary.
Used whenever the primary device Used by the primary device to solicit
has something to send. transmission from the secondary
device.
Medium Access Control (MAC) | MAC Protocols
Data Link Layer
MAC
Protocols
Collision-based Collision-free
Protocol Protocol
Slotted Non-
Pure-ALOHA 1-Persistent P-persistent
ALOHA persistent
MAC Protocols | Token Passing
Stations will be organized in a LOGICAL ring.
The current station is the one that is accessing the channel now.
The right to this access has been passed from the predecessor to the current station.
The right will be assed to the successor when the current station has no more data to send.
MAC
Protocols
Collision-based Collision-free
Protocol Protocol
Slotted Non-
Pure-ALOHA 1-Persistent P-persistent
ALOHA persistent
MAC Protocols | Binary Countdown Protocol
Collision-free protocol.
Problem with Bit Map Protocol: Overhead is 1 bit per station. So, it does not scale well to
networks with thousand’s of station.
Bidding Cycle: The station wanting to use the channel now broadcasts its address as a binary
bit string, starting with the high-order bit.
The bits in each address position from different stations are BOOLEAN ORed together.
To avoid conflicts, an arbitration rule must be applied: As soon as a station sees that a high-order
bit position is 0 in its address has been overwritten with a 1, it gives up.
If stations 0010, 0100, 1001 and 1010 are all trying to get the channel.
MAC Protocols | Binary Countdown Protocol
Higher numbered stations have a
higher priority than lower-
numbered stations.
d
Channel Efficiency =
d + 𝑙𝑜𝑔2 N
WINNER STATION
(Highest Address)
MAC
Protocols
Collision-based Collision-free
Protocol Protocol
Slotted Non-
Pure-ALOHA 1-Persistent P-persistent
ALOHA persistent
MAC Protocols | Adaptive Tree Walk Protocol
All stations are at the leaves of a binary tree.
The number of stations permitted to transmit can be dynamically adjusted, depending upon traffic.
But the nature of traffic (whether high or low) is not know beforehand. So, a hybrid mechanism is
more useful that switches automatically to collision-based when the traffic is low & other way.
Medium Access Control (MAC) | MAC Protocols
Data Link Layer
MAC
Protocols
Collision-based Collision-free
Protocol Protocol
Slotted Non-
Pure-ALOHA 1-Persistent P-persistent
ALOHA persistent
Data Link Layer | Medium Access Control (MAC) Data Link Layer
• Addressing
Physical Device Addressing
• Channelization
TDMA
FDMA
CDMA
This is a multiple-access method in which the available bandwidth of a link is shared in time,
frequency, or through code, among different stations.
Time Division Multiple Access (TDMA) – the bandwidth is just one channel that is timeshared
between different stations.
Discussed in Physical layer (under Multiplexing Topic)
Frequency Division Multiple Access (FDMA) – the available bandwidth of the common channel is
divided into bands that are separated by guard bands.
Discussed in Physical layer (under Multiplexing Topic)
Code Division Multiple Access (CDMA) – one channel carries all transmission simultaneously.
Discussed in Physical layer (under Spread Spectrum Topic)
Data Link Layer | Medium Access Control (MAC) Data Link Layer
• Addressing
Physical Device Addressing
• Channelization
TDMA
FDMA
CDMA
In 1985, the Computer Society of the IEEE started a project, called Project 802, to set standards to
enable intercommunication between equipment from a variety of manufacturers.
IEEE has standardized a number of LANs and MANs under the name of IEEE 802.
Medium Access Control (MAC) | IEEE Project 802
Data Link Layer
Project
802
Project
802
IEEE 802.3 defines cabling into two categories: Only one specification for
Baseband (Digital) the Broadband Category:
Broadband (Analog) 10Broad36
Frame Format :
Preamble: 56 bits of alternating 0s and 1s. Alert receiver to synchronize its input timing. Added at the
physical layer (not a part of the frame).
SFD (Start of Frame Delimiter): Signal the beginning of the frame (10101011). Warns the station
that this is the last chance for synchronization. This is also added at the physical layer.
IEEE Project 802 | 802.3
Data Link Layer
Frame Format :
Bytes 7 1 6 6 2 0-1500 0-46 4
Destination Source
Preamble SFD Type Data Pad Checksum
Address Address
Type: Defines the upper-layer protocol whose packet (IP, ARP, OSPF etc.) is encapsulated in the
frame.
Pad: To distinguish a valid frames from garbage, 802.3 states that valid frames must be at least 64
bytes long (from destination address to CRC).
If the data portion of a frame is less than 46 bytes, the pad filed is used to fill out
the frame to the minimum size.
CRC: Contains the error detection information, in this case a CRC-32. [Trailer Part of a frame.]
IEEE Project 802 | 802.3
Data Link Layer
10Mbps LAN with maximum length 2500m and 4 repeaters. Thick Ethernet is used (10Base5).
500 500 500 500 500
2500 . 2
Time Taken (RTT) = = 50 𝜇𝑠𝑒𝑐
108
Data rate is 10 Mbps. So, in 50 𝜇𝑠𝑒𝑐, the smallest frame that is guaranteed to work will be 500 bits.
To add some margin of safety, the number is rounded up to 512 bits or 64 bytes.
For 2500 m LAN operation at 1 Gbps, the minimum frame size would to be 6400 bytes.
The way the addresses are sent out online is different from the way they are written in hexadecimal
notation.
The transmission is left to right, byte by byte; however, for each byte, the least significant bit is sent
first and the most significant bit is sent last.
This means that the bit that defines as address as Unicast or Multicast arrives first at the receiver.
47:20:1B:2E:08:EE
Hexadecimal 47 20 1B 2E 08 EE
Binary 01000111 00100000 00011011 00101110 00001000 11101110
Transmitted 11100010 00000100 11011000 01110100 00010000 01110111
0: Unicast
1: Multicast
Medium Access Control (MAC) | IEEE Project 802
Data Link Layer
Project
802
Physically, the token bus is a linear or tree-shaped cable onto which the stations are attached.
Logically, the stations are organized in to a ring, with each station knowing the address of the station to
its left (predecessor) and right (successor).
Since only one station at a time holds the token, collision do not occur.
MAC protocol has a provision for adding and deleting stations to and from the ring.
IEEE Project 802 | 802.4
Data Link Layer
The token bus defines four priority classes (0, 2, 4, 6) for traffic with 0 - the lowest and 6 - the
highest.
As input comes in to the MAC sub-layer, the data are checked for priority and routed to one of the
four sub-stations (as per the defined priority classes). Each sub-stations maintains its own queue of
frames to be transmitted.
Frame Format :
2 2 0-8182
Bytes 1 1 1 4 1
6 6 0-8174
Frame Destination Source End
Preamble SFD Data Checksum
Control Address Address Delimiter
• For data frames, it carries the frame’s priority. It can also carry an indicator requiring the
destination station to ACK correct or incorrect receipt of the frame [Without this indicator,
the destination would not be allowed to send anything because it does not have the
token].
• For control frames, this field is used to specify the frame type. The allowed type include
token passing and various ring maintenance frames, including, the mechanism for
letting new station enter the ring, allowing stations to leave the ring and so on.
Medium Access Control (MAC) | IEEE Project 802
Data Link Layer
Project
802
Token ring resolves the collision issue by requiring that stations take turns sending data.
Each station may transmit only during its turn and may send Only One Frame During Each
Turn.
The mechanism that coordinate this rotation is called Token Passing. A token is a simple
placeholder frame that is passed from station to station around the ring.
Whenever the network is unoccupied, it circulates a simple three-byte token. This token is
passed from NIC to NIC in sequence until it encounters a station with data to send. That station
waits for the token to enter its network board.
IEEE Project 802 | 802.5
Data Link Layer
The data frame proceeds around the ring, being regenerated by each station.
Each intermediate station examines the destination address, finds that the frame is addressed to
another station, and relays it to it neighbour.
The full packet then continues around the ring until it returns to the station
that start it.
The sender receives the frame and recognizes itself in the source address field.
If they are set, it knows the frame was received. The sender then discards the used data frame and
releases the token back to the ring.
IEEE Project 802 | 802.5
Data Link Layer
Token
IEEE Project 802 | 802.5
Data Link Layer
Start Delimiter (SD): Is used to alert the receiving station to the arrival of a frame as well as to allow it
to synchronize its retrieval timing.
Token Monitor
Priority Reservation
Bit Bit
3 1 1 3
The token bit is set to indicate that the frame is a data/command frame rather than a token frame.
Reservation bit can be set by stations wishing to reserve access to the ring.
IEEE Project 802 | 802.5
Data Link Layer
1 7
Rest of the bit contains information used by the token ring logic.
End Delimiter (ED): It indicates the end of the sender’s data and control information.
IEEE Project 802 | 802.5
Data Link Layer
It can be set by the receiver to indicate that the frame has been read, or by the monitor to
indicate that the frame has already been around the ring.
It does tell the sender that the receiving station has copied the frame, which can now be
discarded.
It contains two one-bit pieces of information: Address Recognized (AR) and Frame Copied (FC).
AR FC AR FC
• The repetition is for the purpose of preventing errors (not covered in CRC) and is necessary
because the field contains information inserted after the frame leaves the sending station.
IEEE Project 802 | 802.5
Data Link Layer
AR FC AR FC
• When a frame arrives at the interface of a station with the destination address, the interface
turns on the AR bit as it passes through.
• If the interface copies the frame to the station, it also turns on the FC bit.
When the sending station drains the frame from the ring, it examines the AR and FC bits:
Ring Maintenance:
Each token ring has a monitor station that oversees the ring.
If monitor goes down, a contention protocol ensures that another station is quickly elected as
monitor.
Monitor’s responsibilities:
It opens the ring to drain and issue new token once the ring is cleaned-up.
IEEE Project 802 | 802.5
Data Link Layer
The monitor detects orphan frames by setting the monitor bit in the Access Control byte
whenever it passes through.
Token Monitor
Priority Reservation
Bit Bit
3 1 1 3
If an incoming frame has this bit set, something is wrong since the same frame has
passed the monitor twice without having been drained, so the monitor drains it.
This problem can be solved very elegantly by the use of a wire center.
IEEE Project 802 | 802.5
Data Link Layer
Physically each station is connected to the wire centre by a cable containing two twisted
pairs, one for data to the station and one for data from the station.
Inside the wire centre are bypass relays that are energized by current from the stations.
If ring breaks or station goes down, loss of the drive current will release the relay and
bypass the station.
Medium Access Control (MAC) | IEEE Project 802
Data Link Layer
Project
802