Professional Documents
Culture Documents
COMPUTER NETWORKS
Textbooks:
1. Computer-Networks- Andrew S. Tanenbaum and David J. Wetherall, Pearson Education,
5th-Edition. (www.pearsonhighered.com/tanenbaum)
2. Computer Networking A Top-Down Approach -James F. Kurose and Keith W.
RossPearson Education 7th Edition.
Reference Books:
1. Behrouz A Forouzan, Data and Communications and Networking, Fifth Edition, McGraw
Hill,Indian Edition
2. Larry L Peterson and Brusce S Davie, Computer Networks, fifth edition, ELSEVIER
(As per VTU Syllabus)
2/26/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
CREDITS – 4 (3 T + 2 L)
CIE (Continuous Internal Evaluation) MARKS – 50
SEE (Semester End Examination) MARKS – 50
2/26/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
Course Outcomes:
CO1. Learn the basic needs of communication system.
CO2. Interpret the communication challenges and its solution.
CO3. Identify and organize the communication system
network components
CO4. Design communication networks for user requirements.
2/26/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
Assessment Details (both CIE and SEE)
2/26/2024 ELAIYARAJA P
Program Outcomes:
PROGRAM OUTCOMES
PO's PO Description
Engineering knowledge: Apply the knowledge of mathematics, science, engineering
PO1 fundamentals, and an engineering specialization to the solution of complex
engineering problems.
Problem analysis: Identify, formulate, review research literature, and analyze
PO2 complex engineering problems reaching substantiated conclusions using first
principles of mathematics, natural sciences, and engineering sciences.
Design/development of solutions: Design solutions for complex engineering
problems and design system components or processes that meet the specified needs
PO3
with appropriate consideration for the public health and safety, and the cultural,
societal, and environmental considerations.
Conduct investigations of complex problems: Use research-based knowledge and
PO4 research methods including design of experiments, analysis and interpretation of
data, and synthesis of the information to provide valid conclusions.
Modern tool usage: Create, select, and apply appropriate techniques, resources, and
PO5 modern engineering and IT tools including prediction and modeling to complex
engineering activities with an understanding of the limitations.
The engineer and society: Apply reasoning informed by the contextual knowledge
PO6 to assess societal, health, safety, legal and cultural issues and the consequent
responsibilities relevant to the professional engineering practice.
Environment and sustainability: Understand the impact of the professional
PO7 engineering solutions in societal and environmental contexts, and demonstrate the
knowledge of, and need for sustainable development.
Ethics: Apply ethical principles and commit to professional ethics and
PO8
responsibilities and norms of the engineering practice.
2/26/2024 ELAIYARAJA P
Program Outcomes:
Individual and team work: Function effectively as an individual, and as a member
PO9
or leader in diverse teams, and in multidisciplinary settings.
Communication: Communicate effectively on complex engineering activities with
the engineering community and with society at large, such as, being able to
PO10
comprehend and write effective reports and design documentation, make effective
presentations, and give and receive clear instructions.
Project management and finance: Demonstrate knowledge and understanding of
the engineering and management principles and apply these to one’s own work, as a
PO11
member and leader in a team, to manage projects and in multidisciplinary
environments.
Life-long learning: Recognize the need for, and have the preparation and ability to
PO12 engage in independent and life-long learning in the broadest context of technological
change.
2/26/2024 ELAIYARAJA P
Program Specific Outcomes:
2/26/2024 ELAIYARAJA P
21CS52 –
COMPUTER NETWORKS
2/26/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
Laboratory Component:
1. Implement simple ESS and with transmitting nodes in wire-less LAN by
simulation and determine the throughput with respect to transmission of
packets .
2. Write a program for error detecting code using CRC-CCITT (16- bits).
2/26/2024 ELAIYARAJA P
Module 2 –
The Data link layer,
The medium access control sublayer
2/26/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
sublayer
2/26/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
Module 2 - The Data link layer, The medium access control sublayer
Link layer: introduction
mobile network
terminology: national or global ISP
2/26/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
Module 2 - The Data link layer, The medium access control sublayer
The data link layer takes the packets it gets from the
network layer and encapsulates them into frames for
transmission. Each frame contains a frame header, a payload
field for holding the packet.
2/26/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
Module 2 - The Data link layer, The medium access control sublayer
2/26/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
Module 2 - The Data link layer, The medium access control sublayer
•Framing & Link access: Data Link Layer protocols encapsulate each network frame
within a Link layer frame before the transmission across the link. A frame consists of a
data field in which network layer datagram is inserted and a number of data fields. It
specifies the structure of the frame as well as a channel access protocol by which
frame is to be transmitted over the link.
•Reliable delivery: Data Link Layer provides a reliable delivery service, i.e.,
transmits the network layer datagram without any error. A reliable delivery service is
accomplished with transmissions and acknowledgements. A data link layer mainly
provides the reliable delivery service over the links as they have higher error rates and
they can be corrected locally, link at which an error occurs rather than forcing to
retransmit the data.
2/26/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
Module 2 - The Data link layer, The medium access control sublayer
•Flow control: A receiving node can receive the frames at a faster rate than it
can process the frame. Without flow control, the receiver's buffer can overflow,
and frames can get lost. To overcome this problem, the data link layer uses the
flow control to prevent the sending node on one side of the link from
overwhelming the receiving node on another side of the link.
2/26/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
Module 2 - The Data link layer, The medium access control sublayer
•Error correction: Error correction is similar to the Error detection, except that
receiving node not only detect the errors but also determine where the errors have
occurred in the frame.
2/26/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
Module 2 - The Data link layer, The medium access control sublayer
2/26/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
Module 2 - The Data link layer, The medium access control sublayer
2/26/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
Module 2 - The Data link layer, The medium access control sublayer
2/26/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
Module 2 - The Data link layer, The medium access control sublayer
2/26/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
Module 2 - The Data link layer, The medium access control sublayer
2/26/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
Module 2 - The Data link layer, The medium access control sublayer
Data Link Layer
Unacknowledged connectionless service
• It consists of having the source machine send independent
frames to the destination machine without having the
destination machine acknowledge them.
• Example: Ethernet, Voice over IP, etc. in all the
communication channel were real time operation is more
important that quality of transmission.
2/26/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
Module 2 - The Data link layer, The medium access control sublayer
Data Link Layer
Acknowledged Connectionless Service
• Each frame send by the Data Link layer is acknowledged and
the sender knows if a specific frame has been received or lost.
• Typically the protocol uses a specific time period that if has
passed without getting acknowledgment it will re-send the
frame.
• This service is useful for commutation when an unreliable
channel is being utilized (e.g., 802.11 WiFi).
2/26/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
Module 2 - The Data link layer, The medium access control sublayer
2/26/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
Module 2 - The Data link layer, The medium access control sublayer
2/26/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
Module 2 - The Data link layer, The medium access control sublayer
2/26/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
Module 2 - The Data link layer, The medium access control sublayer
Data Link Layer
Framing
• To provide service to the network layer the data link layer must use the
service provided to it by physical layer.
– Bit Value
2/26/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
Module 2 - The Data link layer, The medium access control sublayer
Data Link Layer
Framing
1. Byte count.
2. Flag bytes with byte stuffing.
3. Flag bits with bit stuffing.
4. Physical layer coding violations.
2/26/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
Module 2 - The Data link layer, The medium access control sublayer
• Once the header information is being received it will be used to determine end
of the frame.
• Trouble with this algorithm is that when the count is incorrectly received the
destination will get out of synch with transmission.
– Destination may be able to detect that the frame is in error but it does not
have a means (in this algorithm) how to correct it.
2/26/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
Module 2 - The Data link layer, The medium access control sublayer
• If they are the same (beginning and ending byte in the frame) they are called flag
byte.
• If the actual data contains a byte that is identical to the FLAG byte (e.g., picture,
data stream, etc.) the convention that can be used is to have escape character
inserted just before the “FLAG” character.
2/26/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
Module 2 - The Data link layer, The medium access control sublayer
• Whenever the sender’s data link layer encounters five consecutive 1s in the data
it automatically stuffs a 0 bit into the outgoing bit stream.
2/26/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
Module 2 - The Data link layer, The medium access control sublayer
Bit stuffing. (a) The original data. (b) The data as they appear on
the line. (c) The data as they are stored in the receiver’s memory after
destuffing.
2/26/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
Module 2 - The Data link layer, The medium access control sublayer
2/26/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
Module 2 - The Data link layer, The medium access control sublayer
2/26/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
Module 2 - The Data link layer, The medium access control sublayer
2/26/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
Module 2 - The Data link layer, The medium access control sublayer
• Two approaches:
2/26/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
Module 2 - The Data link layer, The medium access control sublayer
2/26/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
Module 2 - The Data link layer, The medium access control sublayer
2/26/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
Module 2 - The Data link layer, The medium access control sublayer
Data Link Layer-
Error Detection and Correction
Two basic strategies to deal with errors:
1. Include enough redundant information to enable the receiver
to assume what the transmitted data must have been.
Error correcting codes.
2. Include only enough redundancy to allow the receiver to
assume that an error has occurred (but not which error).
Error detecting codes.
2/26/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
Module 2 - The Data link layer, The medium access control sublayer
Data Link Layer-
Error Detection
1. Parity checking.
2. Internet checksum .
3. Cyclic Redundancy Check (CRC).
2/26/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
Module 2 - The Data link layer, The medium access control sublayer
Error detection
EDC: error detection and correction bits (e.g., redundancy)
D: data protected by error checking, may include header fields
2/26/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
Module 2 - The Data link layer, The medium access control sublayer
Parity checking Can detect and correct errors
(without retransmission!)
single bit parity:
▪ two-dimensional parity:
▪ detect single bit errors
detect and correct single bit
0111000110101011 1 errors row parity
d1,1 ... d1,j d1,j+1
d data bits
d2,1 ... d2,j d2,j+1
parity bit ... ... ... ...
Even/odd parity: set parity di,1 ... di,j di,j+1
column
bit so there is an even/odd parity di+1,1 ... di+1,j di+1,j+1
number of 1’s
no errors: 1 0 1 0 1 1 detected 10101 1
At receiver: 11110 and
0 correctable 10110 0
parity
error
▪ compute parity of d received bits 0 1 1 1 0 1 single-bit 01110 1
▪ compare with received parity bit 0 0 1 0 1 0 error: 00101 0
– if different than error detected parity
error
2/26/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
Module 2 - The Data link layer, The medium access control sublayer
Parity checking
2/26/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
Module 2 - The Data link layer, The medium access control sublayer
wraparound 1 1 0 1 1 1 0 1 1 1 0 1 1 1 0 1 1
sum 1 1 0 1 1 1 0 1 1 1 0 1 1 1 1 0 0
checksum 1 0 1 0 0 0 1 0 0 0 1 0 0 0 0 1 1
complement
2/26/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
Module 2 - The Data link layer, The medium access control sublayer
2/26/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
Module 2 - The Data link layer, The medium access control sublayer
2/26/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
Module 2 - The Data link layer, The medium access control sublayer
Hamming codes
▪ One cannot perform double errors and at the same time
detect quadruple errors.
▪ Error correction requires evaluation of each candidate
codeword which may be time consuming search.
▪ Through design this search time can be minimized.
▪ In theory if n = m + r, this requirement becomes:
(m + r + 1) ≤ 2r
2/26/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
Module 2 - The Data link layer, The medium access control sublayer
Hamming codes
• Codeword: b1 b2 b3 b4 ….
• Check bits: The bits that are powers of 2 (p1, p2, p4,
p8, p16, …).
• The rest of bits (m3, m5, m6, m7, m9, …) are filled
with m data bits.
2/26/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
Module 2 - The Data link layer, The medium access control sublayer
Hamming codes
Consider a message having four data bits (D) which is to be
transmitted as a 7-bit codeword by adding three error control
bits. This would be called a (7,4) code. The three bits to be
added are three EVEN Parity bits (P), where the parity of each is
computed on different subsets of the message bits as shown
below. 7 6 5 4 3 2 1
D D D P D P P 7-BIT CODEWORD
D - D - D - P (EVEN PARITY)
D D - - D P - (EVEN PARITY)
D D D P - - - (EVEN PARITY)
2/26/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
Module 2 - The Data link layer, The medium access control sublayer
Hamming codes
•It may now be observed that if an error occurs in any of the seven
bits, that error will affect different combinations of the three parity
bits depending on the bit position.
2/26/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
Module 2 - The Data link layer, The medium access control sublayer
Hamming codes
7 6 5 4 3 2 1
1 1 1 0 1 1 0 7-BIT CODEWORD
1 - 1 - 1 - 0 (EVEN PARITY) NOT! 1
1 1 - - 1 1 - (EVEN PARITY) OK! 0
1 1 1 0 - - - (EVEN PARITY) NOT! 1
2/26/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
Module 2 - The Data link layer, The medium access control sublayer
Hamming codes
•In fact, the bad parity bits labeled 101 point directly to the bad bit since
101 binary equals 5. Examination of the 'parity circles' confirms that any
single bit error could be corrected in this way.
•The value of the Hamming code can be summarized:
1. Detection of 2 bit errors (assuming no correction is attempted);
2. Correction of single bit errors;
3. Cost of 3 bits added to a 4-bit message.
•The ability to correct single bit errors comes at a cost which is less than
sending the entire message twice. (Recall that simply sending a message
twice accomplishes no error correction.)
2/26/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
Module 2 - The Data link layer, The medium access control sublayer
2/26/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
Module 2 - The Data link layer, The medium access control sublayer
A convolutional code can be represented as (n,k, K) where
• k is the number of bits shifted into the encoder at one time.
Generally, k = 1.
• n is the number of encoder output bits corresponding to k
information bits.
• The code-rate, Rc = k/n .
• The encoder memory, a shift register of size k, is the constraint
length.
• n is a function of the present input bits and the contents of K.
• The state of the encoder is given by the value of (K - 1) bits.
2/26/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
Module 2 - The Data link layer, The medium access control sublayer
2/26/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
Module 2 - The Data link layer, The medium access control sublayer
2/26/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
Module 2 - The Data link layer, The medium access control sublayer
2/26/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
Module 2 - The Data link layer, The medium access control sublayer
2/26/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
Module 2 - The Data link layer, The medium access control sublayer
2/26/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
Module 2 - The Data link layer, The medium access control sublayer
2/26/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
Module 2 - The Data link layer, The medium access control sublayer
Reed-Solomon codes.
Reed-Solomon codes are block-based error correcting codes
with a wide range of applications in digital communications
and storage. Reed-Solomon codes are used to correct errors in
many systems including: Storage devices (including Storage
tape, Compact Disk,DVD,Blueray disk, barcodes, etc)
2/26/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
Module 2 - The Data link layer, The medium access control sublayer
Reed-Solomon codes.
2/26/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
Module 2 - The Data link layer, The medium access control sublayer
2/26/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
Module 2 - The Data link layer, The medium access control sublayer
2/26/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
Module 2 - The Data link layer, The medium access control sublayer
Elementary Data Link Protocols
2/26/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
Module 2 - The Data link layer, The medium access control sublayer
Elementary Data Link Protocols
• Utopian Simplex Protocol
There is one direction of data transmission only from sender to
receiver. Here we assume the communication channel to be error-free and
the receiver will infinitely quickly process the input. The sender pumps out
the data onto the line as fast as it can.
Data are transmitted in one direction only. Both transmitting and
receiving network layers are always ready. Processing time can be ignored.
Infinite buffer space is available. This thoroughly unrealistic protocol,
which we will nickname “Utopia”,
2/26/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
Module 2 - The Data link layer, The medium access control sublayer
Elementary Data Link Protocols
• Utopian Simplex Protocol
2/26/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
Module 2 - The Data link layer, The medium access control sublayer
Elementary Data Link Protocols
• Utopian Simplex Protocol
2/26/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
Module 2 - The Data link layer, The medium access control sublayer
Elementary Data Link Protocols
• Simplex Stop-and-Wait Protocol
• Error-Free Channel
This protocol takes into account the fact that the receiver has
a finite processing speed. If data frames arrive at the receiver’s end at
a rate which is greater than its rate of processing, frames be dropped
out.
In order to avoid this, the receiver sends an acknowledgement
for each frame upon its arrival. The sender sends the next frame only
when it has received a positive acknowledgement from the receiver
that it is available for further data processing.
2/26/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
Module 2 - The Data link layer, The medium access control sublayer
Elementary Data Link Protocols
• Simplex Stop-and-Wait Protocol
• Error-Free Channel
2/26/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
Module 2 - The Data link layer, The medium access control sublayer
Elementary Data Link Protocols
• Simplex Stop-and-Wait Protocol
• Noisy Channel
Simplex Stop – and – Wait protocol for noisy channel is data
link layer protocol for data communications with error control and
flow control mechanisms. It is popularly known as Stop – and –Wait
Automatic Repeat Request (Stop – and –Wait ARQ) protocol.
It adds error control facilities to Stop – and – Wait protocol.
2/26/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
Module 2 - The Data link layer, The medium access control sublayer
• Simplex Stop-and-Wait Protocol -Noisy Channel
2/26/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
Module 2 - The Data link layer, The medium access control sublayer
2/26/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
Module 2 - The Data link layer, The medium access control sublayer
One-Bit Sliding Window Protocol
2/26/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
Module 2 - The Data link layer, The medium access control sublayer
Pipelined protocols
pipelining: sender allows multiple, “in-flight”, yet-
to-be-acknowledged pkts
▪ range of sequence numbers must be increased
▪ buffering at sender and/or receiver
L 8000 bits
Dtrans = R = = 8 microsecs
109 bits/sec
L/R .008
U sender = = 30.008 = 0.00027
RTT + L / R
2/26/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
Module 2 - The Data link layer, The medium access control sublayer
U L/R .008
sender = = = 0.00027
RTT + L / R 30.008
2/26/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
Module 2 - The Data link layer, The medium access control sublayer
U 3L / R .0024
sender = = = 0.00081
RTT + L / R 30.008
2/26/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
Module 2 - The Data link layer, The medium access control sublayer
Pipelined protocols: overview
Go-back-N: Selective Repeat:
❖ sender can have up to N ❖ sender can have up to N
unacked packets in unack’ed packets in
pipeline pipeline
❖ receiver only sends ❖ receiver sends individual
cumulative ack ack for each packet
▪ doesn’t ack packet if
there’s a gap
❖ sender has timer for ❖ sender maintains timer for
oldest unacked packet each unacked packet
▪ when timer expires, ▪ when timer expires,
retransmit all unacked retransmit only that
packets unacked packet
2/26/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
Module 2 - The Data link layer, The medium access control sublayer
sender window (N=4) sender receiver
012345678 send pkt0
012345678 send pkt1
012345678 send pkt2 receive pkt0, send ack0
012345678 send pkt3 Xloss receive pkt1, send ack1
(wait)
receive pkt3, discard,
012345678 rcv ack0, send pkt4 (re)send ack1
012345678 rcv ack1, send pkt5 receive pkt4, discard,
(re)send ack1
ignore duplicate ACK receive pkt5, discard,
(re)send ack1
pkt 2 timeout
012345678 send pkt2
012345678 send pkt3
012345678 send pkt4 rcv pkt2, deliver, send ack2
012345678 send pkt5 rcv pkt3, deliver, send ack3
rcv pkt4, deliver, send ack4
rcv pkt5, deliver, send ack5
GBN in action
2/26/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
Module 2 - The Data link layer, The medium access control sublayer
Selective repeat
sender receiver
data from above: pkt n in [rcvbase, rcvbase+N-1]
❖ if next available seq # in ❖ send ACK(n)
window, send pkt ❖ out-of-order: buffer
timeout(n): ❖ in-order: deliver (also
❖ resend pkt n, restart timer deliver buffered, in-order
pkts), advance window to
ACK(n) in [sendbase,sendbase+N]: next not-yet-received pkt
❖ mark pkt n as received
pkt n in [rcvbase-N,rcvbase-1]
❖ if n smallest unACKed pkt,
advance window base to ❖ ACK(n)
next unACKed seq # otherwise:
❖ ignore
2/26/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
Module 2 - The Data link layer, The medium access control sublayer
Selective repeat in action
sender window (N=4) sender receiver
012345678 send pkt0
012345678 send pkt1
012345678 send pkt2 receive pkt0, send ack0
012345678 send pkt3 Xloss receive pkt1, send ack1
(wait)
receive pkt3, buffer,
012345678 rcv ack0, send pkt4 send ack3
012345678 rcv ack1, send pkt5 receive pkt4, buffer,
send ack4
record ack3 arrived receive pkt5, buffer,
send ack5
pkt 2 timeout
012345678 send pkt2
012345678 record ack4 arrived
012345678 rcv pkt2; deliver pkt2,
record ack5 arrived
012345678 pkt3, pkt4, pkt5; send ack2
2/26/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
sender window receiver window
Module 2 - The Data link layer, The (after receipt) (after receipt)
medium access control sublayer
pkt0
Selective repeat: dilemma 0123012
pkt1
example: 0123012 0123012
0123012 pkt2 0123012
❖ seq #’s: 0, 1, 2, 3 pkt3
0123012
0123012
❖ window size=3 0123012
X
pkt0
❖ receiver sees no will accept packet
with seq number 0
difference in two (a) no problem
scenarios! receiver can’t see sender side.
❖ duplicate data receiver behavior identical in both cases!
something’s (very) wrong!
accepted as new in
(b) 0123012 pkt0
0123012 pkt1 0123012
pkt2
Q: what relationship 0123012
X
0123012
2/26/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
Module 2 - The Data link layer, The medium access control sublayer
THE CHANNEL ALLOCATION PROBLEM
2/26/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
Module 2 - The Data link layer, The medium access control sublayer
2/26/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
Module 2 - The Data link layer, The medium access control sublayer
2/26/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
Module 2 - The Data link layer, The medium access control sublayer
T = 1/(U*C-L)
T(FDM) = N*T(1/U(C/N)-L/N)
2/26/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
Module 2 - The Data link layer, The medium access control sublayer
2. Dynamic Channel Allocation in LANs and MANs:
Station Model.
The model consists of N independent stations (e.g., computers, telephones, or
personal communicators), each with a program or user that generates frames for
transmission. Stations are sometimes called terminals. The probability of a frame
being generated in an interval of length Dt is lDt, where l is a constant (the
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/26/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
Module 2 - The Data link layer, The medium access control sublayer
2. Dynamic Channel Allocation in LANs and MANs
2/26/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
Module 2 - The Data link layer, The medium access control sublayer
2. Dynamic Channel Allocation in LANs and MANs
2/26/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
Module 2 - The Data link layer, The medium access control sublayer
2. Dynamic Channel Allocation in LANs and MANs
5a. 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.
5b. 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.
2/26/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
Module 2 - The Data link layer, The medium access control sublayer
Multiple access protocols
▪ single shared broadcast channel
▪ two or more simultaneous transmissions by nodes:
interference
• collision if node receives two or more signals at the same
time
2/26/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
Module 2 - The Data link layer, The medium access control sublayer
Random access protocols
▪ when node has packet to send
• transmit at full channel data rate R
• no a prior coordination among nodes
▪ two or more transmitting nodes: “collision”
▪ random access protocol specifies:
• how to detect collisions
• how to recover from collisions (e.g., via delayed
retransmissions)
▪ examples of random access MAC protocols:
• ALOHA, slotted ALOHA
• CSMA, CSMA/CD, CSMA/CA
2/26/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
Module 2 - The Data link layer, The medium access control sublayer
Slotted ALOHA
t0 t0+1
operation:
assumptions:
▪ when node obtains fresh frame,
▪ all frames same size transmits in next slot
▪ time divided into equal size slots • if no collision: node can send
(time to transmit 1 frame) new frame in next slot
▪ nodes start to transmit only slot • if collision: node retransmits
beginning frame in each subsequent slot
▪ nodes are synchronized with probability p until success
▪ if 2 or more nodes transmit in slot,
all nodes detect collision
randomization – why?
2/26/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
Module 2 - The Data link layer, The medium access control sublayer
Slotted ALOHA
node 1 1 1 1 1
node 2 2 2 2
C: collision
S: success
node 3 3 3 3
E: empty
C E C S E C E S S
Pros: Cons:
▪ single active node can ▪ collisions, wasting slots
continuously transmit at full rate of
channel ▪ idle slots
▪ highly decentralized: only slots in ▪ nodes may be able to
nodes need to be in sync detect collision in less than
▪ simple time to transmit packet
▪ clock synchronization
2/26/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
Module 2 - The Data link layer, The medium access control sublayer
Slotted ALOHA: efficiency
efficiency: long-run fraction of successful slots (many
nodes, all with many frames to send)
▪ suppose: N nodes with many frames to send, each
transmits in slot with probability p
• prob that given node has success in a slot = p(1-p)N-1
• prob that any node has a success = Np(1-p)N-1
• max efficiency: find p* that maximizes Np(1-p)N-1
• for many nodes, take limit of Np*(1-p*)N-1 as N goes to
infinity, gives:
max efficiency = 1/e = .37
▪ at best: channel used for useful transmissions
37% of time!
2/26/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
Module 2 - The Data link layer, The medium access control sublayer
Pure ALOHA
▪ unslotted Aloha: simpler, no synchronization
• when frame first arrives: transmit immediately
▪ collision probability increases with no synchronization:
• frame sent at t0 collides with other frames
sent in [t0-1,t0+1]
will overlap will overlap
with start of with end of
i’s frame i’s frame
t0 - 1 t0 t0 + 1
▪ pure Aloha efficiency: 18% !
2/26/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
Module 2 - The Data link layer, The medium access control sublayer
2/26/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
Module 2 - The Data link layer, The medium access control sublayer
• transmission aborted on
collision detection
2/26/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
Module 2 - The Data link layer, The medium access control sublayer
CSMA/CD efficiency
▪ Tprop = max prop delay between 2 nodes in LAN
▪ ttrans = time to transmit max-size frame
1
efficiency =
1 + 5t prop /ttrans
▪ efficiency goes to 1
• as tprop goes to 0
• as ttrans goes to infinity
▪ better performance than ALOHA: and simple, cheap,
decentralized!
2/26/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
Module 2 - The Data link layer,
The medium access control sublayer
THE END
2/26/2024 ELAIYARAJA P