Medium Access Control

You might also like

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

Medium Access Control

Sublayer
Channel Allocation
– 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.


- Broadcast n/ws are sometimes known as
multi-access channels or random access
channels.
What is MAC?
- Medium Access Control (MAC) is a sublayer
of the Data-link layer.

- The protocols used to determine who goes next


on a multiaccess channel belongs to a MAC
sublayer.

- MAC is important in LAN which use a


multiaccess channel as the basis for
communication.
3
The Channel Allocation Problem
• There are two schemes to allocate a
single channel among competing users:

1) Static Channel Allocation.

2) Dynamic Channel Allocation

4
Static Channel Allocation
• FDM

• TDM

Wastage of resources when some of the users


are idle.
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.
6
Dynamic Channel Allocation :
Basic assumptions
1. Station model : N independent stations. Once a frame
has been generated, the station is blocked, does
nothing until the frame has been successfully
transmitted
2. Single Channel : A single channel is available for all
communication. All channel can transmit on it and all
can receive from it.

3. Collisions : when more than one station try to transmit


a frame and they overlap in time, both of them are
garbled and we say that a collision has occurred. Both
the frames must be transmitted again.. There are no
errors other than collision
Basic assumptions contd…
4. Continuous time
Frame transmission can begin at any instant.
5. Carrier Sense
Station can tell if the channel is in use before trying to
use it. If the channel is busy, station wont send any
data.
6. No carrier sense
Stations cannot sense the channel before trying to use
it. They just go ahead and transmit.
Multiple Access Protocols
ALOHA

 by Norman Abramson in 1970 to solve channel allocation


problem.

 Here uncoordinated users are competing for the use of a


single shared channel.

 Two versions- based on whether time is divided into


discrete slots into which all frames must fit.
 Pure ALOHA
 Slotted ALOHA
Multiple Access Protocols

– Pure ALOHA does not require global time


synchronization

– Slotted ALOHA does


PURE ALOHA
• Users transmit whenever they have data to be sent.
• There will be collision and colliding frames will be
damaged.
• However due to the feedback property of broadcasting, a
sender can always find out whether its frame was
destroyed by listening to the channel.
• With a LAN, the feedback is immediate.
• With a satellite, there is a delay of 270 msec before the
sender knows if the transmission was successful.
• Some ack is needed.
PURE ALOHA
• If the frame was destroyed, the sender just waits a
random amount of time, and sends it again.

• Systems in which multiple users share a common


channel in a way that can lead to conflicts are widely
known as contention systems.
Pure ALOHA
• We assume that all the frame lengths are
same because ,
-it makes the study easier , and

-the performance of the system is best


when the frames are of fixed size.
Pure ALOHA

In pure ALOHA, frames are transmitted at completely


arbitrary times.
Pure ALOHA
Frame time- amount of time needed to transmit fixed
length frame
• Let N : average number of frames created per frame
time
• G : average number of frames transmitted ( new
frames + retransmission due to collision) per frame
time

• Clearlt G>=N
Pure ALOHA
• A frame will not suffer collision if no other frames are
sent within one frame time of its start.

• Let t be the time required to send a frame.

• If any other user has generated a frame between time t0


and t0+t, the end of that frame will collide with the
beginning of the shaded one.
Pure ALOHA
Contd..
• The frames that collide with the shaded frame are
generated in the intervals to – to+t and to+t – to + 2t.

• Average number of frames generated in these two time
intervals is 2G.
Pure ALOHA

The main disadvantage of Pure ALOHA is a low


channel utilization.

This is expected due to the feature that all users


transmit whenever they want.

19
Slotted ALOHA

• In this method the proposal was to divide the time


into discrete intervals each interval corresponding
to one frame.

• In Slotted ALOHA, a computer can not send


anytime, instead it is required to wait for the
beginning of the time slot.

• The big advantage of Slotted ALOHA is the


increase in channel utilization.

20
Slotted ALOHA

• Pure ALOHA is continuous and slotted ALOHA is


discrete.

• To reduce the chance of collisions the station


should be able to detect what other stations are
doing.

21
ALOHA system
CSMA : Carrier Sense Multiple
Access Protocols
• Protocols in which stations listen for a carrier (i.e
transmission) and act accordingly are called carrier sence
protocols.

• Persistent and Nonpersistent CSMA


1 – persistent CSMA
• When a station is ready to send a frame , it first listen to
the channel.
• If busy : continuously sense it and waits for it to become
free
• If idle : the station transmit a frame.
• If collision occurs , it waits a random amount of time and
starts all over again.
• The protocol is called 1 –persistent because the station
transmits with probability of 1 when it finds the channel
idle.
CSMA contd…
• Propagation delay in CSMA – The propagation delay has
an important effect on the performance of the protocol.

• If signal from station A has not reached station B and


station B is ready to send, it will sense the channel to be
idle and send its frame- resulting in a collision.

• Collision can be there even when propagation delay is


zero and carrier sense is also there –

Two stations wait for a third station to finish and then


transmit simultaneously.
1-persistent contd..
• Better than Pure ALOHA but would have been
better if the two stations were more patient.
Nonpersistent CSMA
• Less greedy than 1 persistent , hence better channel
utilization but longer delays.
• When a station is ready to send a frame , it senses the
channel :
• If no one else is sending, the station begins doing so
itself.
• If busy : waits for random time rather than continuously
sense it for the purpose of seizing it immediately upon
detecting the end of previous transmission
• If idle : sends it .
• If collision : waits for random time and tries again
p- persistent CSMA
• Applies to slotted channels
• Senses the channel when ready
• If busy : waits for the next slot

• If idle : sends its frame with probability p and defers it


with probability q = 1 – p to the next slot : Note that it
defers even when the channel is idle

• Repeats above until either it or some other station grabs


the channel. In case some other station grabs it -it treats
it like a collision I.e. waits for a random time and starts
again
Comparison
CSMA/CD: CSMA with Collision
Detection
• Persistent and non persistent CSMA protocols are better
than ALOHA.

• Because they ensure that no station begins to transmit


when it sense the channel busy.

• Another improvement is for stations to abort their


transmission as soon as they detect a collision.
CSMA/CD: CSMA with Collision
Detection

• If two stations sense the channel to be idle and begin


transmitting simultaneously, they will both detect the
collision almost immediately.
• Rather than finish transmitting their frames, they should
abruptly stop transmitting as soon as collision is
detected.
• This quick termination saves time and bandwidth.
• This protocol CSMA/CD is widely used on LANs in MAC
sublayer.
CSMA with Collision Detection

CSMA/CD can be in one of three states:


contention, transmission, or idle.
CSMA/CD: CSMA with Collision
Detection
• CSMA/CD can be in one of three states: contention,
transmission, or idle.
• At time t0, a station has finished transmitting its frame.
• Any other station having a frame to send may now
attempt to do so.
• If two or more stations decide to transmit
simultaneously, there will be a collision.
• After station detects a collision, it abort its transmission,
waits a random period of time and then tries again.
• Thus CSMA/CD consist of alternating contention and
transmission periods, with idle periods occurring when
all stations are quiet.
CSMA/CD contd..
• If a station detects collision in the midway of
generating its frame, it stops immediately
rather than generating the entire frame.

• Widely used

• Also in Ethernet LAN.


CSMA/CD
• Collisions do not occur in CSMA/CD once a
station has acquired a channel. However, the
collisions can still occur during the contention
periods.
What should be the size of the
contention interval?
• How long does it take for a channel to detect a
collision (max time)?
– Let the time it takes for a signal to travel between the two
farthest stations, say A and B, is t
– At t0, A starts transmitting.
– At t-epsilon, an instant before the signal reaches B, B also
starts transmitting, collision occurs
– But the collided signal reaches back to A not before
additional t time .. I.e. at an instant 2t-epsilon
• Hence it takes about 2t time for A to detect a
collision
• Hence the contention interval must be 2t.

You might also like