Module 2 Part 4

Download as pdf or txt
Download as pdf or txt
You are on page 1of 53

MAC SUBLAYER

▪ MAC (Medium Access Control) Sub layer deals with


broadcast networks and their protocols.
▪ In any broadcast network, the key issue is how to determine
who gets to use the channel when there is competition for it.
▪ Broadcast channels are sometimes referred to as
multiaccess channels or random access channels
▪ The protocols used to determine who goes next on a
multiaccess channel belong to a sublayer of the data link
layer called the MAC (Medium Access Control) sublayer
▪ MAC sublayer is especially important in LANs
▪ central theme:
▪ how to allocate a single broadcast channel among
competing users
2
◻ Data Link layer is divided into two sub layers:
1. Logical Link Control (LLC)
2. Medium Access Control (MAC)

◻ LLC is responsible for error control & flow control.


◻ MAC is responsible for multiple access resolutions.
Position of the MAC layer
Functions of MAC Layer
• It provides an abstraction of the physical layer to the LLC
and upper layers of the OSI network.
• It is responsible for encapsulating frames so that they
are suitable for transmission via the physical medium.
• It resolves the addressing of source station as well as the
destination station, or groups of destination stations.
• It performs multiple access resolutions when more than
one data frame is to be transmitted. It determines the
channel access methods for transmission.
• It also performs collision resolution and initiating
retransmission in case of collisions.
• It generates the frame check sequences and thus
contributes to protection against transmission errors.
MAC Addresses
• MAC address or media access control address is a
unique identifier allotted to a network interface
controller (NIC) of a device.
• It is used as a network address for data transmission
within a network segment like Ethernet, Wi-Fi, and
Bluetooth.
• MAC address is assigned to a network adapter at the
time of manufacturing.
• It is hardwired or hard-coded in the network interface
card (NIC).
• A MAC address comprises of six groups of two
hexadecimal digits, separated by hyphens, colons, or
no separators.
• An example of a MAC address is 00:0A:89:5B:F0:11.
Channel Allocation Problem
◻ In broadcast networks, single channel is shared by several stations.
◻ This channel can be allocated to only one transmitting user at a time.

◻ There are two different methods of channel allocations:

1. Static Channel Allocation


2. Dynamic Channel Allocation
Channel Allocation Problem in
Computer Networks
• Channel allocation is a process in which a single
channel is divided and allotted to multiple users in
order to carry user specific tasks.
Static Channel Allocation
In this method, a single channel is divided among various users
either on the basis of frequency or on the basis of time.
◻ It either uses FDM (Frequency Division Multiplexing) or
TDM (Time Division Multiplexing).
◻ In FDM, fixed frequency is assigned to each user, whereas, in
TDM, fixed time slot is assigned to each user.
◻ If there are N users, the bandwidth is divided into N equal-sized
portions, each user being assigned one portion.
◻ Since each user has a private frequency band, there is no
interference between users.
◻ When there is only a small and constant number of users, each of
which has a heavy (buffered) load of traffic, FDM is a simple and
efficient allocation mechanism
9
▪ Problem with FDM:
▪ When the number of senders is large and continuously
varying or the traffic is bursty, FDM presents some
problems.
▪ If the spectrum is cut up into N regions and fewer than N
users are currently interested in communicating, a large
piece of valuable spectrum will be wasted.
▪ If more than N users want to communicate, some of them
will be denied permission for lack of bandwidth,
▪ even if some of the users who have been assigned a
frequency band hardly ever transmit or receive anything
▪ Same problem apply to time division multiplexing (TDM).
▪ Where each user is statically allocated every Nth time slot.
▪ If a user does not use the allocated slot, it just lies idle. 10
Dynamic Channel Allocation
• The technique in which channels are not permanently allocated
to the users is called dynamic channel allocation. In this
technique, no fixed frequency or fixed time slot is allotted to the
user.
• The allocation depends upon the traffic. If the traffic increases,
more channels are allocated, otherwise fewer channels are
allocated to the users.
• This technique optimizes bandwidth usage and provides fast
data transmission.
Dynamic Channel Allocation
• Possible 5 key assumptions include:

1. Station Model:
Assumes that each of N stations( eg. Computers,telephones etc)
independently produce frames. The probability of producing a
frame in the interval of dt is Idt ,where I is the constant arrival
rate of new frames. Once a frame has been generated, the
station is blocked and does nothing until the frame has been
successfully transmitted.

2. Single Channel Assumption:


A single channel is available for all communication. All stations
can transmit on it and all can receive from it. As far as the
hardware is concerned, all stations are equivalent , although
protocol software may assign priorities to them.
3. Collision Assumption:
If two frames are transmitted simultaneously,
they overlap in time and the resulting signal is
garbled. This event is called collision. All
stations can detect collisions. A collided frame
must be transmitted again later. There is no
error other than those generated by collision.
4. Time can be divided into Slotted or
Continuous. a) Continuous Time: Frame
transmission can be begin at any instant.
There is no master clock dividing time into
discrete intervals.
4 b) Slotted time: Time is divided into discrete
intervals(slots). Frame transmissions always begin at the
start of a slot. A slot may contain 0,1, more frames,
corresponding to an idle slot, a successful transmission,
or a collision , respectively.

5 a) Carrier sense: Stations can tell if the channel is in use


before trying to use it. If the channel is sensed as busy,
no station will attempt to use it until it goes idle.

5 b) No carrier sense: Stations cannot sense the channel


before trying to use it. They just go ahead and transmit.
Only later can they determine whether the
transmission was successful.
Multiple access protocol
• The data link layer is used in a computer network to transmit
the data between two devices or nodes.

• It divides the layer into parts such as data link control and
the multiple access resolution/protocol.

• The upper layer has the responsibility to flow control and the
error control in the data link layer, and hence it is termed
as logical data link control.

• The lower sub-layer is used to handle and reduce the collision or


multiple access on a channel. Hence it is termed as media
access control or the multiple access resolutions.
Multiple access protocol
• When a sender and receiver have a dedicated link
to transmit data packets, the data link control is
enough to handle the channel.
• Suppose there is no dedicated path to
communicate or transfer the data between two
devices.
• In that case, multiple stations access the channel
and simultaneously transmits the data over the
channel. It may create collision and cross talk.
• Hence, the multiple access protocol is required to
reduce the collision and avoid crosstalk between
the channels.
Random Access Protocol
• In this protocol, all the station has the equal priority
to send the data over a channel.
• In random access protocol, one or more stations
cannot depend on another station nor any station
control another station.
• Depending on the channel's state (idle or busy),
each station transmits the data frame.
• If more than one station sends the data over a
channel, there may be a collision or data conflict.
• Due to the collision, the data frame packets may be
lost or changed. And hence, it does not receive by
the receiver end.
• Following are the different methods of
random access protocols for broadcasting
frames on the channel.
• Aloha
• CSMA
• CSMA/CD
• CSMA/CA
ALOHA Random Access Protocol
• It is designed for wireless LAN (Local Area Network) but
can also be used in a shared medium to transmit data.
• Using this method, any station can transmit data across a
network simultaneously when a data frame is available for
transmission.
Aloha Rules
• Any station can transmit data to a channel at any time.
• It does not require any carrier sensing.
• Collision and data frames may be lost during the
transmission of data through multiple stations.
• Acknowledgment of the frames exists in Aloha. Hence,
there is no collision detection.
• It requires retransmission of data after some random
amount of time.
Pure Aloha
• Whenever data is available for sending over a channel
at stations, we use Pure Aloha.
• In pure Aloha, when each station transmits data to a
channel without checking whether the channel is idle
or not, the chances of collision may occur, and the data
frame can be lost.
• When any station transmits the data frame to a
channel, the pure Aloha waits for the receiver's
acknowledgment.
• If it does not acknowledge the receiver end within the
specified time, the station waits for a random amount
of time, called the backoff time (Tb).
• And the station may assume the frame has been lost
or destroyed. Therefore, it retransmits the frame until
all the data are successfully transmitted to the receiver.
• As we can see in the figure above, there are four
stations for accessing a shared channel and
transmitting data frames.
• Some frames collide because most stations send their
frames at the same time.
• Only two frames, frame 1.1 and frame 3.2, are
successfully transmitted to the receiver end.
• At the same time, other frames are lost or destroyed.
Whenever two frames fall on a shared channel
simultaneously, collisions can occur, and both will
suffer damage.
• If the new frame's first bit enters the channel before
finishing the last bit of the second frame, both frames
are completely finished, and both stations must
retransmit the data frame.
Pure Aloha
• Vulnerable time=2* Tfr where Tfr is the frame
transmission time
• Throughput=G*e^-2G where G is the average
number of frames generated by the system
during one frame transmission time
• The maximum throughput Smax=0.184 when
G=1/2
Slotted Aloha
• The slotted Aloha is designed to overcome the pure
Aloha's efficiency because pure Aloha has a very high
possibility of frame hitting.
• In slotted Aloha, the shared channel is divided into a
fixed time interval called slots.
• If a station wants to send a frame to a shared channel,
the frame can only be sent at the beginning of the
slot, and only one frame is allowed to be sent to each
slot.
• And if the stations are unable to send data to the
beginning of the slot, the station will have to wait until
the beginning of the slot for the next time.
• However, the possibility of a collision remains when
trying to send a frame at the beginning of two or more
station time slot.
Slotted Aloha
• Vulnerable time=Tfr which is one half of pure aloha
• Throughput for slotted Aloha is S=G*e^-G
• The maximum throughput Smax=0.368 when G=1
Carrier Sense Multiple Access(CSMA)
• It is a carrier sense multiple access based on media access
protocol to sense the traffic on a channel (idle or busy)
before transmitting the data. It means that if the channel is idle, the
Station can send data to the channel. Otherwise, it must wait
until the channel becomes idle. Hence it reduces the chances of collision

.
CSMA Access Modes
• 1-Persistent: In the 1-Persistent mode of CSMA
that defines each node, first sense the shared
channel and if the channel is idle, it immediately
sends the data. Else it must wait and keep track of
the status of the channel continuously and
broadcast the frame unconditionally as soon as
the channel is idle.
• Non-Persistent: It is the access mode of CSMA
that defines before transmitting the data, each
node must sense the channel, and if the channel is
inactive, it immediately sends the data.
Otherwise, the station must wait for a random
time (not continuously), and when the channel is
found to be idle, it transmits the frames.
• P-Persistent: It is the combination of 1-Persistent and
Non-persistent modes. The P-Persistent mode defines
that each node senses the channel, and if the channel
is inactive, it sends a frame with a P probability. If the
data is not transmitted, it waits for a (q = 1-p
probability) random time and resumes the frame
with the next time slot.
• P=(1-1/N)^N-1 where N is the number of stations
• If P<=1 station can transmit else it has to wait
• O- Persistent: It is an O-persistent method that
defines the superiority of the station before the
transmission of the frame on the shared channel.
Each node is assigned a transmission order by a
supervisory node. If it is found that the channel is
inactive, each station waits for its turn to retransmit
the data.
CSMA/ CD
• It is a carrier sense multiple access/ collision detection
network protocol to transmit data frames.
• The CSMA/CD protocol works with a medium access control
layer.
• Therefore, it first senses the shared channel before
broadcasting the frames, and if the channel is idle, it
transmits a frame to check whether the transmission was
successful.
• If the frame is successfully received, the station sends
another frame.
• If any collision is detected in the CSMA/CD, the station
sends a jam/ stop signal to the shared channel to terminate
data transmission.
• After that, it waits for a random time before sending a
frame to a channel.
• Step 1: Check if the sender is ready for transmitting data packets.
• Step 2: Check if the transmission link is idle?
Sender has to keep on checking if the transmission link/medium is idle. For
this, it continuously senses transmissions from other nodes. Sender sends
dummy data on the link. If it does not receive any collision signal, this
means the link is idle at the moment. If it senses that the carrier is free and
there are no collisions, it sends the data. Otherwise, it refrains from
sending data.
• Step 3: Transmit the data & check for collisions.
Sender transmits its data on the link. CSMA/CD does not use an
‘acknowledgment’ system. It checks for successful and unsuccessful
transmissions through collision signals. During transmission, if a collision
signal is received by the node, transmission is stopped. The station then
transmits a jam signal onto the link and waits for random time intervals
before it resends the frame. After some random time, it again attempts to
transfer the data and repeats the above process.
• Step 4: If no collision was detected in propagation, the sender completes its
frame transmission and resets the counters.
• Frame Transmission time Tfr=2*Tp
• Where Tp is the propagation time
CSMA/ CA
• It is a carrier sense multiple access/collision avoidance
network protocol for carrier transmission of data frames.
• It is a protocol that works with a medium access control
layer.
• When a data frame is sent to a channel, it receives an
acknowledgment to check whether the channel is clear.
• If the station receives only a single (own) acknowledgments,
that means the data frame has been successfully
transmitted to the receiver.
• But if it gets two signals (its own and one more in which the
collision of frames), a collision of the frame occurs in the
shared channel.
• Detects the collision of the frame when a sender receives an
acknowledgment signal.
• Algorithm
• The algorithm of CSMA/CA is:
• When a frame is ready, the transmitting station checks whether the
channel is idle or busy.
• If the channel is busy, the station waits until the channel becomes
idle.
• If the channel is idle, the station waits for an Inter-frame gap (IFG)
amount of time and then sends the frame.
• After sending the frame, it sets a timer.
• The station then waits for acknowledgement from the receiver. If it
receives the acknowledgement before expiry of timer, it marks a
successful transmission.
• Otherwise, it waits for a back-off time period and restarts the
algorithm.
Methods used in the CSMA/ CA to avoid the collision
• Interframe space: In this method, the station waits for the
channel to become idle, and if it gets the channel is idle, it
does not immediately send the data. Instead of this, it
waits for some time, and this time period is called the
Interframe space or IFS. The IFS time is often used to
define the priority of the station.
• Contention window: In the Contention window, the total
time is divided into different slots. When the station/
sender is ready to transmit the data frame, it chooses a
random slot number of slots as wait time. If the channel
is still busy, it does not restart the entire process, except
that it restarts the timer only to send data packets when
the channel is inactive.
• Acknowledgment: In the acknowledgment method, the
sender station sends the data frame to the shared
channel if the acknowledgment is not received ahead of
time.
Controlled Access Protocol
◻ In this method, the stations consult each other to find which station has a right
to send
◻ A station cannot send unless it has been authorized by other station.

◻ The different controlled access methods are

□ Reservation
□ Polling
□ Token Passing
Reservation
◻ In this method, a station needs to make a reservation before sending data.

◻ The time is divided into intervals.


◻ In each interval, a reservation frame precedes the data frames sent in that interval.

◻ If there are N stations, then there are exactly N reservation slots in the reservation
frame.

◻ Each slot belongs to a station.

◻ When a station needs to send a frame, it makes a reservation in its own slot.

◻ The stations that have made reservations can send their frames after the reservation
frame
Polling
Polling method works in those networks where primary and secondary stations
exist.

•In this, one acts as a primary station(controller) and the others are secondary
stations. All data exchanges must be made through the controller. The controller
decides to which node access has to give for data transmission.

•The message sent by the controller contains the address of the node being
selected for granting access

•Although all nodes receive the message but the addressed one responds to it and
sends data, if any. If there is no data, usually a “poll reject”(NAK) message is sent
back.

•Problems include high overhead of the polling messages and high dependence on
the reliability of the controller.
Token Passing
◻ Token passing method is used in those networks where the stations are organized
in a logical ring.

◻ In such networks, a special packet called token is circulated through the ring.

◻ Station that possesses the token has the right to access the channel.

◻ Whenever any station has some data to send, it waits for the token. It transmits data
only after it gets the possession of token.

◻ After transmitting the data, the station releases the token and passes it to the next
station in the ring.

◻ If any station that receives the token has no data to send, it simply passes the token
to the next station in the ring.
Channelization Protocol
◻ Here the available bandwidth of a link is shared in time, frequency or code between
different stations.
◻ There are three basic channelization protocols:

□ Frequency Division Multiple Access (FDMA)


□ Time Division Multiple Access (TDMA)
□ Code Division Multiple Access (CDMA)
FDMA
◻ In FDMA, the available bandwidth is divided into frequency bands.
◻ Each station is allocated a band to send its data.
◻ This band is reserved for that station for all the time.
◻ The frequency bands of different stations are separated by small bands of unused
frequency.
◻ These unused bands are called guard bands that prevent station interferences

◻ FDMA is different from FDM (Frequency Division Multiplexing).


◻ FDM is a physical layer technique, whereas, FDMA is an access method in the data link
layer.
TDMA
◻ In TDMA, the bandwidth of channel is divided among various stations on the basis
of time.
◻ Each station is allocated a time slot during which it can send its data.
◻ Each station must know the beginning of its time slot.
◻ TDMA requires synchronization between different stations.
◻ Synchronization is achieved by using some synchronization bits at the beginning of
each slot.

◻ TDMA is also different from TDM.


◻ TDM is a physical layer technique, whereas, TDMA is an access method in data
link layer.
CDMA
◻ Unlike TDMA, in CDMA all stations can transmit data simultaneously.

◻ CDMA allows each station to transmit over the entire frequency spectrum all the
time.

◻ Multiple simultaneous transmissions are separated using coding theory.

◻ There is neither division of bandwidth nor division of time. In CDMA, each user
is given a unique code sequence
◻ Different CDMA codes are used to distinguish among different users.

◻ Thus data from different stations can be transmitted simultaneously in different


code languages
• Difference between CSMA/CA and CSMA/CD (important)-refer
internet

You might also like