Unit I

You might also like

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 408

UNIT I

Topics
INTRODUCTION: Data Communications - Networks - Network
criteria - Physical Structure - Network Types - Standards and
Administration.

NETWORK MODELS: Protocol Layering - TCP/IP Protocol Suite –


The OSI Model.

INTRODUCTION TO PHYSICAL LAYER: Data and signals -


Periodic Analog Signals - Digital Signals - Transmission impairment -
Data Rate Limits - Performance.
Introduction to Data
Communications
Data communications
• It is the exchange of data between two devices through some transmission medium.
• Types – Local and Remote
• Fundamental Characteristics
1. Delivery
2. Accuracy
3. Timeliness
4. Jitter
• Data communication systems are made up of five components
1. Message
2. sender
3. Receiver
4. Medium
5. Protocol
..contd..

1. Message – text, numbers, images, audio, video


2. Sender – computer , workstation, telephone handset, video camera, television
3. Receiver – same as sender
4. Transmission medium – physical path( twisted pair wire, fiber-optic cable,
radio waves)
5. Protocol – set of rules (sender: french , receiver: german )
Direction of dataflow
..contd..
• Simplex
 Unidirectional communication
 Eg: keyboard, monitor
 This mode can use entire capacity of the channel to send data in one
direction.
• Half – Duplex
 Each station can both transmit and receive, but not at the same time.
 When one device is sending, the other can only receive, and vice versa.
 Eg: Walkie- talkies
 The entire capacity of the channel can be used for each direction.
..contd..
• Duplex (full - duplex)
 Both stations can transmit and receive simultaneously.
 Either the link must contain two physically separate transmission paths, one
for sending and the other for receiving; or the capacity of the channel is
divided between signals travelling in both directions.
 Example – telephone.
Basics of Networks
Networks
• A network is the interconnection of a set of devices capable of
communication.
• Device can be a host such as a computer, cellular phone, security
system, router, switch or modem.
• Network Criteria:
• Performance – Transit time & Response time, Throughput & Delay
• Reliability – Frequency of failure, Recovery time, Robustness
• Security – Unauthorized access, Protection against damages & virus
Types of connections
..contd..
• Point to Point
• Provides a dedicated link between two devices.
• Single transmitter and receiver
• Example - Connection between the remote control and the television’s control
system
• Multipoint
• It is also called as Multidrop.
• More than two devices share a single link.
• The capacity of the channel is shared, either spatially or temporally.
• Spatial - if several devices can use the link simultaneously, it is a spatially
shared connection.
• Temporal - if users take turns, it is a timeshared connection.
Topology
• Representation of physical arrangements of the links and
nodes in a network.
• The way in which a network is laid out either physically or
logically.
• Two or more devices connect to a link. Two or more links
form a topology.
• It is the geographical representation of the relationship of all
the links and linking devices to each other.
Mesh Topology
..contd..
• Every device has a dedicated point-to-point link to every other device.
• Total number of links: n (n -1) links. Duplex links have n(n -1)/2 physical channels
to link ‘n’ devices.
• Every device on the network must have n – 1 input / output (I/O) ports. Uses point
to point connections.
Advantages:
• They use dedicated links so each link can only carry its own data load. So traffic
problem can be avoided.
• It is robust. If any one link get damaged it cannot affect others.
• It gives privacy and security.
• Fault identification and fault isolation are easy.
..contd..
Disadvantages:
• The amount of cabling and the number IO ports required are very large as every device is
connected to each other devices through dedicated links.
• The sheer bulk of wiring is larger then the available space.
• Hardware required to connect each device is highly expensive.
Example:
• A mesh network has 8 devices. Calculate total number of cable links and I/O ports needed.
• Solution:
Number of devices = 8
Number of links = n (n-1) / 2
= 8(8-1)/2
= 28
Number of port/device = n-1
= 8-1 = 7
Star topology
..contd..
• Each device has a dedicated point-to-point link only to a central controller. Star
topology does not allow direct traffic between device.
• The controller acts as an exchange; if one device wants to send data to another, it
sends the data to the controller, which then relays the data to the other connected
device.
• Uses point to point connections.
• Advantages:
• Less expensive than a mesh topology
• Robust
• Makes fault identification and fault isolation easy
• Disadvantages
• If the hub goes down, the whole system goes dead.
• More cabling is required when compared with bus or ring.
Tree Topology
..contd..
• It is a variation of star. Not all devices are connected to a central hub.
Most of the devices are connected to a secondary hub that in turn
connected with central hub.
• The central hub is an active hub. An active hub contains a repeater,
which regenerate the received bit pattern before sending.
• The secondary hub may be active or passive. A passive hub means it
just precedes a physical connection only.
• Advantages:
• Can connect more than star.
• The distance can be increased.
• Can isolate and prioritize communication between different computers.
Bus topology
..contd..
• Multipoint connections. One long cable acts as a backbone to link all the devices in a network.
• Tap – connector, creates a contact with a metallic core.
• Drop line – connection running between the device and the main cable.
• Produces heat during transformation. Limit on the number of taps a bus can support and on the
distance between those taps.
• Advantages:
• Ease of installation
• Uses less cabling than mesh/star topologies
• Example: In a star topology, 4 network devices in the same room require 4 lengths of cable
reaching all the way to the hub
• In a bus this redundancy is eliminated. Only the backbone cable stretches through the entire facility
• Disadvantages:
• Difficult to add new devices
• Break in the bus cable stops all transmission
Ring topology
..contd..
• Uses point to point connections.
• Each device has a dedicated connection with only 2 devices on either side of it.
• A signal is passed along the ring in one direction, from device to device, until reaches
its destination.
• Each device works as a repeater – regenerates and passes them along.
Advantages:
• Easy to install.
• Requires changing only 2 connections to add / delete a new device.
• Easy fault isolation (alarm sent to the n/w operator).
Disadvantages:
• Unidirectional traffic.
• A break in the ring can disable the entire network (to avoid dual ring / switch to close
the break)
A hybrid topology: a star backbone with three bus networks
Network Types
Local Area Network
• Privately owned. Link the devices in a single office, building and campus.
• LAN size is limited to a few kilometers.
• LAN topologies are bus, ring and star.
• They have data rates from 4 to 16 Mbps.
Wide Area Network
• A wide area network (WAN) is also an interconnection of devices capable of communication.
• It provides a long distance transmission of data, voice, image and video information over a large
geographical are like country, continent or even the whole world.
• Types of WAN: Point-to-point WANs, Switched WANs.
Point-to-Point WAN:
• A point-to-point WAN is a network that connects two communicating devices through a
transmission media (cable or air).
..contd..
Switched WAN:
• A switched WAN is a network with more than two ends. It is used in the backbone of global
communication today. It is a combination of several point-to-point WANs that are connected by
switches.
Metropolitan Area Network
• They are designed to extend over an entire city. It may be a single
network or connecting a number of LANs into a large network.
• So the resources are shared between LANs. Example of MAN is,
telephone companies provide a popular MAN service called switched
multi megabit data service (SMDS).
Difference between LAN & MAN
..contd..
• Privately owned. Link the devices in a single office, building and
campus.
• LAN size is limited to a few kilometers.
• LAN topologies are bus, ring and star.
• They have data rates from 4 to 16 Mbps.
• Metropolitan Area Network (MAN)
• They are designed to extend over an entire city. It may be a single network or
connecting a number of LANs into a large network.
• So the resources are shared between LANs. Example of MAN is, telephone
companies provide a popular MAN service called switched multi megabit data
service (SMDS).
• Wide Area Network (WAN)
• It provides a long distance transmission of data, voice, image and video
information over a large geographical are like country, continent or even the
Protocols and Standards
Protocols and Standards
• Protocols:
• In computer networks, communication occurs between entries in
different systems.
• An entity is anything capable of sending or receiving information.
• But two entities cannot communicate each other as sending or
receiving.
• For communication occurs the entities must agree on a protocol.
• A protocol is a set of rules that govern data communication.
• A protocol defines what is communicated how it is communicated,
and when it is communicated.
• The key elements of a protocol are syntax, semantics and timing.
Contd…
• Syntax:
• Syntax refers to the structure or format of the data, means to the order how it is
presented.
• Semantics:
• Semantics refers to the meaning of each section of bits. How is a particular
pattern to be interpreted, and when action is to be taken based on the
interpretation.
• Timing:
• Timing refers to two characteristics. They are,
• 1. When data should be sent
• 2. When data to be received.
Contd…
• Standards:
• A standard provides a model for development of a product, which is going to
develop.
• Standards are essential to create and maintain a product.
• Data communication products are fall into two categories. They are,
• 1. De facto
• 2. De jure
Contd…
1. De facto:
• They are further classified into
• 1. Proprietary
• 2. Non proprietary
1. Proprietary:
• They are originally invented by a commercial organization as a basis for the operation
of its product.
• They are wholly owned by the company, which invented them. They are closed
standards.
2. Nonproprietary:
• Groups or committees that have passed them into public domain develop them. They
are open standards.
2. De jure:
• They have been legislated by an officially recognized body.
Contd…
STANDARDS ORGANIZATION:
• Standards are developed by,
1. Standards creation committee
2. Forums
3. Regularity agencies
1. Standards creation committees:
1. International Standards Organization (ISO)
2. International Telecommunications Union – Telecommunications
Standards Section (ITU-T formally CCITT)
3. The American National Standards Institute (ANSI)
4. The Institute of Electrical and Electronics Engineers (IEEE)
5. The Electronic Industries Association (EIA)
6. Telcordia
Contd…
2. Forums:
1. Frame Relay Forum
2. ATM Forum & ATM consortium
3. Internet Society (ISOC) & Internet Engineering Task Force
(IETF)
3. Regularity Agencies:
1. Federal Communication commission
Uses of Computer Networks
Uses of Computer Networks
• Networks for companies
• Networks for people
• Social issues
Networks for Companies
• Resource sharing
• Branches located in different geographical area
• High reliability
• Multiple CPU’s, if one of the CPU fails other CPUs will
take over the job of the failed one
• Saving money
• Using networks(Client-server model) instead of Super
computers
Networks for Companies
Networks for Companies
• Scalability
• The ability to increase system performance gradually as the
workload grows just by adding more processors
• With the client server model , new clients and new servers
can be added as needed
• Communication medium
• Powerful
• Online document can be prepared by many separated
employees
Companies

• Military
• Banking
• Air traffic control
• Nuclear reactor safety
• Shopping
• Trading
Networks for people
• People started using computer networks instead of
super/mainframe computers
• Access to remote information
• Person – to – person communication
• Interactive entertainment
• Access to remote information
• To manage bank accounts
• To pay bills
• To handle investments
• Home shopping
• Newspapers
• Online digital library
• Web access for arts, business, cooking, government, health,
history, hobbies, recreation, science, sports, travel etc.,
Networks for people
• Person – to – person communication
• Email (audio, video, text )
• Video conferencing (remote school, medical opinion)
• Discussion forums, news groups
• Interactive entertainment
• Video on demand
• Live television
• New film story directions
• Games (multi person real time simulation games)
Social issues
• Social , ethical, and political problems
• Views posted to groups(politics, religion, sex)may be
deeply offensive to some people
• Censor messages
• Computer networks offer the potential for sending
anonymous messages
Network Architecture
Topics
• Layering and protocols
• Encapsulation
• Multiplexing and Demultiplexing
• OSI Architecture
• Internet Architecture
Network Architecture
• A computer network must provide general, cost effective, fair and
robust among a large number of computers.
• It must evolve to accommodate changes in both the underlying
technologies.
• To help to deal this network designers have developed general
blueprints called network architecture that guide the design and
implementation of networks.
Layering and Protocols
Layering and Protocols
• To reduce the complexity of getting all the functions maintained by one
a new technique called layering technology was introduced.
• In this, the architecture contains several layers and each layer is
responsible for certain functions.
• The general idea is that the services offered by underlying hardware,
and then add a sequence of layers, each providing a higher level of
service.
• The services provided at the higher layers are implemented in terms of
the services provided by the lower layers.
• A simple network has two layers of abstraction sandwiched between
the application program and the underlying hardware.
Contd…

Fig. Example of a layered network system


Contd…
• The layer immediately above the hardware in this case might provide
host to host connectivity, and the layer above it builds on the available
host to host communication service and provides support for process to
process channels.
• Features of layering are:
• 1. It decomposes the problem of building a network into more manageable
components.
• 2. It provides a more modular design. Addition of new services and
modifications are easy to implement.
Contd…

Fig. Layered system with alternative abstractions available


at network layer
Contd…
• In process to process channels, they have two types of channels. One for
request\reply service and the other for message stream service.
• A protocol provides a communication service that higher level objects use to
exchange message.
• Each protocol defines two different interfaces.
• First it defines a service interface to other objects on the same system that
want to use its communication services.
• This interface defines the operations that local objects can perform on the
protocol.
• Second a protocol defines a peer interface to its counterpart on another
machine.
• It defines the form and meaning of message exchanged between protocol
peers to implement the communication service.
Contd…

Fig. Service and Peer interfaces


Contd…
• There are potentially multiple protocols at any given level, each
providing a different communication service.
• It is known as protocol graph that make up a system
• The nodes of the graph correspond to protocols , and the edges
represent a depends – on relation.
• RRP – Request Reply Protocol
• MSP – Message Stream Protocol
• HHP – Host to Host Protocol
Contd…

Fig. Example of a protocol graph for the hypothetical layered system


Contd…
• In the above example file access on host1 wants to send a message to
host2 it uses the RRP communication service.
• RRP invokes the services of HHP which in turn transmits the message
to its peer on the other machine.
• Once the message arrived protocol HHP on host2 passes the message
to RRP and send the message to file application.
• In this case file application employ the services of the protocol stack
RRP/HHP.
Contd…
• Protocol specification
• Specification expressed using a combination of prose , pseudocode , state
transition diagrams , pictures of packet formats , and other abstract notations.
Contd…
Host1 Host 2
Application Application
Program Program
Data
Data

RRP RRP

RRP Data RRP Data

HHP HHP

HHP RRP Data

Fig. High level messages are encapsulated inside of low level messages
Contd…
• Encapsulation
• Header
• It is a small data structure from a few bytes to a few dozen bytes.
• It is used among peers to communicate with each other.
• Headers are usually attached to the front of message.
• Trailer
• Peer to peer control information is sent at the end of the message is called trailer.
• The exact format for the header attached by RRP is defined by the protocol
specification.
Contd…
• The rest of the message that is the data being transmitted on behalf of
the application is called the message’s body or payload.
• The application’s data is encapsulated in the new message created by
protocol RRP.
• The process of encapsulation is then repeated at each level of the
protocol graph.
Contd…
• For example :
• HHP encapsulates RRP’s message by attaching a header of its own.
• Assume HHP sends messages to its peer it is processed in opposite
order.
• HHP first strips its header off the front of the message , interprets it and
passes the body of the message to RRP , which removes the header
that’s its peer attached and do the actions indicated in the header and
passes the body of the message to the application program.
ISO/OSI MODEL
ISO / OSI MODEL
• ISO refers International Standards Organization was established in
1947.
• It is a multinational body dedicated to worldwide agreement on
international standards.
• OSI refers to Open System Interconnection that covers all aspects of
network communication.
• It is a standard of ISO.
• Here open system is a model that allows any two different systems to
communicate regardless of their underlying architecture.
• Mainly, it is not a protocol it is just a model.
OSI MODEL
• The open system interconnection model is a layered framework.
• It has seven separate but interrelated layers. Each layer having unique
responsibilities.
ARCHITECTURE
• The architecture of OSI model is a layered architecture.
• The seven layers are,
1. Physical layer
2. Data link layer
3. Network layer
4. Transport layer
5. Session layer
6. Presentation layer
7. Application layer
Figure Seven layers of the OSI model

Please Do Not Touch Steve’s Pet Alligator


Or
Please Do Not Tell Sales Person Anything
Figure: The interaction between layers in the OSI model
Contd…
• When the device is connected to some other device the layer of one device
communicates with the corresponding layer of another device. This is
known as peer to peer process.
• Each layer in the sender adds its own information to the message. This
information is known as header and trailers.
• When the information added at the beginning of the data is known as
header.
• Whereas added at the end then it called as trailer. Headers added at layers 2,
3, 4, 5, 6. Trailer added at layer 2.
• Each layer is connected with the next layer by using interfaces.
• Each interface defines what information and services a layer must provide
for the layer above it.
ORGANIZATION OF LAYERS
The seven layers are arranged by three sub groups.
1. Network Support Layers
2. User Support Layers
3. Intermediate Layer
• Network Support Layers:
• Physical, Data link and Network layers come under the group. They deal with the physical
aspects of the data such as electrical specifications, physical connections, physical addressing,
and transport timing and reliability.
• User Support Layers:
• Session, Presentation and Application layers comes under the group. They deal with the
interoperability between the software systems.
• Intermediate Layer
• The transport layer is the intermediate layer between the network support and the user support
layers.
Figure An exchange using the OSI model
Physical Layer
The physical layer is responsible for movements of
individual bits from one hop (node) to the next.

•Functions are
• Physical characteristics of interfaces and medium
• Representation of bits
• Data rate
• Synchronization of bits
• Line configuration
• Physical topology
• Transmission mode
Figure: Physical layer
Functions
1. Physical Characteristics Of Interfaces and Media:
• It defines the electrical and mechanical characteristics of the interface and the
media.
• It defines the types of transmission medium
2. Representation of Bits
• To transmit the stream of bits they must be encoded into signal.
• It defines the type of encoding whether electrical or optical.
3. Data Rate
• It defines the transmission rate i.e. the number of bits sent per second.
4. Synchronization of Bits
• The sender and receiver must be synchronized at bit level.
Contd…

5. Line Configuration
• It defines the type of connection between the devices.
Two types of connection are,
1. point to point
2. multipoint
6. Physical Topology
• It defines how devices are connected to make a network.
Five topologies are,
1. mesh
2. star
3. tree
4. bus
5. ring
Contd…
7. Transmission Mode
• It defines the direction of transmission between devices.
• Three types of transmission are,
1. simplex
2. half duplex
3. Full Duplex
Data Link Layer

The data link layer is responsible for moving


frames from one hop (node) to the next.

Functions are
• Framing
• Physical addressing
• Flow control
• Error control
• Access control
Figure: Data link layer
Data Link Layer
The responsibilities of Data link layer are,
1. Framing
• It divides the stream of bits received from network layer into manageable data
units called frames.
2. Physical Addressing
• It adds a header that defines the physical address of the sender and the
receiver.
• If the sender and the receiver are in different networks, then the receiver
address is the address of the device which connects the two networks.
Contd…
3. Flow Control
• It imposes a flow control mechanism used to ensure the data rate at the sender and
the receiver should be same.
4. Error Control
• To improve the reliability the Data link layer adds a trailer which contains the error
control mechanism like CRC, Checksum etc.
5. Access Control
• When two or more devices connected at the same link, then the Data link layer
used to determine which device has control over the link at any given time.
Figure: Hop-to-hop delivery
Network Layer

The network layer is responsible for the


delivery of individual packets from
the source host to the destination host.

•Logical addressing
•Routing
Figure 2.8 Network layer
Network Layer
The responsibilities are,
1. Logical Addressing
• If a packet passes the network boundary that is when the sender and receiver
are places in different network then the network layer adds a header that
defines the logical address of the devices.
2. Routing
• When more than one networks connected and to form an internetwork, the
connecting devices route the packet to its final destination.
• Network layer provides this mechanism.
Figure 2.9: Source-to-destination delivery
Transport Layer
The transport layer is responsible for the delivery
of a message from one process to another.
•The Transport layer is responsible for the end to end delivery
of the entire message.
•It ensures that the whole message arrives in order.
• It ensures the error control and flow control at source to
destination level.
•Functions are
• Service-point addressing
• Segmentation and reassembly
• Connection control
• Flow control
• Error control
Figure: Transport layer
Transport Layer
The responsibilities are,
1. Service point Addressing
• A single computer can often run several programs at the same time.
• The transport layer gets the entire message to the correct process on that
computer.
• It adds a header that defines the port address which used to identify the
exact process on the receiver.
2. Segmentation and Reassembly
• A message is divided into manageable units called as segments.
• Each segment is reassembled after received that information at the
receiver end.
• To make this efficient each segment contains a sequence number.
Contd…
3. Connection Control
• The transport layer creates a connection between the two end ports.
• It involves three steps. They are,
• 1. connection establishment
• 2. data transmission
• 3. connection discard
4. Flow Control
• Flow control is performed at end to end level
5. Error Control
• Error control is performed at end to end level.
Figure: Reliable process-to-process delivery of a message
Session Layer
The session layer is responsible for dialog
control and synchronization.
It acts as a dialog controller
It establishes, maintains and synchronizes the
interaction between the communication devices.

•Functions are
• Dialog control
• Synchronization
Figure 2.12 Session layer
Session Layer
The responsibilities are,
1. Dialog Control
• The session layer allows two systems to enter into a dialog.
• It allows the communication between the devices.
2. Synchronization
• It adds a synchronization points into a stream of bits.
Presentation Layer

The presentation layer is responsible for translation,


compression, and encryption.

•Translation
•Encryption
•Compression
Figure 2.13 Presentation layer
Presentation Layer
The responsibilities are,
1. Translation
• Different systems use different encoding systems.
• The presentation layer is responsible for interoperability between different
systems.
• The presentation layer at the sender side translates the information from the
sender dependent format to a common format.
• Likewise, at the receiver side presentation layer translate the information from
common format to receiver dependent format.
Contd…
2. Encryption
• To ensure security encryption/decryption is used Encryption means transforms
the original information to another form
• Decryption means retrieve the original information from the encrypted data
3. Compression
• It used to reduce the number of bits to be transmitted.
Application Layer

The application layer is responsible for


providing services to the user.

•Network virtual terminal


•File transfer, access, and management
•Mail services
•Directory services
Figure 2.14 Application layer
Application Layer
The responsibilities are,
1. Network Virtual Terminal
• It is a software version of a physical terminal and allows a user to log on to a
remote host.
2. File Transfer, Access, and Management
• It allows a user to access files in a remote computer, retrieve files, and manage
or control files in a remote computer.
3. Mail Services
• It provides the basis for e-mail forwarding and storage.
4. Directory Services
• It provides distributed database sources and access for global information
about various objects and services.
Figure 2.15 Summary of layers
INTERNET ARCHITECTURE
Introduction
• The internet architecture evolved out of experiences with an earlier
packet switched network called the ARPANET.
• Both the Internet and the ARPANET were
funded by the Advanced Research Projects Agency (ARPA).
• The Internet and ARPANET were around before the OSI architecture,
and the experience gained from building them was a major influence
on the OSI reference model.
• Instead of having seven layers, a four layer model is often used in
Internet.
Four Layer Internet Architecture
Contd…
• At the lowest level are a wide variety of network protocols, denoted NET1, NET2
and so on.
• The second layer consists of a single protocol the Internet Protocol IP.
• It supports the interconnection of multiple networking technologies into a single,
logical internetwork.
• The third layer contains two main protocols the Transmission Control Protocol
(TCP) and User Datagram Protocol (UDP).
• TCP provides a reliable byte stream channel, and UDP provides unreliable
datagram delivery channel.
• They are called as end to end protocol they can also be referred as transport
protocols.
• Running above the transport layer, a range of application protocols such as FTP,
TFTP, Telnet, and SMTP that enable the interoperation of popular applications.
Internet Protocol Graph
Contd…
• There is a similarly large number of different implementations of web servers.
• The Internet’s application layer is considered to be at layer 7, its transport layer is
layer 4, the IP (internetworking or just network) layer is layer 3, and the link or
subnet layer below IP is layer 2.
• The application is free to bypass the defined transport layers and to directly use IP
or one of the underlying networks.
• It defines a common method for exchanging packets among a wide
collection of networks.
• Above IP there can be arbitrarily many transport protocols, each offering a
different channel abstraction to application programs.
• Thus, the issue of delivering messages from host to host is completely separated
from the issue of providing a useful process-to-process communication service.
Contd…
• A final attribute of the Internet architecture (or more accurately, of the IETF
culture) is that in order for a new protocol to be officially included in the
architecture, there must be both a protocol specification and at least one (and
preferably two) representative implementations of the specification.
• The existence of working implementations is required for standards
to be adopted by the IETF.
• This cultural assumption of the design community helps to ensure that the
architecture’s protocols can be efficiently implemented.
Contd…
• Defined by IETF
• Three main features
• Does not imply strict layering. The application is free to bypass the defined
transport layers and to directly use IP or other underlying networks
• An hour-glass shape – wide at the top, narrow in the middle and wide at the
bottom. IP serves as the focal point for the architecture
• In order for a new protocol to be officially included in the architecture, there
needs to be both a protocol specification and at least one (and preferably two)
representative implementations of the specification
Implementing Network Software
Application Program Interface

• API (application program interface) is a set of routines, protocols,


and tools for building software applications. The API specifies how
software components should interact and APIs are used when
programming graphical user interface (GUI) components.
• Interface exported by the network.
• The interface is called the network Application Programming Interface
(API).
• Each protocol provides a certain set of services, and the API provides a
syntax by which those services can be invoked in this particular OS
Socket

• What is a socket?
– The point where a local application process attaches to the network
– An interface between an application and the network
– An application creates the socket
• The interface defines operations for
– Creating a socket
– Attaching a socket to the network
– Sending and receiving messages through the socket
– Closing the socket
Socket

• Socket Family
– PF_INET denotes the Internet family
– PF_UNIX denotes the Unix pipe facility
– PF_PACKET denotes direct access to the network interface (i.e., it bypasses
the TCP/IP protocol stack)

• Socket Type
– SOCK_STREAM is used to denote a byte stream
– SOCK_DGRAM is an alternative that denotes a message oriented service,
such as that provided by UDP
Creating a Socket
int socket(int domain, int type, int protocol)
int sockfd = socket(address_family, type, protocol);

• The socket number returned is the socket descriptor for the newly created socket

• int sockfd = socket (PF_INET, SOCK_STREAM, 0);


• int sockfd = socket (PF_INET, SOCK_DGRAM, 0);

The combination of PF_INET and SOCK_STREAM implies TCP


Client-Serve Model with TCP
Client
– Application performs active open
– It says who it wants to communicate with

Client invokes
int connect (int socket, struct sockaddr *address,
int addr_len)

Connect
– Does not return until TCP has successfully established a connection at which
application is free to begin sending data
– Address contains remote machine’s address
Client-Serve Model with TCP

Server
– Passive open
– Prepares to accept connection, does not actually establish a connection

Server invokes
int bind (int socket, struct sockaddr *address,
int addr_len)
int listen (int socket, int backlog)
int accept (int socket, struct sockaddr *address,
int *addr_len)
Client-Serve Model with TCP

Bind
– Binds the newly created socket to the specified address i.e. the network
address of the local participant (the server)
– Address is a data structure which combines IP and port

Listen
– Defines how many connections can be pending on the specified socket
Client-Serve Model with TCP
Accept
• Carries out the passive open
• Blocking operation
• Does not return until a remote participant has established a connection
• When it does, it returns a new socket that corresponds to the new
established connection and the address argument contains the remote
participant’s address
Client-Serve Model with TCP
Once a connection is established, the application process invokes two
operation

int send (int socket, char *msg, int msg_len,


int flags)

int recv (int socket, char *buff, int buff_len,


int flags)
Server
Client
Performance
Performance
The effectiveness of computations distributed over the network often depends
directly on the efficiency with which the network delivers the computation’s data.
It is therefore important to understand the various factors that impact network
performance.

i. Bandwidth and Latency


ii. Delay × Bandwidth Product
iii. High-Speed Networks
iv. Application Performance Needs
Bandwidth and Latency

Bandwidth - (also called throughput)


latency - (also called delay).

Bandwidth: The bandwidth of a network is given by the number of bits that can
be transmitted over the network in a certain period of time.
How long it takes to transmit each bit of data.
For example, a network might have a bandwidth of 10 million bits/second
(Mbps), meaning that it is able to deliver 10 million bits every second.
Contd…
At the physical level, bandwidth is constantly improving, with no end in sight.
Intuitively, if you think of a second of time as a distance you could measure with
a ruler and bandwidth as how many bits fit in that distance, then you can think of
each bit as a pulse of some width.
Contd…
Bandwidth and throughput are two of the most confusing terms used in net-
working.
Bandwidth is literally a measure of the width of a frequency band.
For example, a voice-grade telephone line supports a frequency band ranging
from 300 to 3300 Hz; it is said to have a bandwidth of 3300 Hz−300 Hz = 3000
Hz.
When we talk about the bandwidth of a communication link, we normally refer to
the number of bits per second that can be transmitted on the link. This is also
sometimes called the data rate.
We tend to use the word throughput to refer to the measured performance of a
system.
For example, bandwidth of 10 Mbps might achieve a throughput of only 2
Mbps.
Contd…
The second performance metric, latency, corresponds to how long it takes a
message to travel from one end of a network to the other.
Latency is measured strictly in terms of time.
There are many situations in which it is more important to know how long it takes
to send a message from one end of a network to the other and back, rather than the
one-way latency. We call this the round-trip time (RTT) of the network.
latency has three components,
Propagation delay
Amount of time it takes to transmit a unit of data
Queuing delays
Contd…
Propagation delay - This delay occurs because nothing, including a bit on a wire,
can travel faster than the speed of light.
Amount of time it takes to transmit a unit of data. This is a function of the network
bandwidth and the size of the packet in which the data is carried.
Queuing delays inside the network, since packet switches generally need to store
packets for some tie before forwarding them on an outbound link.
Latency = Propagation + Transmit + Queue
Propagation = Distance/ SpeedOfLight
Transmit = Size/Bandwidth
Bandwidth and latency combine to define the performance characteristics of a given
link or channel. Their relative importance, however, depends on the application.
One bit transmission => propagation is important
Large bytes transmission => bandwidth is important
Delay X Bandwidth Product
 Product of these two metrics, often called the delay ×bandwidth product.
Consider the channel between a pair of processes as a hollow pipe, as shown
below,

Latency corresponds to the length of the pipe and the bandwidth gives the
diameter of the pipe.
 delay × bandwidth product gives the volume of the pipe (i.e.) maximum
number of bits that could be in transit through the pipe at any given instant.
Contd…
For example, a transcontinental channel with a one-way latency of 50 ms and a
bandwidth of 45 Mbps is able to hold
50×10−3 s×45×106 bits/s
= 2.25×106 bits
The delay × bandwidth product is important to know when constructing high-
performance networks, because it corresponds to how many bits the sender must
transmit before the first bit arrives at the receiver.
If the sender is expecting the receiver to somehow signal that bits are starting to
arrive, and it takes another channel latency for this signal to propagate back to the
sender, then the sender can send up one RTT × bandwidth worth of data before
hearing from the receiver that all is well.
RTT is simply refer to as the delay ×bandwidth product, without explicitly
saying that “delay” is the RTT
High Speed Networks
There is eternal optimism that network bandwidth will continue to improve.
“High Speed” does not mean that latency improves at the same rate as bandwidth;
the transcontinental RTT of a 1-Gbps link is the same 100 ms as it is for a 1-Mbps
link.
Ever-increasing bandwidth in the face of fixed latency.
Contd………
• The effective end-to-end throughput that can be achieved over a network is given
by the simple relationship

Throughput = TransferSize/TransferTime

where TransferTime includes not only the elements of one-way Latency identified
earlier in this section, but also any additional time spent requesting or setting up the
transfer. Generally, we represent this relationship as

TransferTime = RTT+1/Bandwidth×TransferSize

We use RTT in this calculation to account for a request message being sent
across the network and the data being sent back.
Contd……..
• It transferring a larger amount of data will help improve the effective
throughput, where in the limit an infinitely large transfer size will
cause the effective throughput to approach the network bandwidth.

• The TransferTime includes both the transmit time for 1 MB (1/1


Gbps×1 MB = 8 ms) and the 100-ms RTT, for a total transfer time of
108 ms. This means that the effective throughput will be

1 MB/108 ms = 74.1 Mbps


Application Performance Needs
Application Performance Needs
• some applications are able to state an upper limit on how much
bandwidth they need. Video applications are a prime example. Suppose
one wants to stream a video that is one quarter the size of a standard
TV screen; that is, it has a resolution of 352 by 240 pixels.
• If each pixel is represented by 24 bits of information, as would be the
case for 24-bit color, then the size of each frame would be
(352×240×24)/8 = 247.5 KB
• If the application needs to support a frame rate of 30 frames per
second, then it might request a throughput rate of 75 Mbps. The ability
of the network to provide more bandwidth is of no interest to such an
application because it has only so much data to transmit in a given
period of time.
Contd……….
• Each frame can also be compressed because not all the detail in a
picture is readily perceived by a human eye.
• The compressed video does not flow at a constant rate, but varies with
time according to factors such as the amount of action and detail in the
picture and the compression algorithm being used.
• The key issue is the time interval over which the average is computed.
• If it transmits 1 megabit in a 1-second interval and 3 megabits in the
following 1-second interval, then over the 2-second interval it is
transmitting at an average rate of 2 Mbps;
Contd……..
Contd………
• A burst might be described by some peak rate that is maintained for
some period of time.
• Alternatively, it could be described as the number of bytes that can be
sent at the peak rate before reverting to the average rate or some lower
rate.
• If this peak rate is higher than the available channel capacity, then the
excess data will have to be buffered somewhere, to be transmitted later.
• In the case of delay, it sometimes doesn’t matter so much whether the
one-way latency of the network is 100 ms or 500 ms as how much the
latency varies from packet to packet. The variation in latency is called
jitter.
Contd………..
• If the packets arrive at the destination spaced out exactly 33 ms apart,
then we can deduce that the delay experienced by each packet in the
network was exactly the same.
• If the spacing between when packets arrive at the destination—
sometimes called the inter-packet gap—is variable, however, then the
delay experienced by the sequence of packets must have also been
variable, and the network is said to have introduced jitter into the
packet stream.
• To understand the relevance of jitter, suppose that the packets being
transmitted over the network contain video frames, and in order to
display these frames on the screen the receiver needs to receive a new
one every 33 ms.
Contd………..
• If a frame arrives early, then it can simply be saved by the receiver until it is
time to display it.
• if a frame arrives late, then the receiver will not have the frame it needs in time
to update the screen, and the video quality will suffer; it will not be smooth.
Note that it is not necessary to eliminate jitter, only to know how bad it is.
• The reason for this is that if the receiver knows the upper and lower bounds
on the latency that a packet can experience, it can delay the time at which it
starts playing back the video (i.e., displays the first frame) long enough to
ensure that in the future it will always have a frame to display when it needs it.
• The receiver delays the frame, effectively smoothing out the jitter, by storing it
in a buffer.
Physical links
A transmission media define as anything that can carry information from a source to a
destination.
Figure Transmission medium and physical layer

Figure Classes of transmission media


Basics

• Types of connections of computers into networks: Physical versus


Wireless connections
• The first type: The Physical Connection.
• Physically connect computers together.
• Use of wires or optical cables.
• The connections are called network links or physical links.
• Three most common physical links:
• Twisted pair
• Coaxial cable
• Fiber-optic cable
Physical links (contd.)
• Twisted pair
• A twisted pair consists of two conductors (normally copper), each with its own plastic
insulation, twisted together.

• One of the wires is used to carry signals to the receiver, and the other is used only as a
ground reference.
• In addition to the signal sent by the sender on one of the wires, interference (noise) and
crosstalk may affect both wires and create unwanted signals.
• If the two wires are parallel, the effect of these unwanted signals is not the same in both
wires because they are at different locations relative to the noise or crosstalk sources .
• This results in a difference at the receiver.
• By twisting the pairs, a balance is maintained.
• For example, suppose in one twist, one wire is closer to the noise source and the other is
farther; in the next twist, the reverse is true.
• Telephone company uses twisted-pair copper wires to link telephones.
Physical links (contd.)
• The most common twisted-pair cable used in communications is
referred to as unshielded twisted-pair (UTP).
• IBM has also produced a version of twisted-pair cable for its use
called shielded twisted-pair (STP).
• STP cable has a metal foil or braided- mesh covering that
encases each pair of insulated conductors.
• Although metal casing improves the quality of cable by
preventing the penetration of noise or crosstalk, it is bulkier and
more expensive.
• Figure shows the difference between UTP and STP.
Physical links (contd.)
Table 7.1 Categories of unshielded twisted-pair cables
Contd…
• Performance :
• One way to measure the performance of twisted-pair cable is to
compare attenuation versus frequency and distance.
• A twisted-pair cable can pass a wide range of frequencies.
• However, Figure shows that with increasing frequency, the
attenuation, measured in decibels per kilometer (dB/km),
sharply increases with frequencies above 100 kHz.
• Note that gauge is a measure of the thickness of the wire.
Figure: UTP performance
Contd…

• Applications
• Twisted-pair cables are used in telephone lines to provide
voice and data channels.
• The local loop--the line that connects subscribers to the
central telephone office---commonly consists of unshielded
twisted-pair cables.
• The DSL lines that are used by the telephone companies to
provide high-data-rate connections also use the high-
bandwidth capability of unshielded twisted-pair cables.
• Local-area networks, such as 10Base-T and 100Base-T, also
use twisted-pair cables.
Coaxial cable
• Coaxial cable (or coax) carries signals of higher frequency ranges than
those in twisted- pair cable, in part because the two media are constructed
quite differently.
• Instead of having two wires, coax has a central core conductor of solid or
stranded wire (usually copper) enclosed in an insulating sheath, which is, in
turn, encased in an outer conductor of metal foil, braid, or a combination of
the two.
• The outer metallic wrapping serves both as a shield against noise and as the
second conductor, which completes the circuit. This outer conductor is also
enclosed in an insulating sheath, and the whole cable is protected by a
plastic cover .
Contd…

Coaxial cables are categorized by their radio government (RG) ratings.


Two kinds:
1. Thicknet(RG-11): it connect 100 devices with range 500 m (more expensive ).
2. Thinnet (RG-58): it connect 30 devices within 185 m (cheaper).
To connect coaxial cable to device, we need (BNC)(Bayonet Neill–
Concelman).Carries signals of higher frequency ranges than twisted-pair cable.

Figure BNC connectors

Figure Coaxial cable performance


Fiber optic cable
• A fiber-optic cable is made of glass or plastic and
transmits signals in the form of light.
Figure Bending of light ray
Contd…
• If the angle of incidence I (the angle the ray makes with the
line perpendicular to the interface between the two
substances) is less than the critical angle, the ray refracts and
moves closer to the surface.
• If the angle of incidence is equal to the critical angle, the light
bends along the interface.
• If the angle is greater than the critical angle, the ray reflects
(makes a turn) and travels again in the denser substance.
• Note that the critical angle is a property of the substance, and
its value differs from one substance to another.
Contd…
• Optical fibers use reflection to guide light through a
channel.
• A glass or plastic core is surrounded by a cladding of less
dense glass or plastic.
• The difference in density of the two materials must be such
that a beam of light moving through the core is reflected
off the cladding instead of being refracted into it.
Propagation modes
1. Single-mode fiber
• Carries light pulses along single path.
2. Multimode fiber
• Many pulses of light travel at different angles
Contd…
Figure: Modes
Contd…
• In multimode step-index fiber, the density of the core remains
constant from the center to the edges.
• A beam of light moves through this constant density in a
straight line until it reaches the interface of the core and the
cladding.
• At the interface, there is an abrupt change due to a lower
density; this alters the angle of the beam's motion.
• The term step index refers to the suddenness of this change,
which contributes to the distortion of the signal as it passes
through the fiber.
Contd…
• In multimode graded-index fiber, decreases this distortion of
the signal through the cable.
• The word index here refers to the index of refraction.
• As we saw above, the index of refraction is related to density.
• A graded-index fiber, therefore, is one with varying densities.
Density is highest at the center of the core and decreases
gradually to its lowest at the edge.
• Figure shows the impact of this variable density on the
propagation of light beams.
Contd…

Table: Fiber types


Figure: Fiber construction

Figure: Fiber-optic cable connectors


Contd…
• The subscriber channel (SC) connector is used for cable TV.
• It uses a push/pull locking system.
• The straight-tip (ST) connector is used for connecting cable to
networking devices.
• It uses a bayonet locking system and is more reliable than SC.
• MT-RJ is a connector that is the same size as RJ45.
Contd…
• Performance:
• The plot of attenuation versus wavelength in Figure shows a
very interesting phenomenon in fiber-optic cable.
• Attenuation is flatter than in the case of twisted-pair cable and
coaxial cable.
• The performance is such that we need fewer (actually 10 times
less) repeaters when we use fiber-optic cable.
• Applications: Fiber-optic cable is often found in backbone
networks because its wide bandwidth is cost-effective.
• Today, with wavelength-division multiplexing (WDM), we can
transfer data at a rate of 1600 Gbps.
Contd…

Figure: Optical fiber performance


Contd…
• Advantages
• Fiber-optic cable has several advantages over metallic cable
(twisted- pair or coaxial).
• 1. Higher bandwidth.
• 2. Less signal attenuation.
• 3. Immunity to electromagnetic interference.
• 4.Resistance to corrosive materials.
• 5. Light weight.
• 6. Greater immunity to tapping.
Contd…
• Disadvantages
• There are some disadvantages in the use of optical fiber.
• 1. Installation and maintenance. Fiber-optic cable is a relatively
new technology. Its installation and maintenance require expertise
that is not yet available everywhere.
• 2.Unidirectional light propagation. Propagation of light is
unidirectional. If we need bidirectional communication, two
fibers are needed.
• 3.Cost. The cable and the interfaces are relatively more expensive
than those of other guided media. If the demand for bandwidth is
not high, often the use of optical fiber cannot be justified.
Categories of 10- mbps, Ethernet

172
UNGUIDED MEDIA: WIRELESS
Unguided media transport electromagnetic waves without using a physical conductor.
This type of communication is often referred to as wireless communication.

Figure Electromagnetic spectrum for wireless communication

Radio, satellite microwave,, Bluetooth, and infrared light are all different forms of
electromagnetic waves that are used to transmit data
unguided signal can travel from the source to destination in several ways:
1.Ground Propagation:
• Radio waves travel through the lowest portion of the atmosphere, hugging the earth.
• The low frequency signal follow the curvature of the planet.
• Distance depends on the amount of the power.
2.Sky Propagation:
 Higher frequency radio radiate upward into the ionosphere where they are reflected back to
the earth.
 Sky propagation allow for greater distance with lower power output.
3.line-of-sight Propagation: Very high frequency signals are transmitted in straight lines
directly from antenna to antenna.
• The section of the electromagnetic spectrum defined as
radio waves and microwaves is divided into eight
ranges, called bands, each regulated by government
authorities.
• These bands are rated from very low frequency(VLF)
to extremely high frequency (EHF).
• Table lists these bands, their ranges, propagation
methods, and some applications.
Table: Bands
Contd…

Figure: Wireless transmission waves


Contd…
• Radio Waves
• electromagnetic waves ranging in frequencies between 3 kHz
and 1 GHz are normally called radio waves;
• waves ranging in frequencies between 1 and 300 GHz are
called microwaves.
• However, the behavior of the waves, rather than the
frequencies, is a better criterion for classification.
Contd…
• Radio waves, for the most part, are omni directional.
• When an antenna transmits radio waves, they are propagated
in all directions.
• This means that the sending and receiving antennas do not
have to be aligned.
• A sending antenna sends waves that can be received by any
receiving antenna.
• The omni directional property has a disadvantage, too.
• The radio waves transmitted by one antenna are susceptible
to interference by another antenna that may send signals
using the same frequency or band.
Contd…
 Between 3 KHz – 1 GHz.
 Radio waves use omni directional antenna.
 Radio waves used for multicast communication,
such as radio and television.
 Sky Propagation. This makes radio waves a good
candidate for long-distance broadcasting such as AM
radio.
Figure : Omnidirectional antenna
Contd…
• The following describes some characteristics of microwave
propagation:
• 1. Microwave propagation is line-of-sight.
• Since the towers with the mounted antennas need to be in
direct sight of each other, towers that are far apart need to be
very tall.
• The curvature of the earth as well as other blocking obstacles
do not allow two short towers to communicate by using
microwaves. Repeaters are often needed for long distance
communication.
Contd…
• Very high-frequency microwaves cannot penetrate walls. This
characteristic can be a disadvantage if receivers are inside
buildings.
• The microwave band is relatively wide, almost 299 GHz.
Therefore wider subbands can be assigned, and a high data
rate is possible
• Use of certain portions of the band requires permission from
authorities.
Contd…
• Unidirectional Antenna Microwaves need unidirectional antennas that send out
signals in one direction. Two types of antennas are used for microwave
communications: the parabolic dish and the horn.
• A parabolic dish antenna is based on the geometry of a parabola: Every line
parallel to the line of symmetry (line of sight) reflects off the curve at angles such
that all the lines intersect in a common point called the focus.
• The parabolic dish works as a funnel, catching a wide range of waves and
directing them to a common point.
• In this way, more of the signal is recovered than would be possible with a single-
point receiver.
• Outgoing transmissions are broadcast through a horn aimed at the dish. The
microwaves hit the dish and are deflected outward in a reversal of the receipt path.
Contd..
• A horn antenna looks like a gigantic scoop. Outgoing
transmissions are broadcast up a stem (resembling a handle)
and deflected outward in a series of narrow parallel beams
by the curved head.
• Received transmissions are collected by the scooped shape
of the horn, in a manner similar to the parabolic dish, and are
deflected down into the stem.
Figure: Unidirectional antennas

Microwaves are used for unicast communication such as cellular telephones,


satellite networks, and wireless LANs.
Physical links (contd.)
• Second type of connections of computers into networks: Wireless
connections
• The link is made using electromagnetic energy that goes through space instead
of along wires or cables.
• Three types of wireless communications commonly used in networking:
• Infrared
• Radio frequency
• Microwave
Physical links (contd.)
• Infrared
• Commonly used in TV and VCR remote controls.
• Use infrared frequencies of electromagnetic
radiation that behave much like visible light.
• Must be in the line of sight.
• Often used to connect
keyboards, mice,
and printers.
Physical links (contd.)
• Radio frequency
• Uses radio frequencies.
• Function even though line of sight is interrupted.
• Not commonly used because of the possible
interference from other sources of electromagnetic
radiation such as old electric drills and furnace
motors.
Physical links (contd.)
• Microwave
• Often used to
communicate with distant
locations.
• Must be line of sight.
• Satellite communications
use microwaves.
Physical links (contd.)
• Properties of Transmission
Five basic properties of both the physical and wireless links:
1. Type of signal communicated (analog or digital).
2. The speed at which the signal is transmitted (how fast the data travels).
3. The type of data movement allowed on the channel (one-way, two-way taking
turns, two-way simultaneously).
4. The method used to transport the data (asynchronous or synchronous
transmission).
5. Single channel (baseband) and multichannel (broadband) transmission.
Physical links (contd.)
1. Type of signal communicated (analog or digital).
• Analog: Those signals that vary with smooth continuous changes.
• A continuously changing signal similar to that found on the speaker wires of a high-
fidelity stereo system.
• Digital: Those signals that vary in steps or jumps from value to value. They are
usually in the form of pulses of electrical energy (represent 0s or 1s).
Physical links (contd.)
2. The speed at which the signal is transmitted (how fast the data
travels).
• In digital systems: Speed is measured in...
• Bits per second (bps).
• The number of bits (0’s and 1’s) that travel down the channel per second.
• Baud rate
• The number of bits that travel down the channel in a given interval.
• The number is given in signal changes per second, not necessarily bits per second.
Physical links (contd.)
• MODEM - MOdulator
DEModulator
• Outgoing: Converts binary data
from computer (digital) into
telephone compatible signals
(analog).
• Incoming: Converts telephone
signal (analog) into binary data
for the computer (digital).
• Can be an external or internal
device (usually a “card”).
Physical links (contd.)
• Speed of Signal: Sample bps and baud rate speeds.
300 bps (=300 baud) Painfully slow to the college-level reader
1200 bps (=1200 baud) Good reader can keep up
2400 bps (=2400 baud) A speed reader would get the general idea
9600 bps (=9600 baud) Impossible to read
14.4 K bps (not measured in baud) 14,400 bps - 10 to 20 sec. wait for graphics
28.8 K bps Minimum desired for WWW
(5 to 10 sec. wait for graphics)
56 K bps Efficient speed for WWW.

These speeds are restricted to the maximum speed of the modem at the
other end of the connection.
Physical links (contd.)
3. The type of data movement allowed on the channel.
• Simplex transmission - One way transmission.
• Half-duplex transmission - Flows only one way at a time.
• Full-duplex transmission - Two-way transmission at the
same time.
Physical links (contd.)
4.The method used to transport the data.
• Two types of data transmission, each requiring a different modem.
• Asynchronous transmission -
• Information is sent byte by byte.
• Cheaper and more commonly used.
• Synchronous transmission -
• Data is sent in large blocks rather than in small pieces.
• Preceded by special information, concerning error detection and block size.
• These modems are expensive but very fast.
Physical links (contd.)
5. Single channel versus multichannel transmission
• Channel - A path of a signal.
• Single channel - Capable of only sending/receiving one signal at a time.
• Phone line: Single line = single phone call at a time.
• Multichannel - Capable of more than one channel at a time.
• Fiber-optic cable, microwaves, Satellite transmissions.
Physical links (contd.)
• How is it possible to measure the capacity of communications links?
• Bandwidth: Digital
• Number of bits per second (bps) that can be sent over a link.
• The wider the bandwidth, the more diverse kinds of information can be sent.
• Simplest is voice, most sophisticated is moving videos.
• Bandwidth: Analog
• The difference between the highest and lowest frequencies that can be sent over an analog link (like
phone lines).
• Measurement is given in hertz (Hz).
• For both: The wider the bandwidth, the more information can flow over the channel.
Physical links (contd.)
Typical cable bandwidths used in local area networks.
Cable: Typical Bandwidth:
Twisted Pair 10 to 100 Mbps
Coaxial Cable 10 to 100 Mbps
Fiber-optic cable 100 to 200 Mbps

The bandwidths of different services offered by a telephone company:


Service: Bandwidth
ISDN 64 Kbps/channel
T1 1.544 Mbps
T3 44.736 Mbps
STS-1 51.840 Mbps
STS-3 155.250 Mbps
STS-12 622.080 Mbps
STS-24 1.244160 Gbps
STS-48 2.488320 Gbps

Mbps = megabytes per sec. (millions) Gbps=Gigabytes per sec. (billions)


Physical links (contd.)
• Types of nodes important to networks.
Hub A device that repeats or broadcasts the network stream of information to
individual nodes ( usually personal computers)
Switch A device that receives packets from its input link, and then sorts them and
transmits them over the proper link that connects to the node addressed.
Bridge A link between two networks that have identical rules of communication.
Gateway A link between two different networks that have different rules of
communication.
Router A node that sends network packets in one of many possible directions to
get them to their destination.
Traceroute
• Traceroute: A program that allows the the tracing of packets over the
Internet or any network using TCP/IP protocol.
• Uses a special number - TTL (Time to Live) - contained in a place at the
beginning of each packet sent over the network.
• The number is originally set to 255.
• Each time it is received by a router, it decrements by 1.
• If the TTL number becomes 0 before reaching its destination, the router where this
happened sends back an error message (time exceeded) with the address of the router.
• Stops messages from circulating forever.
Multiple Access techniques
Figure: Data link layer divided into two functionality-oriented sublayers
Figure: Taxonomy of multiple-access protocols discussed in this chapter
Random Access

• Also called contention-based access


• No station is assigned to control another

ALOHA Network
Contd…
• ALOHA(Abramson's Logic Of Hiring Access) is a system proposed for
solving the channel allocation problem.
- there are two versions of ALOHA:
1. Pure ALOHA;
2. Slotted ALOHA
Figure: Frames in a pure ALOHA network
Pure ALOHA

In pure ALOHA, frames are transmitted at completely


arbitrary times.
Pure ALOHA

The system is working as follows:

1- let users transmit whenever they have data to be


sent.
2- expected collisions will occur.
3- the collided frames will be destroyed.
4- using a feedback mechanism to know about the
status of frame.
5- retransmit the destroyed frame.
Pure ALOHA (2)

Vulnerable period for the shaded frame.


Figure: Vulnerable time for pure ALOHA protocol
Figure: Procedure for pure ALOHA protocol
• Propagation time
• Time required for an electrical wave to travel between two points on a
transmission line.
• Backoff time
• A host which has experienced a collision on a network waits for a
amount of time before attempting to retransmit.
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.
Pure ALOHA (3)

Throughput versus offered traffic for ALOHA systems.


Note

The throughput for pure ALOHA is


S = G × e −2G .
The maximum throughput
Smax = 0.184 when G= (1/2).
where G is the average number of frames requested per frame-time
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.
Slotted ALOHA

There is a limit for the best channel utilization using


Slotted ALOHA.
To reduce the chance of collisions the station should
be able to detect what other stations are doing.
In LAN networks this is possible, therefore they can
achieve better utilization than Slotted ALOHA.
Carrier Sense Protocols are protocols in which stations
listen for a carrier.
Figure: Frames in a slotted ALOHA network
Note

The throughput for slotted ALOHA is


S = G × e−G .
The maximum throughput
Smax = 0.368 when G = 1.
where G is the average number of frames requested per frame-time
Figure: Vulnerable time for slotted ALOHA protocol
Carrier Sense Multiple Access (CSMA)

• "Listen before talk"


• Reduce the possibility of collision
But cannot completely eliminate it.
Carrier Sense Multiple Access (CSMA) is a probabilistic  Media Access
Control  (MAC) protocol in which a node verifies the absence of
other traffic before transmitting  on a shared transmission medium , such as an
electrical bus, or a band of the electromagnetic spectrum .

"Carrier Sense" describes the fact that a transmitter  uses feedback  from a receiver


that detects a carrier wave  before trying to send. That is, it tries to detect the
presence of an encoded signal  from another station before attempting to transmit. If
a carrier is sensed, the station waits for the transmission in progress to finish before
initiating its own transmission.

"Multiple Access" describes the fact that multiple stations send and receive on the
medium. Transmissions by one node are generally received by all other stations
using the medium.
CSMA: Vulnerable Time
Types
• There are several versions of carrier sense protocols:
- 1-persistent CSMA

- Non-persistent CSMA

- P-persistent CSMA

- CSMA with Collision Detection (CSMA/CD)


- CSMA with Collision Avoidance (CSMA/CA)
Persistence Methods
• What a station does when channel is idle or busy
Persistence Methods
1-Presistent CSMA

- In 1-persistent CSMA, a station prior to send


data it listen to the channel to see if anyone else
is transmitting at that moment.
- if the channel is busy, the station waits until it
becomes idle.
- If the channel is idle, the station transmits a
frame.
- If a collision occurs, the station waits a random
amount of time and starts all over again.
Contd...

- Although this protocol has disadvantages, it is


better than ALOHA and Slotted ALOHA

-- 1) It’s performance depends on the


propagation delay.
-- 2) There is a chance when two stations start
transmission at the same time.
Non-Persistent CSMA
- In Non-persistent CSMA a station makes conscious
attempt to sense the channel.

- After the first attempt, if the channel is idle, it


sends, however, if the channel is already in use, it
waits a random period of time and repeats the
algorithm.
- (+ -)This algorithm has better utilization but longer
delays than 1-persistent CSMA.
P-Persistent CSMA

- In p-persistent CSMA a station transmits if the


channel is idle with a probability p and with
probability q=1-p it waits until the next slot.
- The main advantage of persistent and non-
persistent over ALOHA is that they ensure no
station begins to transmit when it senses the
channel busy.
MAC Sub layer
CSMA with Collision Detection
- It is important that stations should terminate
transmission as soon as they detect a collision.
- This protocol is called CSMA/CD.
- It is widely used on LANs in the MAC sub
layer.
- It is the basis of the popular Ethernet LAN.
CSMA with Collision Detection

CSMA/CD can be in one of three states: contention, transmission, or idle.


MAC Sub layer
CSMA with Collision Detection
- A collision can be detected by looking at the
power or pulse width of the received signal and
comparing it to the transmitted signal.
- After a station detects a collision it terminates
its transmission, waits a random period of time,
and then tries again, assuming that no other
station has started transmitting in the meantime.
MAC Sub layer
CSMA with Collision Detection
- Collision detection is an analog process.
Therefore, special encoding is commonly used.
- A sending station must continually monitor the
channel, listening for noise bursts that might
indicate a collision. For this reason, CSMA/CD
with a single channel is inherently a half-
duplex system.
Figure: Collision of the first bit in CSMA/CD
Figure: Collision and abortion in CSMA/CD
Figure: Flow diagram for the CSMA/CD
Figure: Energy level during transmission, idleness, or collision
CSMA/CA
• Carrier Sense Multiple Access with Collision Avoidance
• Used in a network where collision cannot be detected
• E.g., wireless LAN

IFS – Interframe Space


CSMA/CA

Note

In CSMA/CA, the IFS can also be used to define the priority of


a station or a frame.

Note

In CSMA/CA, if the station finds the channel busy, it does not


restart the timer of the contention window;
it stops the timer and restarts it when the channel becomes idle.
CSMA/CA: Flow Diagram

contention window
size is 2K-1

After each slot:


- If idle, continue counting
- If busy, stop counting
Control Access
• A station must be authorized by someone (e.g., other stations) before
transmitting
• Three common methods:
• Reservation
• Polling
• Token passing
Reservation Method
• Features
• Time is divided into intervals
• In each interval , a reservation frame precedes the data frames sent in that interval
• N-stations - N reservation mini slots in the reservation frame
• When a station needs to send a frame it makes reservation in its own minislot
Polling
• Works with topologies in which one station is designated as a primary
station and the others are secondary stations.
• All data exchanges must be made through the primary device.
• Primary controls the link, the secondary follows its instructions.
• If primary wants to receive data, it asks the secondaries if they have anything to
send. This is called poll function.
• If the primary wants to send data, it tells the secondary to get ready to receive.
This is called select function.
Polling Method
Token passing
• Features
• Each station in a network are organized as logical ring.
• A special packet called the token is circulated over the network.
• If any station wants to transmit data, it captures the token and starts
transmitting.
• After the data transfer is over, it releases the token.
Token Passing
CHANNELIZATION

Channelization is a multiple-access method in which the


available bandwidth of a link is shared in time, frequency, or
through code, between different stations. In this section, we
discuss three channelization protocols.

Topics discussed in this section:

Frequency-Division Multiple Access (FDMA)


Time-Division Multiple Access (TDMA)
Code-Division Multiple Access (CDMA)
Note

In FDMA, the available bandwidth


of the common channel is divided into bands that are separated
by guard bands.
Frequency Division Multiple Access(FDMA)
• Channel spectrum is divided into frequency bands.
• Each station assigned fixed frequency band.
• Unused transmission time in frequency bands go idle.
• Each channel gets a band of frequencies.
• Used in traditional radio , TV , 1G cellular
Figure: Frequency-division multiple access (FDMA)
Contd…
• Advantages
• No dynamic co ordination.
• Disadvantages
• Inflexible and inefficient if channel load is dynamic and uneven.
Note

In TDMA, the bandwidth is just one channel


that is timeshared between different stations.
Contd…
• Access to channel in ‘’rounds”.
• Each station gets fixed length slot (length = packet transmission time)
in each round.
• Unused slots go idle.
• Each station gets entire spectrum for a certain (rotating) time period.

• Advantages
• Can assign more time to senders with heavier loads
• Disadvantages
• Requires precise synchronization.
Figure: Time-division multiple access (TDMA)
Combining FDMA and TDMA
• Each channel gets a certain frequency band for a certain amount of
time.
• Ex. GSM
• Advantage:
• More robust against frequency.
• Much greater capacity with time compression.
• Inherent tapping protection.
• Disadvantage :
• Frequency changes must be coordinated.
Code Division Multiple Access(CDMA)
• CDMA focuses primarily on the “Direct Sequence SS” technique
• Instead of using frequencies or time slots, as do FDMA & TDMA, it uses digital
codes to transmit and distinguish between multiple users
• Each user is assigned a unique PN(Pseudo Noise) code sequence with which to
encode its data and the assigned code is uncorrelated with the data
• Because the signals are distinguished by digital codes, many users can share the
same bandwidth simultaneously
• signals are transmitted in the same frequency at the same time
Contd…
• Multiplying the data by the high data rate PN code results in dividing the signal
into smaller bits, thus, increasing its BW
• The PN code used for spreading must have
• low cross-correlation values and
• be unique to every user
• This is the reason why a receiver which has knowledge about the code of the
intended transmitter, is capable of selecting the desired signal
How CDMA works
• A unique code is assigned to all users
• Signals for all calls are spread across a broad frequency spectrum
• CDMA – An Analogy
Contd…
• 4 speakers are simultaneously giving a presentation, and they each speak different
native language -- Arabic, Chinese, English & Hindu.
• You are in the audience, and English is your native language.
• You only understand the words of the English speaker and tune out the Arabic,
Chinese, and Hindu speakers.
• You hear only what you know and recognize
• The same is true for CDMA
Contd…
• Multiple users share the same frequency band at the same time, yet each user only
hears his or her intended conversation.
• Each conversation is specially encoded and decoded for each
• particular user
• This technique allows numerous telephone calls to be simultaneously transmitted
in one radio frequency band.
Contd…
• At transmitter, signal is first “correlated” with the PN sequence
• At the receiver, the spread signal is “demodulated” to a narrow band and then
decorrelated using unique PN code intended for it.
• A signal correlated with a given PN code and decorrelated with the same PN code
returns the original signal
• Decorrelating the signal with the wrong PN code would result in pure noise
CDMA
• One channel carries all transmissions at the same time
• Each channel is separated by code
CDMA: Chip Sequences
• Each station is assigned a unique chip sequence

• Chip sequences are orthogonal vectors


• Inner product of any pair must be zero
• With N stations, sequences must have the following properties:
• They are of length N
• Their self inner product is always N
CDMA: Bit Representation
Transmission in CDMA
CDMA Encoding
Signal Created by CDMA
CDMA Decoding
Contd…
• Adv
• Bandwidth efficient – code space huge.
• No coordination or synchronization between different channels.
• Disadv
• More complex signal generation.
Hybrid multiple access techniques
• Some practical systems combine two or more of these multiplexing or
multiple access techniques.
• Hybrid systems are used to overcome the shortcomings of a single SS
or multiple access techniques in a given application.
Contd…
• Types
• Frequency Division Multiple Access TDMA
• CDMA/FDMA
• Direct Sequence Frequency Hopping Multiple Access(DS/FHMA)
• Time Division CDMA (TCDMA)
• Time Division Frequency Hopping (TDFH)
Frequency Division Multiple Access TDMA
• GSM(Global System for Mobile communications), although
primarily a TDMA system, requires several 200 kHz
frequency channels (each carrying eight time slots) in order
to provide a practical high capacity cellular system and can
also be viewed as an FDMA system also.
CDMA/FDMA
• The practical IS-95 is an example of a CDMA/FDMA technique .
• Interim Standard 95 (IS-95) is the first CDMA-based digital cellular
standard by Qualcomm.
• Uses 1.25 MHz channels on a number of SS wideband channels making up
a typical cellular service
Direct Sequence Frequency Hopping Multiple
Access(DS/FHMA)
• One data bit is divided into frequency-hop channels (fc)
• In each frequency-hop channel one complete PN-code
of length Nfh is added to the data signal.
• Since FH-sequence and PN-codes are coupled, every
receiver is identified by a combination of an FH-
sequence and PN-codes
Time Division CDMA (TCDMA)
• Different spreading codes are assigned to different cells
• Within each cell, only one user is allocated a particular time slot such
that only one user is transmitting in each cell at one slot
Time Division Frequency Hopping (TDFH)

• At the start of a new TDMA frame, the user hops to a new channel
• This avoids severe fades or erasure in any particular channel
• The user is allowed to hop according to a predefined sequence
• Transmitter are made to transmit on different frequencies at different times
FRAMING
Topics
• Byte Oriented Protocols (BISYNC , PPP)
• Sentinel Approach
• Byte - Counting Approach (DDCMP)
• Bit Oriented Protocols ( HDLC)
• Clock – Based Framing (SONET)
FRAMING
•The stream of bits are not advisible to maintain in networks.
•When an error occurs, then the entire stream have to retransmitted.
•To avoid this, the framing concept is used.
•In this, the stream of bits are divided into manageable bit units called frames.
•To achieve, we are using several ways.
They are,
• 1. Byte Oriented Protocols
• 2. Bit Oriented Protocols
• 3. Clock Based Protocols
Contd…
1. BYTE ORIENTED PROTOCOLS:
• Each frame is considered as a collection of bytes rather than a collection of bits.
• There are two approaches. They are,
• 1. Sentinel Approach
• 2. Byte – Counting Approach
1. Sentinel approach
• In this approach it uses special characters called sentinel characters to indicate where
frames start and end.
• This approach is called character stuffing because extra characters are inserted in the
data portion of the frame.
Ex: 1. Binary Synchronous Communication (BISYNC)
2. Point to Point Protocol
Contd…

Fig: BISYNC Frame format


• The beginning of a frame is denoted by sending a special SYN(synchronization)
character.
• The data portion of the frame contain special sentinel characters
• STX (Start of TeXt)
• ETX(End of TeXt)
• The SOH (Start Of Header) field serves much the same purpose as the STX
field.
Contd…
• The problem with the sentinel approach is that the ETX character might
appear in the data portion of the frame.
• BISYNC overcomes this problem by “escaping” the ETX character by
preceding it with a DLE(Data –Link-Escape) character whenever it appears
in the body of a frame.
• The DLE character is also escaped in the frame body.
• The approach is called character stuffing because extra characters are
inserted in the data portion of the frame.
• CRC (Cyclic Redundancy Check) is used to detect transmission errors.
Example: Control Characters…
The control characters in ASCII still in common use include:
•0 (null, NUL, \0, ^@), originally intended to be an ignored character,
but now used by many programming languages to mark the end of a string.
•7 (bell, BEL, \a, ^G), which may cause the device receiving it to emit a warning of some kind.
•8 (backspace, BS, \b, ^H), used either to erase the last character printed or to overprint it.
•9 (horizontal tab, HT, \t, ^I), moves the printing position some spaces to the right.
•10 (line feed, LF, \n, ^J), used as the end of line marker in most UNIX systems and variants.
•11 (vertical tab, VT, \v, ^K), vertical tabulation.
•12 (form feed, FF, \f, ^L), to cause a printer to eject paper to the top of the next page,
or a video terminal to clear the screen.
•13 (carriage return, CR, \r, ^M), used as the end of line marker in Mac OS, OS-9, FLEX (and variants).
A carriage return/line feed pair is used by CP/M-80 and its derivatives including DOS and Windows,
and by Application Layer protocols such as HTTP.
•27 (escape, ESC, \e (GCC only), ^[).
•127 (delete, DEL, ^?), originally intended to be an ignored character,
but now used in some systems to erase a character.
Also used by some Plan9 console programs to send an interrupt note to the current process.
Point to Point protocol (PPP)
• PPP is commonly run over dial up modem links
The format of PPP frame is  
 

Fig: PPP Frame Format


• The Flag field has 01111110 as starting sequence.
• The Address and Control fields usually contain default values
• The Protocol field is used for demultiplexing.
• The frame payload size can be negotiated, but it is 1500 bytes by default.
• The PPP frame format is unusual in that several of the field sizes are negotiated rather than fixed.
• Negotiation is conducted by a protocol called LCP (Link Control Protocol).
• LCP sends control messages encapsulated in PPP frames—such messages are denoted by an LCP
identifier in the PPP Protocol.
Contd…
2. Byte Count Approach
• In this approach no of bytes in frame are counted and entered in the header.
• Ex: 1.Digital Data Communication Message Protocol(DDCMP)
Contd…
• DDCMP protocol is used for this approach. The frame format is
 
 

Fig: DDCMP frame format


• COUNT Field specifies how many bytes are contained in the frame’s body.
• Sometime count field will be corrupted during transmission, so the receiver will
accumulate as many bytes as the COUNT field indicates. This is sometimes called
a framing error.
• The receiver will then wait until it sees the next SYN character.
Bit-Oriented Protocols (HDLC)
•  In this, frames are viewed as collection of bits. High level data link
protocol(HDLC) is used. The format is
 
 
 Fig: HDLC Frame Format
Contd…
• HDLC denotes both the beginning and the end of a frame with the
distinguished bit sequence 01111110.
• This sequence might appear anywhere in the body of the frame, it can be
avoided by bit stuffing.
• On the sending side, any time five consecutive 1’s have been transmitted
from the body of the message (i.e., excluding when the sender is trying to
transmit the distinguished 01111110 sequence), the sender inserts a 0 before
transmitting the next bit.
Contd…
• On the receiving side, five consecutive 1’s arrived, the receiver makes its
decision based on the next bit it sees (i.e., the bit following the five is).
• If the next bit is a 0, it must have been stuffed, and so the receiver removes
it. If the next bit is a 1, then one of two things is true, either this is the end-
of-frame marker or an error has been introduced into the bit stream.
Contd…
• By looking at the next bit, the receiver can distinguish between these two
cases:
• If it sees a 0 (i.e., the last eight bits it has looked at are 01111110), then it is
the end-of- frame marker.
• If it sees a 1 (i.e., the last eight bits it has looked at are 01111111), then there
must have been an error and the whole frame is discarded.
Clock-Based Framing (SONET)
• Synchronous Optical Network Standard is used for long
distance transmission of data over optical network.
• It supports multiplexing of several low speed links into
one high speed links.
• An STS-1 frame is used in this method.
Contd…

• It is arranged as nine rows of 90 bytes each, and 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, and these bytes
that enable the receiver to determine where the frame starts.
• The receiver looks for the special bit pattern consistently, once in every 810
bytes, since each frame is 9 x 90 = 810 bytes long.
Contd…

• The STS-N frame can be thought of as consisting of N STS-1 frames, where


the bytes from these frames are interleaved; that is, a byte from the first
frame is transmitted, then a byte from the second frame is transmitted, and
so on.
• Payload from these STS-1 frames can be linked together to form a larger
STS-N payload, such a link is denoted STS-Nc. One of the bit in overhead is
used for this purpose.
Error Detection and Correction
Topics
• Error Detection
• Two Dimensional Parity check
• Internet Check sum algorithm
• Cyclic Redundancy Check
• Error Correction
• Single bit Error correction
• Burst bit Error correction
Error Detection
• Data can be corrupted during transmission. For reliable communication, errors
must be detected and corrected.
• The three error detecting techniques are:
• Parity check
• Check sum algorithm
• Cyclic Redundancy Check

Note
In a single-bit error, only 1 bit in the data unit has changed.
Figure: Single-bit error

Note
A burst error means that 2 or more bits in the data
unit have changed.
Figure: Burst error of length 8

Note
To detect or correct errors, we need to send extra (redundant) bits with data.
Figure: The structure of encoder and decoder
Contd…
Redundancy
• One method is to send every data twice, so that receiver checks every bit
of two copies and detect error.
Drawbacks
• Sends n-redundant bits for n-bit message.
• Many errors are undetected if both the copies are corrupted.
• Instead of adding entire data, some bits are appended to each unit.
• This is called redundant bit because the bits added will not give any new
information. These bits are called error detecting codes.
Redundancy check
Contd…
Four types of redundancy checks are used in data communications.
They are,
1. vertical redundancy check (VRC)
2. longitudinal redundancy check (LRC)
3. cyclic redundancy check (CRC)
4. checksum
Vertical Redundancy Check (VRC)
• It is also known as parity check.
• In this technique a redundant bit called a parity bit is appended to every
data unit so that the total number of 1s in the unit including the parity
bit becomes even for even parity or odd for odd parity.
• In even parity, the data unit is passed through the even parity generator.
Contd…
• It counts the number of 1s in the data unit. If odd number of 1s, then it
sets 1 in the parity bit to make the number of 1s as even.
• If the data unit having even number of 1s then it sets in the parity bit to
0 maintain the number of 1s as even.
• When it reaches its destination, the receiver puts all bits through an
even parity checking function.
• If it counts even number of 1s than there is no error. Otherwise there is
some error.
Contd…
• EXAMPLE:
The data is : 01010110
The VRC check : 01010110 0
• In odd parity, the data unit is passed through the odd parity generator. It counts the
number of 1s in the data unit.
• If even number of 1s, then it sets 1 in the parity bit to make the number of 1s as odd.
• If the data unit having odd number of 1s then it sets in the parity bit to maintain the
number of 1s as odd.
• When it reaches its destination, the receiver puts all bits through an odd parity
checking function. If it counts odd number of 1s than there is no error. Otherwise
there is some error.
• Another EXAMPLE
The data is: 01010110
The VRC check: 01010111
Parity Check
 Simplest technique.
 A redundant bit (parity bit), is appended to every data
unit.
 Even parity - the total number of 1's in the data plus
parity bit must be an even number.
Even Parity Generator

Data #1's in data P Total # 1's (data and P)


0110110 4 (Even) 0 4 (Even)
0011111 5 (Odd) 1 6 (Even)
0000000 0 (Even) 0 0 (Even)
1010100 3 (Odd) 1 4 (Even)
1111111 7 (Odd) 1 8 (Even)
Example 1

Even Parity

Suppose the sender wants to send the word world. In


ASCII(119,111,114,108,100) the five characters are coded as
1110111 1101111 1110010 1101100 1100100
The following shows the actual bits sent
11101110 11011110 11100100 11011000 11001001
Example 2

Even Parity

Now suppose the word world in Example 1 is received by the


receiver without being corrupted in transmission.
11101110 11011110 11100100 11011000 11001001
The receiver counts the 1s in each character and comes up with
even numbers (6, 6, 4, 4, 4). The data are accepted.
Example 3

Even Parity

Now suppose the word world in Example 1 is corrupted during


transmission.
11111110 11011110 11101100 11011000 11001001
The receiver counts the 1s in each character and comes up with
even and odd numbers (7, 6, 5, 4, 4). The receiver knows that the
data are corrupted, discards them, and asks for retransmission.
VRC Performance
• VRC can detect all single-bit errors. It can also detect burst errors as long as the
total number of bits changed is odd (1,3,5…etc)
• How about if the total number of bit changed is even ??? Yea.. There is problem !!!

• In short VRC can detect all single-bit errors. It can detect burst errors only if the
total number of errors in each data unit is odd.
LONGITUDINAL REDUNDANCY CHECK (LRC)
In longitudinal redundancy check LRC, a block of bits is
divided into rows and a redundant row of bits is added to
the whole block.
Original data
11100111 11011101 00111001 10101001
11100111
11011101
00111001
10101001
-----------------
LRC 10101010
11100111 11011101 00111001 10101001 10101010
The above is the original data plus LRC
e.g. problem in LRC
Suppose the following block is sent

10101001 00111001 11011101 11100111 10101010


(LRC)

However, it is hit by a burst noise of length eight and some bits are corrupted.

10100011 10001001 11011101 11100111 10101010


(LRC)

When the receiver checks the LRC, some of the bits do not follow the even-parity rule and the whole
block is discarded (the nonmatching bits are shown in blue)

10100011 10001001 11011101 11100111 10101010


(LRC)
Performance of LRC
• LRC increases the likelihood of detecting burst errors. As we showed in the
previous e.g. an LRC of n bits can easily detect a burst error of n bits.
• A burst error of more than n bits is also detected by LRC with a very high
probability.
Two Dimensional Parity
• It is based on simple parity.
• It performs calculation for each bit position across each byte in the frame.
• This adds extra parity byte for entire frame, in addition to a parity bit for each byte.
 

 
 
 
  
Fig: Two-dimensional parity
• For example frame containing 6 bytes of data. In this third bit of the parity byte is 1 since there are
an odd number of 1’s is in the third bit across the 6 bytes in the frame.
• In this case, 14 bits of redundant information are added with original information.
Figure: Two-dimensional parity-check code
Figure: Two-dimensional parity-check code
Figure: Two-dimensional parity-check code
CRC
 The most powerful of the redundancy checking technique.
 Based on binary division.
 The redundancy bits used by CRC are derived by dividing the data unit by
a predetermined divisor; the remainder is the CRC.
 A CRC must:
 have exactly one less bit than the divisor
 appending it to the end of the data string must make the resulting bit
sequence exactly divisible by the divisor.
CRC generator and checker

1. Receive the frame. 1. Get the raw frame.


2. Divide it by divisor. 2. Left shift the raw frame by n bits
3. Check the remainder. and divide it by divisor.
3. The remainder is the CRC bit.
4. Append the CRC bit to the frame
and transmit.
Figure: Division in CRC encoder
Figure: Division in the CRC decoder for two cases
CRC
 CRC generator – at the sending node.
 CRC checker – at the receiving node.
 Polynomial:
 The CRC generator (the divisor) is most often represented
as an algebraic polynomial.
 e.g.
A polynomial representing a divisor
Table : Standard polynomials

Name Polynomial Application

CRC-8 x8 + x2 + x + 1 ATM header


CRC-10 x10 + x9 + x5 + x4 + x 2 + 1 ATM AAL
ITU-16 x16 + x12 + x5 + 1 HDLC
x32 + x26 + x23 + x22 + x16 + x12 + x11 + x10
ITU-32 LANs
+ x8 + x7 + x5 + x4 + x2 + x + 1
Internet Checksum Algorithm
• It is not used at the link level.
• The idea of internet checksum is simple.
• You add up all the words that are transmitted and then transmit the result of that
sum. This is called internet checksum.
• The receiver performs the same calculation on the received data and compares the
result with the received checksum.
• If the transmitted data including the checksum itself is corrupted then the results
will not match, receiver knows that an error occurred
Checksum
 The error detection used by the higher-layer protocols.
 Check generator – in the sending node
 Checksum checker – at receiving node

Ethernet frame
Checksum generator
• In the sender, the checksum generator subdivides the data unit into equal segments
of n bits (usually 16).
• These segments are added together using one’s complement arithmetic in such a
way that the total is also n bits long.
• The total(sum) is then complemented and appended to the end of the original data
unit as redundancy bits, called checksum field.
• The extended data unit is transmitted across the network.
• So if the sum of the data segment is T, the checksum will be -T
Data unit and checksum
Checksum checker

• The receiver subdivides the data unit as above and adds all segments together and
complements the result.
• If the extended data unit is intact, the total value found by adding the data
segments and the checksum field should be zero.
• If the result is not zero, the packet contains an error and the receiver rejects it.
Checksum
The sender follows these steps:
• The unit is divided into k sections, each of n bits
• All sections are added together using one’s complement to get the sum.
• The sum is complemented and becomes the checksum.
• The checksum is sent with the data.

The receiver follows these steps


• The unit is divided into k sections, each of n bits.
• All sections are added together using one’s complement to get the sum.
• The sum is complemented.
• If the result is zero, the data are accepted. Otherwise, they are rejected.
Example 6
Suppose the following block of 16 bits is to be sent using a
checksum of 8 bits.
10101001 00111001
The numbers are added using one’s complement
10101001
00111001
------------
Sum 11100010
Checksum 00011101
The pattern sent is 10101001 00111001 00011101
Example 7
Now suppose the receiver receives the pattern sent in
Example 6 and there is no error.
10101001 00111001 00011101
When the receiver adds the three sections, it will get all 1s,
which, after complementing, is all 0s and shows that there is
no error. 10101001
00111001
00011101
------------
Sum 11111111
Complement 00000000 means that the pattern is OK.
Example 8
Now suppose there is a burst error of length 5 that affects 4 bits.
Original data 10101001 00111001 00011101
Corrupted data 10101111 11111001 00011101
When the receiver adds the three sections, it gets
10101111
11111001
00011101
Partial Sum 1 11000101
Carry 1
Sum 11000110
Complement 00111001 the pattern is corrupted.
Error Correction
Hamming Code

 Focus on a simple case: Single-Bit Error Correction

 Use the relationship between data and redundancy bits

 Developed by Richard Hamming


Positions of redundancy bits in Hamming code (11,7)

* Check bits occupy positions that are powers of 2

In the Hamming code, each r bit is the VRC bit for one combination of data bits:
r1 is the VRC bit for one combination of data bits, r2 is the VRC bit for another
combination of data bits, and so on. The combinations used to calculate each of the
four r values for a seven-bit data sequence are as follows:
r1 : bits 1, 3, 5, 7, 9, 11
r2 : bits 2, 3, 6, 7, 10, 11
r4 : bits 4, 5, 6, 7
r5 : bits 8, 9, 10, 11
• All bit positions that are powers of 2 are used as parity bits. (positions 1, 2, 4, 8…)
• All other bit positions are for the data to be encoded. (positions 3, 5, 6, 7, 9, 10, 11…)
• Each parity bit calculates the parity for some of the bits in the code word. The position of the parity bit
determines the sequence of bits that it alternately checks and skips.
• General rule for position n: skip n−1 bits, check n bits, skip n bits, check n bits...

• Position 1 (n=1): skip 0 bit (0=n−1), check 1 bit (n), skip 1 bit (n), check 1 bit (n), skip 1 bit (n), etc.
(1,3,5,7,9,11...)
• Position 2 (n=2): skip 1 bit (1=n−1), check 2 bits (n), skip 2 bits (n), check 2 bits (n), skip 2 bits (n), etc.
(2,3,6,7,10,11...)
• Position 4 (n=4): skip 3 bits (3=n−1), check 4 bits (n), skip 4 bits (n), check 4 bits (n), skip 4 bits (n), etc.
(4,5,6,7,12...)
• Position 8 (n=8): skip 7 bits (7=n−1), check 8 bits (n), skip 8 bits (n), check 8 bits (n), skip 8 bits (n), etc.
(8-15,24-31,40-47,...)
Redundancy bits calculation
r1 will take care of these bits

1011 1001 0111 0101 0011 0001


11 9 7 5 3 1

d d d r8 d d d r4 d r2 r1
r2 will take care of these bits

1011 1010 0111 0110 0011 0010

11 10 7 6 3 2

d d d r8 d d d r4 d r2 r1
r4 will take care of these bits

0111 0110 0101 0100

7 6 5 4

d d d r8 d d d r4 d r2 r1
r8 will take care of these bits

1011 1010 1001 1000

11 10 9 8

d d d r8 d d d r4 d r2 r1
Contd…
• Calculating the r Values:
• In the first step, place each bit of the original character in its
appropriate positions in the 11 bit unit.
• Then, calculate the even parities for the various bit combinations.
• The parity value of each combination is the value of the corresponding r bit.
• For example r1 is calculated to provide even parity for a combination of bits
3, 5, 7, 9, 11.
Example of redundancy bit calculation
Single-Bit Error
Error detection using Hamming code

Error
Detection
Example Question

The data is 1011011

Add the parity bit.


???????????????

Consider the transmitted data to be 00101010111. Show how the error bit
position is determined

???????????????
Answer:

The data is 1011011

1. Add the parity bit.

10101010111
2. Consider the transmitted data to be 00101010111. Show how the
error bit position is determined.

1011 = 11
Flow Control
Topics
• Functions Of data link layer
1. Line discipline or Access control
1. ENQuiry / ACKnowledgement (ENQ / ACK)
2. poll / select (POLL / SELECT)
2. Flow control
1. stop and wait protocol
2. sliding window protocol
3. Error control
4. Framing
LINE DISCIPLINE
• Communications requires at least two devices, one to send and one to
receive.
• If both devices are ready to send some information and put their
signals on the link then the two signals collides each other and became
nothing.
• To avoid such a situation the data link layer use a mechanism called
line discipline.
Contd…
• Line discipline coordinates the link system.
• It determines which device can send and when it can send.
• Line discipline can serve in two ways:
1. ENQuiry / ACKnowledgement (ENQ / ACK)
2. poll / select (POLL / SELECT)
Contd…
• ENQ / ACK:
• This method is used in peer to peer communications. That is where
there is a dedicated link between two devices.
• The initiator first transmits a frame called an enquiry (ENQ) asking the
receiver is available to receive data.
• The receiver must answer either with an acknowledgement
• (ACK) frame if it ready to accept or with a negative acknowledgement (NAK)
frame if it is not ready.
• If the response is positive, the initiator is free to send its data.
• Otherwise it waits, and try again.
• Once all its data have been transmitted, the sending system finishes with an
end of transmission (EOT) frame.
Contd…
Contd…
• POLL / SELECT
• This method of line discipline works with topologies where one device
is designated as primary and the other devices are secondary.
• Whenever a multi point link consists of a primary device and multiple
secondary devices using a single transmission line, all exchanges must be made
through the primary device even when the ultimate destination is a secondary.
Contd…
• The primary device controls the link.
• The secondary devices follow its instructions.
• The primary device only determines which device is allowed to use the
channel at a given time.
• The primary asks the secondary if they have anything to send;
this function is called polling.
• And the primary tells the target secondary to get ready to
receive;
• This function is called selecting.
Contd…
• POLL:
• This function is used by the primary device to solicit transmission from
the secondary devices.
• The secondary are not allowed to transmit data unless asked by the primary
device.
• When the primary ready to receive data, it must ask (poll) each device in turn if
it has anything to send.
• If the secondary have data to transmit it sends the data frame otherwise sends a
negative acknowledgment (NAK).
Contd…
• The primary then polls the next secondary.
• When the response is positive (a data frame), the primary reads the
frame and returns an acknowledgment (ACK).
• There are two possibilities to terminate the transmission:
• either the secondary sends all data, finishing with an EOT frame, or the
primary says “timers up”.
• Then the primary call polls for the remaining devices.
Contd…
Contd…
SELECT:
• This mode of function is used whenever the primary device has
something to send.
• It alerts the intended secondary device get ready to receive data.
• Before sending data it sends the select (SEL) frame.
• The receiver returns an ACK frame . Then the primary sends data.
Select Line Discipline
FLOW CONTROL
• It refers to a set of procedures used to restrict the amount of data flow
between sending and receiving stations.
• It tells the sender how much data it can transmit before it must wait for
an acknowledgement from the receiver.
Contd…
• Receiver has a limited speed at which it can process incoming data and
a limited amount of memory in which to store incoming data.
• Receiver must inform the sender before the limits are reached and
request that the transmitter to send fewer frames or stop temporarily.
• Since the rate of processing is often slower than the rate of
transmission, receiver has a block of memory (buffer) for storing
incoming data until they are processed.
Error Control
• Error control includes both error detection and error correction.
• It allows the receiver to inform the sender if a frame is lost or damaged
during transmission and coordinates the retransmission of those frames
by the sender.
• Error control in the data link layer is based on automatic repeat request
(ARQ). Whenever an error is detected, specified frames are
retransmitted.
Contd…
• There are two methods are used. They are,
1. stop and wait protocol
2. sliding window protocol
STOP-AND-  Sender keeps a copy of the last frame until
WAIT it receives an acknowledgement.
 For identification, both data frames and
acknowledgements (ACK) frames are
numbered alternatively 0 and 1.
 Sender has a control variable (S) that holds
the number of the recently sent frame. (0 or
1)
 Receiver has a control variable (R)that
holds the number of the next frame
expected (0 or 1).
 Sender starts a timer when it sends a frame.
If an ACK is not received within a allocated
time period, the sender assumes that the
frame was lost or damaged and resends it
 Receiver send only positive ACK if the
frame is intact.
 ACK number always defines the number of
the next expected frame
Stop-and-Wait ARQ, lost frame

• When a receiver
receives a damaged
frame, it discards it and
keeps its value of R.
• After the timer at the
sender expires, another
copy of frame 1 is sent.
STOP-AND-WAIT, LOST ACK FRAME
• If the sender receives
a damaged ACK, it
discards it.
• When the timer of
the sender expires,
the sender
retransmits frame 1.
• Receiver has already
received frame 1 and
expecting to receive
frame 0 (R=0).
Therefore it discards
the second copy of
frame 1.
STOP-AND-WAIT, DELAYED ACK FRAME

• The ACK can be delayed at the receiver or


due to some problem
• It is received after the timer for frame 0
has expired.
• Sender retransmitted a copy of frame 0.
However, R =1 means receiver expects to
see frame 1. Receiver discards the
duplicate frame 0.
• Sender receives 2 ACKs, it discards the
second ACK.
PIGGYBACKING
• A method to combine a
data frame with ACK.
• Station A and B both
have data to send.
• Instead of sending
separately, station A
sends a data frame that
includes an ACK.
• Station B does the same
thing.
• Piggybacking saves
bandwidth.
Disadvantage of Stop-and-Wait

• In stop-and-wait, at any point in time, there is only one frame that is sent and
waiting to be acknowledged.
• This is not a good use of transmission medium.
• To improve efficiency, multiple frames should be in transition while waiting for
ACK.
• Two protocol use the above concept,
– Go-Back-N ARQ
– Selective Repeat ARQ
Sliding window protocol
• Sliding window algorithm
• First the Sender assigns a sequence number denoted SeqNum to each frame.
• Sequence number is implemented by a finite – size header field and instead
assume that it can grow indefinitely large.
Contd…
• Sender maintains 3 variables
• Send Window Size(SWS) – gives the upper bound on the number of
outstanding(unacknowledged) frames that the sender can transmit
• Last Acknowledgement Received (LAR) – sequence number of the last acknowledgement
received.
• Last Frame Sent (LFS) – sequence number of the last frame sent
LFS – LAR ≤ SWS

Fig . Sliding window on sender


≤ SWS

LAR LFS
Contd…
• When an ACK arrives the sender moves LAR to the right , allowing
the sender to transmit another frame.
• The sender associates a timer with each frame it transmits and it
retransmits the frame should the timer expire before an ACK is
received.
Contd…
• Receiver maintains 3 variables
• Receive Window Size(RWS) –gives the upper bound on the number of out – of –order
frames that the receiver is willing to accept.
• Largest Acceptable Frame (LAR) – sequence number of the largest acceptable Frame.
• Last Frame Received (LFS) – sequence number of the last frame received.
LAF – LFR ≤ RWS

Fig . Sliding window on receiver


≤ RWS

LFR LAF
Contd…
• When a frame with SeqNum arrives the receiver, the receiver takes
• If SeqNum ≤ LFR or SeqNum > LAF then the frame is outside the receiver
window and it is discarded.
• If LFR <SeqNum ≤ LAF then the frame is within the receivers window and it
is accepted.
Note
In the Go-Back-N Protocol, the sequence
numbers are modulo 2m,where m is the size of
the sequence number field in bits.
Figure Send window for Go-Back-N ARQ
Note
The send window is an abstract concept
defining an imaginary box of size 2m − 1 with
three variables: Sf, Sn, and Ssize.

Note
The send window can slide one
or more slots when a valid acknowledgment
arrives.
Figure Receive window for Go-Back-N ARQ
Note

The receive window is an abstract concept


defining an imaginary box of size 1 with one
single variable Rn.
The window slides when a correct frame has
arrived; sliding occurs one slot at a time.
Figure Design of Go-Back-N ARQ
Acknowledgement
• Receiver sends positive ACK if a frame arrived safe and in order.
• If the frames are damaged/out of order, receiver is silent and discard all subsequent
frames until it receives the one it is expecting.
• The silence of the receiver causes the timer of the unacknowledged frame to
expire.
• Then the sender resends all frames, beginning with the one with the expired timer.
• For example, suppose the sender has sent frame 6, but the timer for frame 3 expires
(i.e. frame 3 has not been acknowledged), then the sender goes back and sends
frames 3, 4, 5, 6 again. Thus it is called Go-Back-N-ARQ
• The receiver does not have to acknowledge each frame received, it can send one
cumulative ACK for several frames.
Figure Window size for Go-Back-N ARQ
Note

In Go-Back-N ARQ, the size of the send


window must be less than 2m;
the size of the receiver window
is always 1.
Go-Back-N ARQ, damaged/lost/delayed ACK
• If an ACK is damaged/lost, we can have two situations:
• If the next ACK arrives before the expiration of any timer, there is no need for
retransmission of frames because ACKs are cumulative in this protocol.
• If ACK1, ACK2, and ACk3 are lost, ACK4 covers them if it arrives before the
timer expires.
• If ACK4 arrives after time-out, the last frame and all the frames after that are
resent.
• Receiver never resends an ACK.
• A delayed ACK also triggers the resending of frames
Example 1: Go-Back-N Lost and Delayed Acks
• This is an example of a case where the forward channel is reliable, but the reverse is not.
• No data frames are lost, but some ACKs are delayed and one is lost.
• The example also shows how cumulative acknowledgments can help if acknowledgments
are delayed or lost.
• After initialization, there are seven sender events.
• Request events are triggered by data from the network layer.
• arrival events are triggered by acknowledgments from the physical layer.
• There is no time-out event here because all outstanding frames are acknowledged before
the timer expires.
• Note that although ACK 2 is lost, ACK 3 serves as both ACK 2 and ACK 3.
Figure Flow diagram for Example 1 (Go-Back-N Lost and Delayed Acks)
Example 2: Go-Back-N , Lost Frame
• Frames 0, 1, 2, and 3 are sent. However, frame 1 is lost. The receiver receives
frames 2 and 3, but they are discarded because they are received out of order.
• The sender receives no acknowledgment about frames 1, 2, or 3. Its timer finally
expires.
• The sender sends all outstanding frames (1, 2, and 3) because it does not know
what is wrong.
• Note that the resending of frames 1, 2, and 3 is the response to one single event.
• When the sender is responding to this event, it cannot accept the triggering of
other events.
• This means that when ACK 2 arrives, the sender is still busy with sending frame 3.
Contd…
• The physical layer must wait until this event is completed and the data
link layer goes back to its sleeping state.
• vertical line is shown to indicate the delay.
• It is the same story with ACK 3; but when ACK 3 arrives, the sender is
busy responding to ACK 2.
• It happens again when ACK 4 arrives. Note that before the second
timer expires, all outstanding frames have been sent and the timer is
stopped.
Figure Flow diagram for Example 2 (Go-Back-N , Lost Frame)
Note

In Selective Repeat ARQ, the size of the sender


and receiver window must be at most one-half
of 2m.
Figure Send window for Selective Repeat ARQ
Figure Receive window for Selective Repeat ARQ
Figure Design of Selective Repeat ARQ
Figure Selective Repeat ARQ, window size
Figure Delivery of data in Selective Repeat ARQ
Selective Repeat ARQ, lost frame
• Each frame sent or resent needs a timer, which means that the timers need to be
numbered (0, 1, 2, and 3).
• The timer for frame 0 starts at the first request, but stops when the ACK for this
frame arrives.
• The timer for frame 1 starts at the second request, restarts when a NAK arrives,
and finally stops when the last ACK arrives.
• The other two timers start when the corresponding frames are sent and stop at the
last arrival event.
• At the receiver site we need to distinguish between the acceptance of a frame and
its delivery to the network layer.
• At the second arrival, frame 2 arrives and is stored and marked, but it cannot be
delivered because frame 1 is missing.
Contd…
• At the next arrival, frame 3 arrives and is marked and stored, but still none of the
frames can be delivered.
• Only at the last arrival, when finally a copy of frame 1 arrives, can frames 1, 2, and
3 be delivered to the network layer.
• There are two conditions for the delivery of frames to the network layer:
• First, a set of consecutive frames must have arrived.
• Second, the set starts from the beginning of the window.
Contd…

• Another important point is that a NAK is sent after the second arrival, but not after the
third, although both situations look the same.
• The reason is that the protocol does not want to crowd the network with unnecessary
NAKs and unnecessary resent frames.
• The second NAK would still be NAK1 to inform the sender to resend frame 1 again; this
has already been done.
• A NAK is sent once for each window position and defines the first slot in the window.
• The next point is about the ACKs. Notice that only two ACKs are sent here. The first one
acknowledges only the first frame; the second one acknowledges three frames.
• In Selective Repeat, ACKs are sent when data are delivered to the network layer. If the
data belonging to n frames are delivered in one shot, only one ACK is sent for all of them.
Figure Flow diagram for Selective Repeat ARQ , Lost Frame
Figure Design of piggybacking in Go-Back-N ARQ
Sliding Window Summary
• Sliding window is best known algorithm in networking
• First role is to enable reliable delivery of packets
• Timeouts and acknowledgements
• Second role is to enable in order delivery of packets
• Receiver doesn’t pass data up to app until it has packets in order
• Third role is to enable flow control
• Prevents server from overflowing receiver’s buffer

You might also like