Unit 2 - Computer Networks - WWW - Rgpvnotes.in
Unit 2 - Computer Networks - WWW - Rgpvnotes.in
Tech
Subject Name: Computer Networks
Subject Code: CS-602
Semester: 6th
Downloaded from www.rgpvnotes.in
Syllabus: Data Link Layer: Need, Services Provided, Framing, Flow Control, Error control. Data Link Layer
Protocol: Elementary &Sliding Window protocol: 1-bit, Go-Back-N, Selective Repeat, Hybrid ARQ.
Protocol verification: Finite State Machine Models & Petri net models. ARP/RARP/GARP
Character Count
This method uses a field in the header to specify the number of characters in the frame. When the data
link layer at the destination sees the character count, it knows how many characters follow, and hence
where the end of the frame is. The disadvantage is that if the count is garbled by a transmission error, the
destination will lose synchronization and will be unable to locate the start of the next frame. So, this
method is rarely used.
Character stuffing
In the second method, each frame starts with the ASCII character sequence DLE STX and ends with the
sequence DLE ETX. This method overcomes the drawbacks of the character count method. However,
character stuffing is closely associated with 8-bit characters and this is a major hurdle in transmitting
arbitrary sized characters.
Bit stuffing
The third method allows data frames to contain an arbitrary number of bits and allows character codes
with an arbitrary number of bits per character. At the start and end of each frame is a flag byte consisting
of the special bit pattern 01111110. Whenever the sender's data link layer encounters five consecutive 1s
in the data, it automatically stuffs a zero bit into the outgoing bit stream. This technique is called bit
stuffing
Physical layer coding violations
The final framing method is physical layer coding violations and is applicable to networks in which the
encoding on the physical medium contains some redundancy. In such cases normally, a 1 bit is a high-low
pair and a 0 bit is a low-high pair. The combinations of low-low and high-high which are not used for data
may be used for marking frame boundaries.
To ensure reliable communication, there needs to exist flow control (managing the amount of data the
sender sends), and error control (that data arrives at the destination error free).
• Flow and error control needs to be done at several layers.
• For node-to-node links, flow and error control is carried out in the data-link layer.
Page no: 2 Get real-time updates from RGPV
Downloaded from www.rgpvnotes.in
• For end-point to end-point, flow and error control is carried out in the transport layer.
There may be three types of errors:
Problem with Stop-And-Wait protocol is that it is very inefficient. At any one moment, only in frame is in
transition. The sender will have to wait at least one round trip time before sending next. The waiting can
be long for a slow network such as satellite link.
Stop and Wait Protocol
Characteristics
• Used in Connection-oriented communication.
• It offers error and flow control
• It is used in Data Link and Transport Layers
• Stop and Wait ARQ mainly implements Sliding Window Protocol concept with Window Size 1
Useful Terms:
• Propagation Delay: Amount of time taken by a packet to make a physical journey from one router to
another router.
Propagation Delay = (Distance between routers) / (Velocity of propagation)
• RoundTripTime (RTT) = 2* Propagation Delay
• TimeOut (TO) = 2* RTT
• Time To Live (TTL) = 2* TimeOut. (Maximum TTL is 180 seconds)
3. Delayed Acknowledgement:
This is resolved by introducing sequence number for acknowledgement also.
Page no: 5 Get real-time updates from RGPV
Downloaded from www.rgpvnotes.in
HYBRID ARQ
The HARQ is the use of conventional ARQ along with an Error Correction technique called 'Soft Combining',
which no longer discards the received bad data (with error).
With the 'Soft Combining' data packets that are not properly decoded are not discarded anymore. The
received signal is stored in a 'buffer', and will be combined with next retransmission.
That is, two or more packets received each one with insufficient SNR to allow individual decoding can be
combined in such a way that the total signal can be decoded!
The following image explains this procedure. The transmitter sends a package [1]. The package [1] arrives,
and is 'OK'. If the package [1] is 'OK' then the receiver sends an 'ACK'.
In our example, we see that the package arrived 2 times 'wrong'. And what is the limit of these
retransmissions? Up to 4. IE, we can have up to 4 retransmissions in each process. This is the maximum
number supported by 'buffer'.
SDLC identifies two types of network nodes: primary and secondary. Primary nodes control the operation
of other stations, called secondary. The primary polls the secondary in a predetermined order and
secondary can then transmit if they have outgoing data. The primary also sets up and tears down links and
manages the link while it is operational. Secondary nodes are controlled by a primary, which means that
secondary can send information to the primary only if the primary grants permission.
1. Information (I) frame: Carries upper-layer information and some control information. This
frame sends and receives sequence numbers, and the poll final (P/F) bit performs flow and
error control. The send-sequence number refers to the number of the frame to be sent next.
The receive-sequence number provides the number of the frame to be received next. Both
sender and receiver maintain send- and receive-sequence numbers.
A primary station uses the P/F bit to tell the secondary whether it requires an immediate
response. A secondary station uses the P/F bit to tell the primary whether the current frame is
the last in its current response.
2. Supervisory (S) frame: Provides control information. An S frame can request and suspend
transmission, reports on status, and acknowledge receipt of I frames. S frames do not have an
information field.
3. Unnumbered (U) frame: Supports control purposes and is not sequenced. A U frame can be
used to initialize secondary. Depending on the function of the U frame, its control field is 1 or 2
bytes. Some U frames have an information field.
• Data---Contains path information unit (PIU) or exchange identification (XID) information.
• Frame Check Sequence (FCS) ---Precedes the ending flag delimiter and is usually a cyclic
redundancy check (CRC) calculation remainder. The CRC calculation is redone in the receiver. If the
result differs from the value in the original frame, an error is assumed.
HDLC
High-Level Data Link Control (HDLC) is a bit-oriented code-transparent synchronous data link layer
protocol. HDLC provides both connection-oriented and connectionless service. HDLC can be used for point
to multipoint connections, but is now used almost exclusively to connect one device to another, using what
is known as Asynchronous Balanced Mode (ABM). The original master-slave modes Normal Response
Mode (NRM) and Asynchronous Response Mode (ARM) are rarely used.
FRAMING
HDLC frames can be transmitted over synchronous or asynchronous serial communication links. Those links
have no mechanism to mark the beginning or end of a frame, so the beginning and end of each frame has
to be identified. This is done by using a frame delimiter, or flag, which is a unique sequence of bits that is
guaranteed not to be seen inside a frame. This sequence is '01111110', or, in hexadecimal notation, 0x7E.
Each frame begins and ends with a frame delimiter. A frame delimiter at the end of a frame may also mark
the start of the next frame. A sequence of 7 or more consecutive 1-bits within a frame will cause the frame
to be aborted.
When no frames are being transmitted on a simplex or full-duplex synchronous link, a frame delimiter is
continuously transmitted on the link. Using the standard NRZI encoding from bits to line levels (0 bit =
transition, 1 bit = no transition), this generates one of two continuous waveforms, depending on the initial
state:
8 bits 8 or more bits 8 or 16 bits Variable length, 0 or more bits 16 or 32 bits 8 bits
BISYNC
Binary Synchronous Communication (BSC or Bisync) is an IBM character-oriented, half duplex link protocol,
announced in 1967 after the introduction of System/360. It replaced the synchronous transmit-receive
(STR) protocol used with second generation computers. The intent was that common link management
rules could be used with three different character encodings for messages. Six-bit Transcode looked
backwards to older systems.
BISYNC establishes rules for transmitting binary-coded data between a terminal and a host computer's
BISYNC port. While BISYNC is a half-duplex protocol, it will synchronize in both directions on a full-duplex
channel. BISYNC supports both point-to-point (over leased or dial-up lines) and multipoint transmissions.
Each message must be acknowledged, adding to its overhead.
BISYNC is character oriented, meaning that groups of bits (bytes) are the main elements of transmission,
rather than a stream of bits. The BISYNC frame is pictured next. It starts with two sync characters that the
receiver and transmitter use for synchronizing. This is followed by a start of header (SOH) command, and
then the header. Following this are the start of text (STX) command and the text. Finally, an end of text
(EOT) command and a cyclic redundancy check (CRC) end the frame. The CRC provides error detection and
correction.
Frame types
• I-Frames (Information frames): Carries upper-layer information and some control information. I-
frame functions include sequencing, flow control, and error detection and recovery. I-frames carry
send and receive sequence numbers.
• S-Frames (Supervisory Frames): Carries control information. S-frame functions include requesting
and suspending transmissions, reporting on status, and acknowledging the receipt of I-frames. S-
frames carry only receive sequence numbers.
• U-Frames (Unnumbered Frames): carries control information. U-frame functions include link setup
and disconnection, as well as error reporting. U-frames carry no sequence numbers
Frame format
biology and artificial intelligence research, state machines or hierarchies of state machines have been used
to describe neurological systems. In linguistics, they are used to describe simple parts of the grammars of
natural languages.
The FSM Consist of
States are those instants that the protocol machine is waiting for, the next event to happen e.g.
waiting for ACK.
Transitions occur when some event happens. E.g. when a frame is sent, when a frame is arriving,
when timer goes off, when an interrupt occurs.
Initial State gives description of the system i.e. when it starts running.
A deadlock is a situation in which the protocol can make no more forward progress, there exists a
set of states from which there is no exit and no progress can be made.
How to know a protocol really works → specifies and verify protocol using, e.g. finite state machine
–Each protocol machine (sender or receiver) is at a specific state at every time instant
–Each state has zero or more possible transitions to other states
–One particular state is initial state: from initial state, some or possibly all other states may be reachable
by a sequence of transitions.
• Simplex stop and wait ARQ protocol:
–State SRC: S = 0, 1 → which frame sender is sending;
R = 0, 1 → which frame receiver is expecting;
C = 0, 1, A (ACK), − (empty) → channel state, i.e. what is in channel
There are 9 transitions
Transition Who runs? Frame Accepted Frame Emitted To Network Layer
0 – Frame lost Frame lost
1 R 0 A –
2 S A 1 Yes
3 R 1 A –
4 S A 0 Yes
5 R 0 A –
6 R 1 A No
7 S Time out 0 No
8 S Time out 1 –
Table 2.1 List of Transitions
–Initial state (000): sender has just sent frame 0, receiver is expecting frame 0, and frame 0 is currently in
channel
–Transition 0: States channel losing its content.
–Transition 1: consists of channel correctly delivering packet 0 to receiver, and receiver expecting frame 1
and emitting ACK 0. Also receiver delivering packet 0 to the network layer.
–During normal operation, transitions 1,2,3,4 are repeated in order over and over: in each cycle, two
frames are delivered, bringing sender back to initial state.
Fig 2.27 FSM for Stop and Wait Protocol (Half Duplex)
Petri Net
Petri Net(PN) is an abstract model to show the interaction between asynchronous processes. It is only one
of the many ways to represent these interactions. Asynchronous means that the designer doesn't know
when the processes start and in which sequence they'll take place. A common manner to visualize the
concepts is with the use of places, tokens, transitions and arcs. We refer to the basics of Petri Net for a first
introduction in notations. We want to mention that a transition can only fire when there are tokens in
every input-place. When it fires, one token is taken from every input-place and every output-place from
the transition gets an (extra) token.
The Basics:
A Petri Net is a collection of directed arcs connecting places and transitions. Places may hold tokens. The
state or marking of a net is its assignment of tokens to places. Here is a simple net containing all
components of a Petri Net:
A transition is enabled when the number of tokens in each of its input places is at least equal to the arc
weight going from the place to the transition. An enabled transition may fire at any time. When fired, the
tokens in the input places are moved to output places, according to arc weights and place capacities. This
results in a new marking of the net, a state description of all places.
Fig 2.29
When arcs have different weights, we have what might at first seem confusing behaviour. Here is a similar net, ready
to fire:
Fig 2.30
and here it is after firing:
Fig 2.31
When a transition fires, it takes the tokens that enabled it from the input places; it then distributes tokens
to output places according to arc weights. If the arc weights are all the same, it appears that tokens are
moved across the transition. If they differ, however, it appears that tokens may disappear or be created.
That, in fact, is what happens; think of the transition as removing its enabling tokens and producing output
tokens according to arc weight.
A special kind of arc, the inhibitor arc, is used to reverse the logic of an input place. With an inhibitor arc,
the absence of a token in the input place enables, not the presence:
Fig 2.32
This transition cannot fire, because the token in P2 inhibits it.
Tokens can play the following roles:
A physical object: a robot;
• An information object: a message between two robots;
• A collection of objects: the people mover;
• An indicator of a state: the state in which a robot is: defender/attacker;
• An indicator of a condition: a token indicates whether a certain condition is fulfilled (ex. Soccer game
starts when the referee gives the signal).
Transitions can play the following roles:
• An event: start a thread, the switching of a machine from normal to safe mode;
• A transformation of an object: a robot that changes his role, see further;
• A transport of an object: the ball is passed between the robots.
An arc connects only places and transitions and indicates the direction in which the token travels.
ARP:
ARP or Address Resolution Protocol is a simple communications protocol used primarily today in IP and
Ethernet networks. It’s main purpose is to discover and associate IP addresses to physical MAC hardware
addresses. ARP is used to find the MAC address of device on a network using only the IP address. The ARP protocol
will make a broadcast out to the network asking for the MAC address of the destination IP address. The machine
with the IP address will respond with its MAC address. The communication then drops to the link layer for physical
to physical data communication between computers. ARP’s job is to basically discover and associate IP
addresses to physical MAC addresses.
RARP:
RARP (Reverse ARP) is a legacy protocol that has now been replaced by BOOTP and later by DHCP. Its
purpose was for diskless workstations (i.e no ability to store an IP address) to discover what their own IP
address was - based on their MAC address. At the point of boot, the workstation would send a request
requesting its IP, a RARP server would then respond with the appropriate IP. For example:
RARP Request: What is my IP address (MAC address is within Ethernet header)?
RARP Response: Your IP address is 192.168.1.11.
The main problem with RARP was that:
The RARP server needed to be populated with the MAC to IP mappings.
No additional data (DNS, NTP) could be sent other than the IP address.
Page no: 17 Get real-time updates from RGPV
Downloaded from www.rgpvnotes.in
In more advanced networking situations you may run across something known as Gratuitous ARP (GARP).
A gratuitous arp something that is often performed by a computer when it is first booted up. When a
NIC’s is first powered on, it will do what’s known as a gratuitous ARP and automatically ARP out it’s MAC
address to the entire network. This allows any switches to know the location of the physical devices and
DHCP servers to know where to send an IP address if needed and requested. Gratuitous ARP is also used
by many high availability routing and load balancing devices. Routers or load balancers are often
configured in an HA (high availability) pair to provide optimum reliability and maximum uptime. Usually
these devices will be configured in an Active/Standby pair. One device will be active while the second will
be sleeping waiting for the active device to fail. Think of it as an understudy for the lead role in a movie. If
the leading lady gets sick, the understudy will gladly and quickly take her place in the lime light.
When a failure occurs, the standby device will assert itself as the new active device and issue a gratuitous
ARP out to the network instructing all other devices to send traffic to it’s MAC address instead of the failed
device.