Cs601 Notes
Cs601 Notes
Circuit Switching
Packet Switching
Message switching
A connection between two stations is a dedicated path made of one or more links
As a trivial example, let us use a circuit-switched network to connect eight telephones in a small area.
Communication is through 4-kHz voice channels. We assume that each link uses FDM to connect a
maximum of two voice channels. The bandwidth of each link is then 8 kHz.
As another example, consider a circuit-switched network that connects computers in two remote
offices of a private company. The offices are connected using a T-1 line leased from a communication
service provider. There are two 4 × 8 (4 inputs and 8 outputs) switches in this network.
Connection Setup
Data Transfer
Connection Teardown
Efficiency of a Circuit-Switched Network
Not as efficient as packet switching because resources are allocated during the entire duration of the
connection and these resources are unavailable to other connections
In a telephone network, people normally terminate the communication when they have finished their
conversation
Data is not delayed at each switch; the resources are allocated for the duration of the connection
Packet Switching
If the message is going to pass through a packet-switched network, it needs to be divided into packets
of fixed or variable size
The size of the packet is determined by the network and the governing protocol
Datagram Networks
Even if a packet is part of a multi-packet transmission, the network treats it as though it existed alone
Data-Link Layer
The data-link layer on Alice’s computer communicates with the data-link layer
at router R2.
The data-link layer at router R2 communicates with the data-link layer at
router R4, and so on.
Finally, the data-link layer at router R7 communicates with the data-link layer
at Bob’s computer.
Only one data-link layer is involved at the source or the destination, but two data-
link layers are involved at each router. The reason is that Alice’s and Bob’s
computers are each connected to a single network, but each router takes input
from one network and sends output to another network.
A data unit from one point on the Internet needs to pass through many
networks (LANs and WANs) to reach another point.
We refer to the two end hosts and the routers as nodes and the networks
in between as links.
Nodes are devices such as computers or network elements that send, receive,
or process data.
Links are the communication pathways that connect these nodes, enabling the
transfer of data between them.
The first node is the source host; the last node is the destination host.
The first, the third, and the fifth links represent the three LANs; the second and the
fourth links represent the two WANs.
Data-Link Layer is located between the physical and the network layers.
Data-Link Layer provides services to Network Layer and receives services
from Physical layer.
Framing: is the process of structuring data for transmission by adding start
and stop bits, headers, or other delimiters. It helps to set the boundaries of a
data frame, enabling the receiver to identify and extract the transmitted
information accurately.
Encapsulation: involves wrapping data in a specific format or protocol before
transmission. This process adds headers and trailers to the original data,
creating a packet for efficient routing and delivery.
Decapsulation: is the reverse process where the recipient removes the added
headers and trailers to retrieve the original data from the received packet.
Flow Control: control is the regulation of data transmission between devices
to prevent congestion and ensure efficient and reliable information exchange.
Error Control: Error control in data communication involves implementing
techniques to detect and correct errors that may occur during the transmission
of data. These techniques ensure data integrity and reliability. Common error
control methods include checksums, parity bits, and more advanced
techniques like cyclic redundancy check (CRC).
Congestion Control: involves managing and preventing network congestion
to maintain optimal performance. It utilizes techniques such as traffic shaping,
prioritization, and flow control to regulate data flow and prevent network
saturation, ensuring efficient and reliable data transmission.
The datagram received by the data-link layer of the source host is encapsulated
in a frame.
The frame is logically transported from the source host to the router.
The frame is decapsulated at the data-link layer of the router and encapsulated
at another frame.
The new frame is logically transported from the router to the destination host.
Note that, router has separate data link layer for every interface connecting to the
physical link.
Flow control
Congestion Control:
Point-to-point link:
Broadcast link:
Broadcast link is a network connection that allows data to be sent from one sender to
multiple receivers simultaneously. It's like a radio broadcast where one station sends
signals that many people can tune into and receive at the same time. In a broadcast
link, information is shared widely to all connected devices on the network.
It manages the reliable and efficient transfer of data frames between devices
on a network, providing error detection and correction, flow control,
and addressing.
DLC ensures that data is transmitted accurately and in the correct order over
the physical layer.
Media Access Control (MAC) is typically implemented in the data link layer of the
OSI model and used to manage access to a shared communication medium.
It is responsible for assigning unique addresses to network devices and
controlling their access to the communication channel, ensuring that data is
transmitted efficiently and without collisions.
MAC addresses are hardware-based and serve as unique identifiers for devices
on a network.
The MAC protocol is typically implemented in the data link layer of the OSI
model and plays a crucial role in facilitating reliable and orderly
communication within a network.
Each datagram on the Internet, from the same source host to the same
destination host, may take a different path.
We need to remember that the IP addresses in a datagram should not be
changed. If the destination IP address in a datagram changes, the packet never
reaches its destination.
We cannot make a datagram reach its destination using only IP addresses on
the Internet. For that purpose, we need another addressing mechanism in a
connectionless internetwork: the link-layer addresses of the two nodes. A
link-layer address is sometimes called a link address, sometimes a physical
address, and sometimes a MAC address.
Since a link is controlled at the data-link layer, the addresses need to belong
to the data-link layer.
When a datagram passes from the network layer to the data-link layer, the
datagram will be encapsulated in a frame and two data-link addresses are
added to the frame header.
These two addresses are changed every time the frame moves from one link
to another.
The answer is that the host should know its own IP address, which becomes
the source IP address in the packet.
The application layer uses the services of DNS to find the destination address
of the packet and passes it to the network layer to be inserted in the packet.
How are the source and destination link-layer addresses determined for each
link?
Again, each hop (router or host) should know its own link-layer address.
Unicast:
Example
Multicast:
Example
Broadcast:
Example
Anytime a node has an IP packet to send to another node in a link, it has the IP
address of the receiving node.
However, the IP address of the next node is not helpful in moving a frame
through a link; we need the link-layer address of the next node.
This is the time when the Address Resolution Protocol (ARP) becomes
helpful.
ARP maps an IP address to a logical-link address.
ARP accepts an IP address from the IP protocol, maps the address to the
corresponding link-layer address, and passes it to the data-link layer.
Anytime a host or a router needs to find the link-layer address of another host
or router in its network, it sends an ARP request packet.
The packet includes the link-layer and IP addresses of the sender and the IP
address of the receiver.
Because the sender does not know the link-layer address of the receiver, the
query is broadcast over the link using the link-layer broadcast address.
Every host or router on the network receives and processes the ARP request
packet, but only the intended recipient recognizes its IP address and sends back
an ARP response packet.
The response packet contains the recipient’s IP and link-layer addresses. The
packet is unicast directly to the node that sent the request packet.
The system on the left (A) has a packet that needs to be delivered to another
system (B) with IP address N2.
System A needs to pass the packet to its data-link layer for the actual delivery,
but it does not know the physical address of the recipient.
It uses the services of ARP by asking the ARP protocol to send a broadcast
ARP request packet to ask for the physical address of a system with an IP
address of N2.
This packet is received by every system on the physical network, but
only system B will answer it. System B sends an ARP reply packet that
includes its physical address.
Now system A can send all the packets it has for this destination using the
physical address it received.
ARP Packet
In the format of an ARP packet, the names of the fields are self-explanatory.
The hardware type field defines the type of the link-layer protocol; Ethernet
is given the type 1.
The protocol type field defines the network-layer protocol: IPv4 protocol is
(0800)16.
The source hardware and source protocol addresses are variable-length
fields defining the link-layer and network-layer addresses of the sender.
The destination hardware address and destination protocol address fields
define the receiver link-layer and network-layer addresses.
An ARP packet is encapsulated directly into a data-link frame.
The frame needs to have a field to show that the payload belongs to the ARP
and not to the network-layer datagram.
Assume Alice needs to send a datagram to Bob, who is three nodes away on the
Internet.
The packet received needs to go up through these three layers and come down.
At arrival, the physical layer of the left link creates the frame and passes it to
the data-link layer.
The data-link layer decapsulates the datagram and passes it to the network
layer.
The network layer examines the network-layer address of the datagram and
finds that the datagram needs to be delivered to the device with IP address
NB.
The network layer consults its routing table to find out which is the next
node (router) in the path to NB.
The forwarding table returns to N3.
The IP address of router R2 is in the same link as R1.
The network layer now uses the ARP to find the link-layer address of this
router, which comes up as L3.
The network layer passes the datagram and L3 to the data-link layer belonging
to the link at the right side.
The link layer encapsulates the datagram, adds L3 and L2 (its own link-layer
address), and passes the frame to the physical layer.
The physical layer encodes the bits to signals and sends them through the
medium to R2.
Now let us see what happens at Bob’s site, how the signals at Bob’s site are changed
to a message.
Single-bit error means that only 1 bit of a given data unit (such as a byte, character,
or packet) is changed from 1 to 0 or from 0 to 1.
Burst Error means that 2 or more bits in the data unit have changed from 1 to 0 or
from 0 to 1.
Whenever bits flow from one point to another, they are subject
to unpredictable changes because of interference. This interference can change
the shape of the signal.
The term single-bit error means that only 1 bit of a given data unit (such as a byte,
character, or packet) is changed from 1 to 0 or from 0 to 1.
The term burst error means that 2 or more bits in the data unit have changed from 1
to 0 or from 0 to 1.
Types of Errors -1
Single-bit error means that only 1 bit of a given data unit (such as a byte, character,
or packet) is changed from 1 to 0 or from 0 to 1.
Burst Error means that 2 or more bits in the data unit have changed from 1 to 0 or
from 0 to 1.
Whenever bits flow from one point to another, they are subject
to unpredictable changes because of interference. This interference can change
the shape of the signal.
The term single-bit error means that only 1 bit of a given data unit (such as a byte,
character, or packet) is changed from 1 to 0 or from 0 to 1.
The term burst error means that 2 or more bits in the data unit have changed from 1
to 0 or from 0 to 1.
Types of Errors -2
The number of bits affected depends on the data rate and duration of noise.
If we are sending data at 1 kbps, a noise of 1/100 second can affect 10 bits.
If we are sending data at 1 Mbps, the same noise can affect 10,000 bits.
Redundancy
The number of errors and the size of the message are important factors.
If we need to correct a single error in an 8-bit data unit, we need to consider eight
possible error locations.
If we need to correct two errors in a data unit of the same size, we need to consider
28 (permutation of 8 by 2) possibilities.
You can imagine the receiver’s difficulty in finding 10 errors in a data unit of 1000
bits.
Coding
We concentrate on block coding; convolution coding is more complex and beyond the
scope of this book.
Block Coding
We divide our message into blocks, each of ‘k’ bits, called data words.
We add ‘r’ redundant bits to each block to make the length ‘n = k + r’
The resulting ‘n-bit’ blocks are called codewords.
If the following two conditions are met, the receiver can detect a change in the
original code word:
The sender creates code-words out of data words by using a generator that
applies the rules and procedures of encoding (discussed later).
Each code word sent to the receiver may change during transmission.
If the received code word is the same as one of the valid codewords, the word
is accepted; the corresponding data word is extracted for use.
If the received code word is not valid, it is discarded.
However, if the code word is corrupted during transmission but the received
word still matches a valid code word, the error remains undetected.
Block Coding:
We divide our message into blocks, each of ‘k’ bits, called data words.
We add ‘r’ redundant bits to each block to make the length ‘n = k + r’
The resulting ‘n-bit’ blocks are called codewords.
Example
In the above example, assume the sender encodes the data word 01 as 011 and sends it
to the receiver.
Case:1
1. The receiver receives 011. It is a valid code word. The receiver extracts the data
word 01 from it.
Case:2
Case:3
3. The code word is corrupted during transmission, and 000 is received (the right
two bits are
corrupted). This is a valid code word. The receiver incorrectly extracts the data
word 00.
Hamming Distance
The Hamming Distance between two words of the same size is the number of
differences between the corresponding bits.
We show Hamming Distance between two words x and y is d(x,y)
The humming distance between received code word and sent code word is a
number of bits corrupted during transmission.
Example
1. The Hamming distance d(000, 011) is 2 because (000 ⊕ 011) is 011 (two 1s).
If the Hamming distance between the sent and the received code word is not zero, the
code word has been corrupted during transmission.
The Hamming distance can easily be found if we apply the XOR operation (⊕) on the
two words and count the number of 1s in the result.
Note that the Hamming distance is a value greater than or equal to zero.
Minimum Hamming distance is a concept used to measure the similarity between two
sequences, often represented as binary strings. Imagine comparing two binary sequences of
equal length, bit by bit.
The Hamming distance is the count of differing bits between these sequences. The minimum
Hamming distance specifically refers to the smallest number of bit changes needed to make
the two sequences identical.
For example, if we have binary strings '10101' and '10011,' the Hamming distance is 2, but the
minimum Hamming distance is 2, as changing two bits is the smallest modification required
for them to match. This concept finds applications in various fields, including error detection
in computer systems and DNA sequence analysis.
Linear block codes are a specific subset of block codes that possess the additive property you
described. In linear block codes, the exclusive OR (XOR) of two valid codewords results in
another valid codeword. This property is a fundamental characteristic of linear block codes
and is closely related to their algebraic structure.
It involves adding a single parity bit to a data message, ensuring the total number of
bits with a value of 1 is either even (even parity) or odd (odd parity).
This allows the detection of single-bit errors during transmission.
Even parity makes the total 1s even, while odd parity makes it odd. The receiver
checks the parity of the received message, and a mismatch indicates a single-bit error.
Parity checks cannot correct errors but serve as a basic error-detection method.
Cyclic codes are a class of linear block codes with a specific algebraic property related to
cyclic shifts. These codes exhibit a remarkable structure where, if a codeword is valid, any
cyclic shift (rotation) of that codeword is also a valid codeword.
This property simplifies the encoding and decoding processes and makes cyclic codes
particularly useful in various communication systems.
If 1011000 is a codeword and we cyclically left-shift, then 0110001 is also a
codeword
o Single-bit errors
o Double errors
o Odd number of errors
o Burst errors
Easy Implementation
Fast Implementation
A checksum is a value derived from the digital data of a message or file, used to verify the integrity of the data during
transmission or storage.
The checksum is calculated using a specific algorithm and is typically a fixed-size string of characters or a numerical
value.
dmin = 2t + 1
The data link control (DLC) deals with procedures for communication between two
adjacent nodes no matter whether the link is dedicated or broadcast
Data link control functions include framing, flow control and error control
Data Link Control (DLC) Services
The data link control (DLC) deals with procedures for communication between two adjacent
nodes no matter whether the link is dedicated or broadcast
Data link control functions include framing, flow control and error control
Data-Link layer needs to pack bits into frames, so that each frame is distinguishable
from another
Our postal system practices a type of framing
Framing separates a message by adding a sender address and a destination address
The destination address defines where the packet is to go; the sender address helps
the recipient acknowledge the receipt
Frame Size:
o Fixed Size
Size acts as a boundary/delimiter
o Variable Size
How to define Beginning and End of a Frame?
Frame Size:
Several Issues:
Data is stuffed with a pre-defined Escape Character (byte) when there is a character
with same pattern as a flag