CN Notes Part 1
CN Notes Part 1
Ring: Each device has a dedicated point-to-point connection with the devices on either
side of it. A break in the ring can disable the entire network due to unidirectional traffic.
Classify LAN, WAN, MAN and Internetwork.
LAN is privately owned and links the devices in a single office, building, or campus. The
LAN size is limited to a few kilometers. A LAN will use only one type of transmission
medium. The speed of LAN is in the range 10–1000 Mbps.
WAN provides long-distance transmission of data, image, audio, and video information
over large geographic areas that may comprise a country, a continent, or the whole world.
MAN is a network with a size between a LAN and a WAN. It normally covers the area
inside a town or a city. It is designed for customers who need a high-speed connectivity
to the Internet, and have endpoints spread over a city or part of city.
When two or more independent networks are connected, it becomes an internetwork or
internet.
List the advantages of layering.
It decomposes the problem of building a network into more manageable components.
It provides a more modular design. To add a new service, then it is only needed to modify
the functionality at one layer, reusing the functions at all the other layers.
Uses abstraction to hide complexity of network from application.
Define protocol.
The abstract objects that make up the layers of a network system are called protocols.
Each protocol defines two different interfaces.
o Service interface that specifies the set of operations
o Peer-to-peer interface for messages to be exchanged amongst peers
Protocol is a set of rules that govern communications between devices.
What is a protocol graph?
The suite of protocols that make up a network system is represented as a protocol graph.
The nodes correspond to protocols and edges represent a depends-on relation.
Define network architecture.
The set of rules governing the form and content of a protocol graph is called network
architecture.
Network architecture guides the design and implementation of computer networks.
Two commonly used architecture are
o OSI Architecture
o Internet or TCP/IP architecture
What purpose do header and trailer serve?
A layer communicates control information to its peer, instructing it how to handle the
message when it is received by attaching a header in front of the message.
The trailer usually contains error control information.
A header/trailer is a small data structure consists of a few bytes.
Brief the terms unicast, multicast and broadcast.
The different types of addressing are unicast (one-to-one communication), multicasting
(communicating to all members of a group) and broadcast (sending to all nodes on the network).
Discuss in detail about the layers of OSI model with a neat diagram.
The ISO defined a common way to connect computers, called the Open Systems
Interconnection (OSI) architecture. (eg. public X.25 network)
It defines partitioning of network functionality into seven layers as shown.
The bottom three layers, i.e., physical, data link and network are implemented on all
nodes on the network including switches.
Physical Layer
The physical layer coordinates the functions required to carry a bit stream over a physical
medium.
Representation of bits—To be transmitted, bits must be encoded into signals, electrical or
optical. The physical layer defines the type of encoding.
Data rate—It defines the transmission rate (number of bits sent per second).
Line configuration—The physical layer is concerned with the connection of devices to
the media (point-to-point or multipoint configuration).
Physical topology—It defines how devices are connected (mesh, star, ring, bus or hybrid)
to make a network.
Transmission mode—The physical layer also defines the direction of transmission
between two devices: simplex, half-duplex, or full-duplex
Flow control—If the receiving rate is less than the transmission rate, the data link layer
imposes a flow control mechanism to avoid overwhelming the receiver.
Error control—The data link layer adds reliability to the physical layer by adding a
trailer to detect and retransmit damaged/lost frames and to recognize duplicate frames.
Access control—When two or more devices are connected to the same link, data link
layer protocols determines which device has control over the link at any given time.
Network Layer
The network layer is responsible for the source-to-destination delivery of a data unit
called packet.
Logical addressing—The packet is identified across the network using the logical
addressing system provided by network layer and is used to identify the end systems.
Routing—The connecting devices (routers or switches) prepare routing table to send
packets to their destination.
Transport Layer
The transport layer is responsible for process-to-process delivery of the entire message.
Service-point addressing—It includes a service-point address or port address so that a
process from one computer communicates to a specific process on the other computer.
Segmentation and reassembly—A message is divided into transmittable segments, each
containing a sequence number. These numbers enable the transport layer to reassemble
the message correctly at the destination and to identify/replace packets that were lost.
Connection control—The transport layer can be either connectionless or connection-
oriented.
Flow control—The flow control at this layer is performed end to end.
Error control—The error control at this layer is performed process-to-process. Error
correction is usually achieved through retransmission.
Session Layer
The session layer is the network dialog controller. It establishes, maintains, and
synchronizes the interaction among communicating systems.
Dialog control—It allows two systems to enter into a dialog and communication between
two processes to take place in either half-duplex / full-duplex mode.
Synchronization—The session layer allows a process to add checkpoints, or
synchronization points, to a stream of data. For example, when checkpoints are inserted
for every 100 pages and if a crash happens during transmission of page 523, then only
pages 501 to 523 need to be resent.
Binding—binds together the different streams that are part of a single application. For
example, audio and video stream are combined in a teleconferencing application.
Presentation Layer
The presentation layer is concerned with the syntax and semantics of the information
exchanged between peers.
Translation—Because different computers use different encoding systems, the
presentation layer is responsible for interoperability between these encoding methods.
Encryption—To carry sensitive information, a system ensures privacy by encrypting the
message before sending and decrypting at the receiver end.
Compression—Data compression reduces the number of bits contained in the
information. It is particularly important in multimedia transmission.
Application Layer
The application layer enables the user, whether human or software, to access the network.
It provides user interface and support for services such as electronic mail, remote file
access and transfer, shared database management and several types of distributed
information services.
Network virtual terminal—A network virtual terminal is a software version of a physical
terminal, and it allows a user to log on to a remote host.
File transfer, access, and management—This application allows a user to access/retrieve
files in a remote host, and to manage or control files in a remote computer locally.
Mail services—This application provides the basis for e-mail forwarding and storage.
Directory services—This application provides distributed database sources and access for
global information about various objects and services.
Define encapsulation.
As data passes through a layer, it attaches its header and then passes it to the next layer.
For the next layer, the data and header of the previous layer is encapsulated as a unit.
It then attaches its header and passes to the next layer and so on.
It does not enforce strict layering, i.e., applications are free to bypass transport layer and
can directly use IP or any of the underlying networks.
IP layer serves as focal point in the architecture i.e., it defines a common method for
exchanging packets to any type of network and segregates host-to-host delivery from
process-to-process delivery.
For any protocol to be added to the architecture, it must also be accompanied by at least
one working implementation of the specification. Thus efficiency is ensured.
TCP/IP does not define any specific protocol for the lowest level (physical/data link
layers of OSI).
o All standard and proprietary protocols such as Ethernet, FDDI, etc are supported.
o The protocols are generally implemented by a combination of hardware/software.
Network layer consists of a major protocol, the Internetworking Protocol (IP).
o It supports the interconnection of multiple networking technologies into a logical
internetwork.
o It is an unreliable and connectionless protocol.
o IP sends data in packets called datagrams, each of which is transported separately
and independently.
o The other protocols supported in this layer are ARP, RARP, ICMP and IGMP.
Transport layer is responsible for delivery of a message from one process to another
process. The two protocols supported in this layer are:
o Transmission Control Protocol (TCP) for connection-oriented reliable byte-
stream channel.
o User Datagram Protocol (UDP) for connectionless unreliable datagram delivery
channel.
Application layer supports a wide range of protocols such as FTP, TFTP, Telnet (remote
login), SMTP, etc., that enable the interoperation of popular applications. This layer is
equivalent to combined session, presentation, and application layers in the OSI model.
Classify the various physical medium and highlight their merits and demerits.
Network links are implemented on media that is either guided (wired) or unguided (wireless).
GUIDED MEDIA
The guided media is broadly classified into Twisted-pair, Coaxial and Fiber-optic cable
Twisted-Pair Cable
The least-expensive and most commonly-used transmission medium is twisted-pair.
The copper wires are twisted together to reduce the electrical interference.
UTP cable is commonly used for LANs such as 10Base-T and 100Base-T. The most
common UTP connector is RJ45.
UTP cable suffers from attenuation and need repeaters for long distance transmission
(every 100m in case of CAT-5).
Twisted-pair cables are also used in telephone lines to provide voice and data channels.
DSL lines also use the high-bandwidth capability of UTP cables.
Coaxial Cable
It has a central core conductor enclosed in an insulating sheath, which in turn is encased
in an outer conductor of metal foil.
Coaxial cable carries signals of higher frequency ranges than those in twisted-pair cable
To connect coaxial cable to devices, coaxial connectors such as BNC connector, BNC T
connector and BNC terminator are used.
Coaxial cables are categorized by their radio government (RG) ratings. Some are:
Category Usage Bandwidth Distance
RG-59 Cable TV
RG-58 Thin Ethernet 10–100 Mbps 200 m
RG-11 Thick Ethernet 10–100 Mbps 500 m
The outer jacket is made of PVC/Teflon. Inside the jacket are Kevlar strands to
strengthen the cable. Below the Kevlar is another plastic coating to cushion the fiber.
The attenuation is much lesser and few (10 times less) repeaters are required.
Supports higher bandwidth and longer transmission distance.
Fiber-optic cables are immune to interference and corrosive-resistant.
Installation and maintenance require expertise and fiber-optic cables are more expensive.
Two fiber-optic cables are required for duplex communication (light is unidirectional)
Cable TV companies use optical fiber to provide the backbone structure. LANs such as
100Base-FX network and 1000Base-X also use fiber-optic cable.
UNGUIDED MEDIA
Unguided media transport signals through free space.
It can be broadly classified as Radio waves, Micro waves and Infrared.
Signals can travel through ground, sky or line-of-sight propagation.
The spectrum pertaining to radio waves and microwaves is divided into bands, regulated
by government authorities. It ranges from very low to extremely high frequency.
Radio Waves
The frequency range is 3 kHz – 1 GHz.
Radio waves are omni-directional and hence antennas need not be aligned.
The waves transmitted by one antenna are susceptible to interference by another.
Radio waves that propagate in the sky mode, can travel long distances and is used for
long-distance broadcasting such as AM radio.
Radio waves of low and medium frequencies can penetrate walls and used in FM radio,
maritime radio, cordless phone, paging, etc.
Microwaves
Microwaves have frequencies between 1 and 300 GHz.
Microwaves are unidirectional. Hence sending and receiving antennas should be aligned.
A pair of antennas can be aligned without interfering with another aligned pair.
Microwave propagation is line-of-sight.
Very high-frequency microwaves cannot penetrate walls.
They are used in cellular phone networks, satellite networks, and wireless LANs.
Infrared
Infrared waves frequencies ranges from 300 GHz to 400 THz.
It can be used for short-range communication only within a closed space.
Infrared waves have high frequencies and cannot penetrate walls.
IrDA has established standards for communication between devices such as keyboards,
mouse, PCs, and printers.
Infrared signals transmit through line of sight with very high data rate of transmission.
Last mile links
If two nodes to be connected are on opposite sides of the country/town, then only option is to
lease a dedicated link from the telephone company which is expensive. The less expensive
options available are last-mile links that span from the home to a service provider. Some
common services and their bandwidth are:
Service Bandwidth
POTS 28.8–56 Kbps
ISDN 64–128 Kbps
xDSL 16 Kbps–55.2 Mbps
CATV 20–40 Mbps
Explain the various channel access methods (or) different types of multiplexing.
Channel access method allows several terminals/users connected to a medium to transmit
over it by sharing the capacity with least possible degradation.
A channel-access scheme is based on a multiplexing method. Examples are wireless
networks, bus, ring, hub networks and half-duplex point-to-point links.
Multiplexing allows simultaneous transmission of multiple signals across a single data
link. It results in efficient utilization of bandwidth.
Multiplexing is provided by the physical layer. The four different access schemes are:
o Frequency Division Multiple Access (FDMA)
o Time Division Multiple Access (TDMA)
o Code Division Multiple Access (CDMA)
o Space Division Multiple Access (SDMA)
FDMA
FDMA channel-access scheme is based on the frequency division multiplexing (FDM).
FDM is an analog multiplexing technique that combines analog signals.
In FDMA, the available bandwidth is divided into frequency bands.
Each station is allocated (static/dynamic) a band to send its data.
The stations use bandpass filter to confine to its transmitter frequencies.
FDMA specifies a predetermined frequency band for the entire period of communication.
To prevent station interferences, the allocated bands are separated from one another by
small guard bands.
It does not require synchronization or timing control and is simple to implement.
When a channel is not in use, the bandwidth is wasted.
Use of simultaneous access to the medium by base station and mobile station in cellular
networks is called frequency division duplex (FDD)
It is used in continuous analog transmission such as TV broadcast, 1G cellular, etc.
TDMA
TDMA channel-access scheme is based on the time-division multiplex (TDM).
TDM is a digital multiplexing technique for combining several low-rate channels into a
high-rate one.
In TDMA, the stations use the entire bandwidth with time-sharing.
Each station is allocated a time slot of fixed length for data transmission.
Each station needs to know the beginning of its slot and the location of its slot.
The main problem lies in achieving synchronization between different stations.
Synchronization is done by having some preamble bits at the beginning of each slot
To compensate for the delays, guard times are inserted.
For example, node1 may use time slot1, node2 time slot2, etc. in rounds. The unused
slots go idle.
In Dynamic TDMA (DTDMA), stations may not be allotted the same slot in next round.
Assigning different slots for uplink and downlink using the same frequency is called time
division duplex (TDD).
GSM uses TDMA technique.
CDMA
CDMA differs from FDMA because channel uses entire bandwidth of the link.
CDMA differs from TDMA because all stations can send data simultaneously.
In CDMA, the channel carries all transmissions simultaneously.
CDMA scheme is based on spread spectrum technique, i.e., a wider spectrum is used than
the data rate of each of the transferred bit streams.
Spreading is done in two ways namely Direct Sequence spread spectrum (DS-CDMA)
and Frequency Hopping (FH-CDMA)
Each station is assigned a code, which is a sequence of numbers called chips. A station's
code is orthogonal to all other stations.
In CDMA, 0 bit is encoded as -1 and 1 bit is encoded as +1.
Several message signals are transferred simultaneously over the same carrier frequency
with different spreading codes.
CDMA is used in 3G technologies, since it enables more users to use a limited spectrum.
SDMA
Space Division Multiple Access (SDMA) is used for allocating a separated space to users
in wireless networks.
The main advantage of SDMA is reusing the same set of cell phone frequencies in a
given service area, provided the distance is maintained between cells.
SDMA uses smart antenna backed by intelligent signal processing.
SDMA technology channels radio signals based on the location of the mobile station,
thereby saving network resources and redundant signal transmission.
SDMA can be configured and deployed on FDMA/TDMA/CDMA.
SDMA is a multiple-input multiple-output most suitable for mobile ad-hoc networks.
Hybrid examples
2G cellular uses FDMA and TDMA to allow multiple handsets to work in a single cell.
Bluetooth packet mode communication combines Frequency hopping with CSMA/CA.
The GPRS packet switched service combines FDMA with slotted Aloha for reservation
inquiries and DTDMA scheme for transferring data.
WLANs based on FDMA and DS-CDMA is combined with CSMA/CA for multiple
accesses within the cell.
HIPERLAN/2 wireless networks combine FDMA with dynamic TDMA, to achieve
resource reservation by packet scheduling.
FDMA
TDMA
SDMA
CDMA
Explain how framing is done using bit and byte oriented protocols.
Framing enables the message to reach the destination by adding physical address of
sender and destination.
When a message is divided into smaller frames, error affects only that small frame.
In fixed-size framing, there is no need for defining frame boundary.
In variable-size framing, receiver should be able to determine where a frame starts/ends.
BYTE-ORIENTED PROTOCOLS
The byte-oriented protocols are Binary Synchronous Communication (BISYNC) and Digital
Data Communication Message Protocol (DDCMP). The two different approaches are sentinel
and the byte-counting.
Sentinel approach
The frame format of BISYNC protocol developed by IBM is given below.
Byte-Counting Approach
An alternative to detecting the end-of-frame with a sentinel value is to include number of
bytes in the frame body as part of the frame header.
DECNET’s DDCMP protocol uses the count approach. The frame format is
The Count field specifies how many bytes are contained in the frame’s body.
If Count field is corrupted, then it is known as framing error.
The receiver comes to know of it when it comes across the SYN field of the next frame.
In such case, the receiver discards the previous frame.
BIT-ORIENTED PROTOCOL
The bit-oriented protocols such as High-Level Data Link Control (HDLC) view the frame
as a collection of bits. The frame format
The beginning and end of a frame has a distinguished bit sequence 01111110
Sequence is also transmitted when link is idle for synchronization
Bit Stuffing
To prevent occurrence of bit pattern 01111110 as part of frame body, bit stuffing is used.
In bit stuffing, if a 0 and five consecutive 1 bits are encountered, an extra 0 is added.
This extra stuffed bit is eventually removed from the data by the receiver.
The real flag 01111110 is not stuffed by the sender and is recognized by the receiver
If a bit such as 01111111 arrives, then an error has occurred and the frame is discarded.
Clock-based Framing
Synchronous Optical Network (SONET) standard is clock-based framing of fixed size.
SONET runs on the carrier's optical network and offers rich set of services.
A SONET STS-1 frame is arranged as nine rows of 90 bytes each, shown below
The first 3 bytes of each row are overhead, with the rest being available for data
The first 2 bytes of the frame contain a special bit pattern indicating start of frame.
Bit stuffing is not employed here
The receiver looks for the special bit pattern once in every 810 bytes. If not so, the frame
is discarded.
The overhead bytes of a SONET frame are encoded using NRZ encoding. To allow the
receiver to recover sender’s clock, the payload bytes are scrambled.
SONET supports the multiplexing of multiple low-speed links. The links range from
51.84 Mbps (STS-1) to 2488.32 Mbps (STS-48).
At STS-1 rates, a frame is 810 bytes long, while at STS-3 rates, each frame is 2430 bytes
long. The multiplexing of three STS-1 frame onto one STS-3 is shown
STS-N signal can being used to multiplex N STS-1 frames. The payload from STS-1
frames are linked together to form a STS-N payload, denoted as STS-Nc.
Burst error means that 2 or more bits in the data unit have changed
The length of the burst is measured from the first corrupted bit to the last corrupted bit.
Explain error detection and error correction methods in detail with an example
ERROR DETECTION
Error detection is only to see if any error has occurred
A single-bit error or a burst error is immaterial
The basic idea behind any error detection scheme is to add redundant information to a
frame that can be used to determine if errors have been introduced.
An efficient system should have k redundant bits for n data bits such that k << n
Simple Replication
Transmit two copies of the data
If the two copies are identical at the receiver, then it is correct
If they differ, then an error was introduced and henceforth discarded
This is a poor error detection scheme for two reasons:
o It sends n redundant bits for an n-bit message
o Any error that corrupts the same bit positions in both copies is undetected
Vertical Redundancy Check (VRC)
It is based on simple parity, which adds one extra bit to a 7-bit code.
The 8th bit is set to make number of 1s in the byte as even, otherwise 0.
It is used to detect all odd-number errors in the block.
0110011 01100110
0110001 01100011
Two-Dimensional Parity
Data is divided into seven byte segments. Both VRC and LRC methods are applied.
Even parity is computed for all bytes (VRC).
Even parity is also calculated for each bit position across each of the bytes (LRC).
Thus a parity byte for the entire frame, in addition to a parity bit for each byte is sent.
The receiver recomputes the row and column parities. If parity bits are correct, the frame
is accepted else discarded.
Two-dimensional parity is more efficient than the repetition code method.
Internet Checksum
The 16-bit checksum is not used at the link layer but by the upper layer protocols (UDP).
Sender
The data is divided into 16-bit words.
The initial checksum value is 0.
All words (incl. checksum) are summed using one's complement arithmetic.
o Carries (if any) are wrapped and added to the sum.
The complement of sum is known as checksum and is sent with data
o Another way is subtracting number from 2n – 1 (where n is no. of bits)
Receiver
The message (including checksum) is divided into 16-bit words.
All words are added using one's complement addition.
The sum is complemented and becomes the new checksum.
If the value of checksum is 0, the message is accepted, otherwise it is rejected.
7 0111 0111
11 1011 1011
12 1100 1100
6 0110 0110
Initial Checksum 0000 Received Checksum 1001
Sum 100100 Sum 101101
Carry 10 Carry 10
Sum 0110 Sum 1111
Checksum 1001 New Checksum 0000
Sender Receiver
Analysis
The nature of checksum is well-suited for software implementation.
It is not as strong as the CRC in error-checking capability
o If value of one word is incremented and another word is decremented by the same
amount, the errors are not detected because sum and checksum remain the same.
o If the values of several words are incremented and the total change is a multiple
of 65535, then also errors are not detected
Receiver
Divide the received polynomial by C(x) as done in sender
If the remainder is non-zero then discard the frame
If zero, then no errors and redundant bits are removed to obtain data
Divisor Polynomial
The divisor polynomial C(x) should has the following error-detecting properties:
o All single-bit errors, as long as the xk and x0 terms have nonzero coefficients.
o Any “burst” error for which the length of the burst is less than k bits.
o Any odd number of errors, as long as C(x) contains the factor (x + 1)
The versions of C(x) widely used in link-level protocols are CRC-8, CRC-10, CRC-12,
CRC-16, CRC-CCITT and CRC-32.
CRC algorithm is implemented in hardware using a k-bit shift register and XOR gates.
CRC is widely used in networks such as LANs and WANs
ERROR-CORRECTION
Error correcting codes determine the corrupted bits and correct it
Allows the recipient to reconstruct the correct message even after it has been corrupted
Hamming code is used to correct single bit error
Reed Solomon code is used to correct burst errors
The use of error-correcting codes is often referred to as forward error correction
Hamming code
Hamming codes are code words formed by adding redundant check bits, or parity bits, to
a data word
A frame consists of m data (i.e., message) bits and r redundant or parity bits.
An n-bit unit containing data and parity bits is known as an n-bit codeword.
The error-detecting & error-correcting properties of a code depend on Hamming distance.
To design a code with m message bits and r parity bits, that will allow all single errors to
be corrected, then 2r m + r + 1.
The bits of the codeword are numbered consecutively, starting with bit 1 from the left.
The bits that are powers of 2 (1, 2, 4, 8, 16, etc.) are parity bits.
The remaining bits (3, 5, 6, 7, 9, 10, 11, 12, … etc.) are m data bits.
Each parity bit forces the parity on some collection of bits, including itself, to be even.
Each parity bit calculates the parity for some of the bits in the code word. The position of
parity bit determines the sequence of bits that it alternately checks and skips.
o P1 check parity for bits 1, 3, 5, 7, 9, 11, 13, ... (skip every bit alternately)
o P2 check parity for bits 2,3, 6,7, 10,11, 14,15, ... (skip every 2 bits alternately)
o P4 check parity for bits 4,5,6,7, 12,13,14,15, ... (skip every 4 bits alternately)
o P8 check parity for bits 8-15, 24-31, ... (skip every 8 bits alternately)
o P16 check parity for bits 16-31, 48-63, ... (skip every 16 bits alternately)
Set a parity bit to 1 if the total number of ones in the positions it checks is odd.
Example
Consider data 11010110 to be encoded using even-Hamming code.
For the given data, m = 8 (no. of bits) and r takes value 4 such that 2r m + r + 1
The unknown parity bits are embedded into data at bit positions shown below:
For P8, check parity for bits 8, 9, 10, 11 and 12. So its value is 1.
o Its value is 1 (? 1 1 0 1).
The transmitted code word is 110110111001
Error correction
If due to error, the received word is
The receiver recomputes parity bits and checks whether it is same as the received one.
For P1', check parity for bits 1, 3, 5, 7, 9 and 11.
o Its value is 0 (? 0 0 0 1 1) and differs with the received value.
For P2', check parity for bits 2, 3, 6, 7, 10 and 11.
o Its value is 0 (? 0 1 0 0 1) and is same as the received value.
For P4', check parity for bits 4, 5, 6, 7 and 12.
o Its value is 0 (? 1 0 0 1) and differs with the received value.
For P8', check parity for bits 8, 9, 10, 11 and 12.
o Its value is 1 (? 1 1 0 1) and is same as the received value.
The bit positions of the non-matching parity bits are added to determine the corrupt bit.
The corrupt bit is complemented and hence the original data is restored.
In the given example, parity bits at position 1 and 4 do not match. Therefore, the 5th bit is
corrupt and changed to 1. The corrected data is 110110111001.
Drawbacks
It allows the sender to have only one outstanding frame on the link at a time
Inefficient if the channel has a large bandwidth and the round-trip delay is long.
The window defines range of sequence numbers for both sender and receiver to deal with.
The window position change (slides) due to transmission of frame and acknowledgement
Sender
The sender assigns a sequence number SeqNum to each frame.
The sender associates a timer with each frame it transmits, and retransmits the frame
when the timer expires before an ACK is received.
It maintains three state variables:
o The send window size SWS gives the upper bound on the number of outstanding
frames that the sender can transmit.
o LAR denotes the sequence number of the last acknowledgment received.
o LFS denotes the sequence number of the last frame sent.
o The invariant LFS LAR SWS is always maintained
When an acknowledgment arrives, the sender moves LAR to the right, thereby allowing
the sender to transmit the subsequent frames.
The sender buffers up to SWS frames (for retransmission), until they are acknowledged.
Receiver
Similarly the receiver maintains three state variables:
o The receive window size RWS gives the upper bound on number of out-of-order
frames that the receiver is willing to accept.
o LAF denotes acceptable frame with the largest sequence number
o LFR denotes sequence number of the last frame received
o The invariant LAF LFR RWS is always maintained.
Frame Arrival
A frame numbered SeqNum is accepted if LFR < SeqNum LAF, otherwise discarded.
Frames can arrive out of order and may be buffered.
If all frames, say with sequence number SeqNumToAck have arrived, the receiver
acknowledges frame SeqNumToAck. The variables updated are:
o LFR = SeqNumToAck
o LAF = LFR + RWS
Window size
SWS depend on how many frames are expected to be outstanding on the link. It is based
on delay × bandwidth product.
RWS is either set to 1 or the value of SWS.
Sequence Number
The sequence numbers are modulo 2m where m is the size of the sequence field in bits.
o In case of a 3-bit field, there are eight possible sequence numbers, 0…7
The sequence numbers wrap around and MaxSeqNum denotes number of available
sequence numbers.
To avoid the issue of identifying sequence numbers of different sets, SWS is defined as
SWS < (MaxSeqNum + 1)/2
Example
The following example shows the slide in sender and receiver window due to frame
transmission and receipt of acknowledgement.
Selective Repeat
The size of RWS is set to SWS.
The receiver acknowledges a frame, only if all lower numbered frames have arrived. The
acknowledgement is cumulative. Acknowledged frames are passed onto network layer.
The receiver buffers out of order frames but does not acknowledge.
It sends a negative acknowledgement (NAK) indicating to the sender to retransmit the
expected frame.
Complexity is built into the receiver to handle frames that arrive out of sequence.
NAK speeds up retransmission of a frame before timer expires and improves performance.
Requires large amount of data link layer memory, if the window is large.