2.1 channel allocation 2.2 multiple access...

17
Computer Network NCS-601 EDITED BY: PAWAN PANDEY UNIT-2 2.1 CHANNEL ALLOCATION 2.2 MULTIPLE ACCESS PROTOCOLS 2.2.1 Pure ALOHA 2.2.2 Slotted ALOHA 2.2.3 Carrier Sense Multiple Access 2.2.4 CSMA with Collision Detection 2.2.5 Collision Free Protocols 2.2.5.1 A Bit Map Protocol 2.2.5.2 Binary Countdown 2.3 FDDI 2.4 DATA LINK LAYER DESIGN ISSUES 2.5 FRAMING & STUFFING 2.5.1 Character Count 2.5.2 Character Stuffing 2.5.3 Bit Stuffing 2.5.4 Physical layer coding violations 2.6 ELEMENTARY DATA LINK PROTOCOL 2.6.1 Unrestricted Simplex Protocol 2.6.2 Simplex stop-and-wait Protocol 2.6.3 A simplex protocol for a noisy channel 2.7 SLIDING WINDOW PROTOCOL (Windowing) 2.7.1 1-bit Sliding Window 2.7.2 Go back N Protocol 2.7.3 Selective repeat Protocol 2.8 ERROR DETECTION 2.8.1 Simple Parity check 28.2 Two-dimensional Parity check 2.8.3 Checksum 2.8.4 Cyclic redundancy check 2.9 ERROR CORRECTION (Single Bit)

Upload: others

Post on 24-Apr-2020

10 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: 2.1 CHANNEL ALLOCATION 2.2 MULTIPLE ACCESS PROTOCOLSpclsoft.weebly.com/uploads/2/9/8/3/298350/cn_unit_2.pdf · 2.6 ELEMENTARY DATA LINK PROTOCOL: 2.6.1 Unrestricted Simplex Protocol

Computer Network NCS-601

EDITED BY: PAWAN PANDEY

UNIT-2

2.1 CHANNEL ALLOCATION

2.2 MULTIPLE ACCESS PROTOCOLS

2.2.1 Pure ALOHA

2.2.2 Slotted ALOHA

2.2.3 Carrier Sense Multiple Access

2.2.4 CSMA with Collision Detection

2.2.5 Collision Free Protocols

2.2.5.1 A Bit Map Protocol

2.2.5.2 Binary Countdown

2.3 FDDI

2.4 DATA LINK LAYER DESIGN ISSUES

2.5 FRAMING & STUFFING

2.5.1 Character Count

2.5.2 Character Stuffing

2.5.3 Bit Stuffing

2.5.4 Physical layer coding violations

2.6 ELEMENTARY DATA LINK PROTOCOL

2.6.1 Unrestricted Simplex Protocol

2.6.2 Simplex stop-and-wait Protocol

2.6.3 A simplex protocol for a noisy channel

2.7 SLIDING WINDOW PROTOCOL (Windowing)

2.7.1 1-bit Sliding Window

2.7.2 Go back N Protocol

2.7.3 Selective repeat Protocol

2.8 ERROR DETECTION

2.8.1 Simple Parity check

28.2 Two-dimensional Parity check

2.8.3 Checksum

2.8.4 Cyclic redundancy check

2.9 ERROR CORRECTION (Single Bit)

Page 2: 2.1 CHANNEL ALLOCATION 2.2 MULTIPLE ACCESS PROTOCOLSpclsoft.weebly.com/uploads/2/9/8/3/298350/cn_unit_2.pdf · 2.6 ELEMENTARY DATA LINK PROTOCOL: 2.6.1 Unrestricted Simplex Protocol

Computer Network NCS-601

EDITED BY: PAWAN PANDEY

2.1 CHANNEL ALLOCATION:

It means how to allocate a multi access channel among competing users. In other words, we need a set of rules (i.e. a protocol) to allow each user to communicate and avoid interference. A central

controller interrogates each host and allocates channel capacity to those who need it called polling.

With a static channel allocation approach, the channel's capacity is essentially divided into fixed

portions; each user is then allocated a portion for all time. If the user has no traffic to use in its portion,

then it goes unused. A static allocation performs better when the traffic is predictable

With a dynamic channel allocation approach the allocation of the channel changes based on the

traffic generated by the users. A dynamic channel allocation tries to get better utilization and lower delay

on a channel when the traffic is unpredictable. Dynamic Channel Allocation in LANs and MANs

1. Station Model: N stations.

2. Single Channel Assumption: all stations can transmit on it and all can receive from it;

3. Collision Assumption: two frames simultaneously sent in overlapped time.

4. (a) Continuous Time.

(b) Slotted Time.

5. (a) Carrier Sense.

(b) No Carrier Sense

2.2 MULTIPLE ACCESS PROTOCOLS:

2.2.1 Pure ALOHA:

a) Whenever a user has a frame to send, it simply transmits the

frame.

b) If collision occurs, it waits for a random period of time and

re-sends it again.

c) effective maximum channel utilization is 18%

2.2.2 Slotted ALOHA:

a) time is divided into slots of equal length greater or equal to average frame duration .

b) frame transmission can only start at beginning of a time slot.

c) collision destroys only those packets transmitted at the

beginning of a slot.

d) increased transmission delay on a lightly loaded network due

to wait for slot.

e) effective maximum channel utilization is 37%.

Page 3: 2.1 CHANNEL ALLOCATION 2.2 MULTIPLE ACCESS PROTOCOLSpclsoft.weebly.com/uploads/2/9/8/3/298350/cn_unit_2.pdf · 2.6 ELEMENTARY DATA LINK PROTOCOL: 2.6.1 Unrestricted Simplex Protocol

Computer Network NCS-601

EDITED BY: PAWAN PANDEY

2.2.3 Carrier Sense Multiple Access:

a) A user wishing to transmit first listens to the medium to see if another transmission is in progress

(carrier sense) If the channel is in use, it must wait. If the medium is idle, it may transmit.

b) 1-Persistent: station transmits with the probability of 1 when it finds the channel idle. Effective

maximum channel utilization is 53% for P=1.0.

c) Non Persistent: station does not continuously sense the channel. When the channel is busy, it

waits for a random period of time before trying to listen again. This is less greedy. Effective

maximum channel utilization approaches 100%.

d) P-Persistent: station transmits with the probability of P when it finds the channel idle.

e) Detection or sensing delay is determined by receiver hardware: a small detection time means that

a user can detect a free channel rapidly.

f) CSMA is effective for LANs, where propagation delay is usually very small compared with

frame transmission.

2.2.4 CSMA with Collision Detection:

a) non-persistent

b) station listens before transmitting

c) station aborts transmission when a collision is detected

d) Collisions can be detected by looking at the power or pulse width of the received signal and

comparing it to the transmitted signal.

e) transmitter waits a random amount of time after a collision

f) effective maximum channel utilization

g) used in Ethernet

Page 4: 2.1 CHANNEL ALLOCATION 2.2 MULTIPLE ACCESS PROTOCOLSpclsoft.weebly.com/uploads/2/9/8/3/298350/cn_unit_2.pdf · 2.6 ELEMENTARY DATA LINK PROTOCOL: 2.6.1 Unrestricted Simplex Protocol

Computer Network NCS-601

EDITED BY: PAWAN PANDEY

COMPARISON OF THE CHANNEL UTILIZATION:

2.2.5 Collision Free Protocols:

2.2.5.1 A Bit Map Protocol:

a) Contention and data transmission periods alternate.

b) The contention period is divided into slots, with 1 bitwide slot for each host on the network .

c) If a host wants to transmit a packet, it sets its contention slot equal to 1. Otherwise it sets it to

zero.

d) The slots pass all hosts in sequence so every host is aware of who will transmit.

2.2.5.2 Binary Countdown:

a) Higher numbered stations have a higher priority than lower numbered stations.

b) Has a contention period and a broadcast period.

c) During the contention period – each host broadcasts its binary address one bit at a time, starting

with the most significant bit – bits transmitted simultaneously are Boolean OR’d.

d) Arbitration Rule: – If a hosts sends a 0 bit but the OR results in a 1, the host gives up – The last

host remaining wins the right to broadcast.

Page 5: 2.1 CHANNEL ALLOCATION 2.2 MULTIPLE ACCESS PROTOCOLSpclsoft.weebly.com/uploads/2/9/8/3/298350/cn_unit_2.pdf · 2.6 ELEMENTARY DATA LINK PROTOCOL: 2.6.1 Unrestricted Simplex Protocol

Computer Network NCS-601

EDITED BY: PAWAN PANDEY

e) Stations with the highest addresses will always win.

f) This is good if you wish to implement priority, but bad if you want to give all hosts fair access to

the channel.

g) After host A successfully transmits, all hosts with addresses less than host A add one to their

address, improving their priority.

h) Host A changes its address to zero, giving it the lowest priority.

2.3 FDDI:

FDDI (Fiber Distributed Data Interface) is a set of ANSI and ISO standards for data transmission

on fiber optic lines in a local area network (LAN) that can extend in range up to 200 km (124 miles). The

FDDI protocol is based on the token ring protocol. In addition to being large geographically, an FDDI

local area network can support thousands of users. FDDI is frequently used on the backbone for a wide

area network (WAN).

Page 6: 2.1 CHANNEL ALLOCATION 2.2 MULTIPLE ACCESS PROTOCOLSpclsoft.weebly.com/uploads/2/9/8/3/298350/cn_unit_2.pdf · 2.6 ELEMENTARY DATA LINK PROTOCOL: 2.6.1 Unrestricted Simplex Protocol

Computer Network NCS-601

EDITED BY: PAWAN PANDEY

2.4 DATA LINK LAYER DESIGN ISSUES:

a) Services provided to the Network Layer

i. Unacknowledged Connection less Service

ii. Acknowledged Connection less Service

iii. Acknowledged Connection Oriented Service

b) Framing

c) Error Control

d) Flow Control

2.5 FRAMING & STUFFING:

Since the physical layer merely accepts and transmits a stream of bits without any regard to meaning

or structure, it is upto the data link layer to create and recognize frame boundaries. This can be

accomplished by attaching special bit patterns to the beginning and end of the frame. If these bit patterns

can accidentally occur in data, special care must be taken to make sure these patterns are not incorrectly

interpreted as frame delimiters. The four framing methods that are widely used are

Character count

Starting and ending characters, with character stuffing

Starting and ending flags, with bit stuffing

Physical layer coding violations

2.5.1 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.

Page 7: 2.1 CHANNEL ALLOCATION 2.2 MULTIPLE ACCESS PROTOCOLSpclsoft.weebly.com/uploads/2/9/8/3/298350/cn_unit_2.pdf · 2.6 ELEMENTARY DATA LINK PROTOCOL: 2.6.1 Unrestricted Simplex Protocol

Computer Network NCS-601

EDITED BY: PAWAN PANDEY

2.5.2 Character Stuffing:

Each frame starts with special start and end bytes (flag bytes). Here will imagine it as same byte,

FLAG. After error, can always find start of next frame.

2.5.3 Bit Stuffing:

a) Byte stuffing specifies char format (e.g. 8 bits per char).

b) To allow arbitrary no. of bits per char, use stuffing at bit-level rather than at byte-level.

c) Each frame begins and ends with bit pattern 01111110 (6 1's)

d) If 5 1's in a row in data, stuff a 0 in so will never be 6 in a row.

e) Stuff it in always - whether the next char was going to be a 1 or not.

f) De-stuffer removes the 0's after any 5 1's.

2.5.4 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.

Page 8: 2.1 CHANNEL ALLOCATION 2.2 MULTIPLE ACCESS PROTOCOLSpclsoft.weebly.com/uploads/2/9/8/3/298350/cn_unit_2.pdf · 2.6 ELEMENTARY DATA LINK PROTOCOL: 2.6.1 Unrestricted Simplex Protocol

Computer Network NCS-601

EDITED BY: PAWAN PANDEY

2.6 ELEMENTARY DATA LINK PROTOCOL:

2.6.1 Unrestricted Simplex Protocol

a) data transmission in one direction only (simplex)

b) no errors take place on the physical channel

c) the sender/receiver can generate/consume an infinite amount of data.

d) always ready for sending/receiving

2.6.2 Simplex stop-and-wait Protocol

a) Drop assumption that receiver can process incoming data infinitely fast

b) stop-and-wait--protocols where the sender sends one frame and then waits for acknowledgement.

c) In this protocol, the contents of the acknowledgement frame are unimportant.

d) Data transmission is one directional, but must have bidirectional line. Could have a half-duplex

(one direction at a time) physical channel.

Page 9: 2.1 CHANNEL ALLOCATION 2.2 MULTIPLE ACCESS PROTOCOLSpclsoft.weebly.com/uploads/2/9/8/3/298350/cn_unit_2.pdf · 2.6 ELEMENTARY DATA LINK PROTOCOL: 2.6.1 Unrestricted Simplex Protocol

Computer Network NCS-601

EDITED BY: PAWAN PANDEY

2.6.3 A simplex protocol for a noisy channel

a) What if the channel is noisy and we can lose frames (checksum incorrect).

b) Simple approach, add a time out to the sender so it retransmits after a certain period and

retransmit the frame.

c) Scenario of what could happen:

A transmits frame one

B receives A1

B generates ACK

ACK is lost

A times out, retransmits

B gets duplicate copy (sending on to network layer)

d) Use a sequence number. How many bits? 1-bit is sufficient because only concerned about two

successive frames.

e) Positive Acknowledgement with Retransmission (PAR)--sender waits for positive

acknowledgement before advancing to the next data item.

Page 10: 2.1 CHANNEL ALLOCATION 2.2 MULTIPLE ACCESS PROTOCOLSpclsoft.weebly.com/uploads/2/9/8/3/298350/cn_unit_2.pdf · 2.6 ELEMENTARY DATA LINK PROTOCOL: 2.6.1 Unrestricted Simplex Protocol

Computer Network NCS-601

EDITED BY: PAWAN PANDEY

2.7 SLIDING WINDOW PROTOCOL (Windowing):

Sliding window is a technique for controlling transmitted data packets between two network

computers where reliable and sequential delivery of data packets is required, such as when using the Data

Link Layer (OSI model) or Transmission Control Protocol (TCP).

In the sliding window technique, each data packet (for most data link layers) and byte (in TCP)

includes a unique consecutive sequence number, which is used by the receiving computer to place data in

the correct order. The objective of the sliding window technique is to use the sequence numbers to avoid

duplicate data and to request missing data.

It uses the concept of piggybacking. Instead of sending ack frame on its own, if there is an

outgoing data frame in the next short interval, attach the ack to it (using "ack" field in header).

Sliding window size 1. Sequence nos. 0 to 7.

(a) At start. Receiver waits for 0.

(b) Sender sends 0.

(c) Receiver receives 0. Waits for 1.

(d) Sender got ack for 0.

Page 11: 2.1 CHANNEL ALLOCATION 2.2 MULTIPLE ACCESS PROTOCOLSpclsoft.weebly.com/uploads/2/9/8/3/298350/cn_unit_2.pdf · 2.6 ELEMENTARY DATA LINK PROTOCOL: 2.6.1 Unrestricted Simplex Protocol

Computer Network NCS-601

EDITED BY: PAWAN PANDEY

2.7.1 1-bit Sliding Window:

(a) Normal Case:

Notation (seq, ack, packet)

Asterisk (*) – delivered to Network layer.

(b) Abnormal Case:

Page 12: 2.1 CHANNEL ALLOCATION 2.2 MULTIPLE ACCESS PROTOCOLSpclsoft.weebly.com/uploads/2/9/8/3/298350/cn_unit_2.pdf · 2.6 ELEMENTARY DATA LINK PROTOCOL: 2.6.1 Unrestricted Simplex Protocol

Computer Network NCS-601

EDITED BY: PAWAN PANDEY

2.7.2 Go back N Protocol:

a) Receiver B window size = 1

b) Discard all frames after error

c) No ack - they will eventually get re-sent

d) Can be lot of re-sends

e) Wastes lot of bandwidth if error rate high.

Page 13: 2.1 CHANNEL ALLOCATION 2.2 MULTIPLE ACCESS PROTOCOLSpclsoft.weebly.com/uploads/2/9/8/3/298350/cn_unit_2.pdf · 2.6 ELEMENTARY DATA LINK PROTOCOL: 2.6.1 Unrestricted Simplex Protocol

Computer Network NCS-601

EDITED BY: PAWAN PANDEY

2.7.3 Selective repeat Protocol:

a) Receiver B window size = n

b) Good frames after error are buffered (because can't send them to Network Layer NB yet, can't get

rid of them)

c) Bad frame 2 times out and is re-sent.

d) At a timeout, sender A only sends the oldest un-ack-ed frame, not a sequence.

e) Or (in figure) B sends a Negative Ack (NAK) to provoke a re-send of frame 2 instead of waiting

for timeout - may improve performance. If you know it will timeout, why wait?

f) Notice B doesn't ack 3-5 while it is buffering them.

g) It sends back "Ack 1" which means "Everything ok up to and including 1".

h) Once 2 gets through, B can send a whole bunch (2-5) to NB layer and can then jump to "Ack 5"

("Everything ok up to and including 5")

2.8 ERROR DETECTION:

Single-bit error means that only one bit of given data unit (such as a byte, character, or data unit)

is changed from 1 to 0 or from 0 to 1

Burst error means that two or more bits in the data unit have changed from 0 to 1 or vice-versa.

There are four types of Error Detecting Codes: Simple Parity check, Two-dimensional Parity

check, Checksum and Cyclic redundancy check.

2.8.1 Simple Parity check

a) Commonly used technique for detecting a single flip • Define the parity of a bit string w

as the parity (even or odd) of the number of 1’s in the binary representation of w.

b) If there are an even number of flips in transmission, the receiver gets a bit string with

even parity

Page 14: 2.1 CHANNEL ALLOCATION 2.2 MULTIPLE ACCESS PROTOCOLSpclsoft.weebly.com/uploads/2/9/8/3/298350/cn_unit_2.pdf · 2.6 ELEMENTARY DATA LINK PROTOCOL: 2.6.1 Unrestricted Simplex Protocol

Computer Network NCS-601

EDITED BY: PAWAN PANDEY

c) If there are an odd number of flips in transmission, the receiver gets a bit string with odd

parity

d) Thus errors in more than one bit cannot be detected.

2.8.2 Two-dimensional Parity check

a) Assume each block of data to be encoded consists of mn bits

b) View these bits as being arranged in an m × n array (in row-major order, say)

c) Compute m + n + 1 parity bits (One for each row, one for each column, and one for the

whole message)

d) Send mn + m + n + 1 bits (in some fixed order)

a) If two bits in one data unit are damaged and two bits in exactly same position in another data

unit are also damaged, the 2-D Parity check checker will not detect an error. For example, if

two data units: 11001100 and 10101100. If first and second from last bits in each of them is

changed, making the data units as 01001110 and 00101110, the error cannot be detected by

2-D Parity check.

Page 15: 2.1 CHANNEL ALLOCATION 2.2 MULTIPLE ACCESS PROTOCOLSpclsoft.weebly.com/uploads/2/9/8/3/298350/cn_unit_2.pdf · 2.6 ELEMENTARY DATA LINK PROTOCOL: 2.6.1 Unrestricted Simplex Protocol

Computer Network NCS-601

EDITED BY: PAWAN PANDEY

2.8.3 Checksum

2.8.4 Cyclic redundancy check:

If a k bit message is to be transmitted, the transmitter generates an r-bit sequence, known as Frame

Check Sequence (FCS) so that the (k+r) bits are actually being transmitted. Now this r-bit FCS is

generated by dividing the original number, appended by r zeros, by a predetermined number. This

number, which is (r+1) bit in length, can also be considered as the coefficients of a polynomial,

called Generator Polynomial. The remainder of this division process generates the r-bit FCS. On

receiving the packet, the receiver divides the (k+r) bit (use modulo two subtractions only ) frame

by the same predetermined number and if it produces no remainder, it can be assumed that no error

has occurred during the transmission.

Page 16: 2.1 CHANNEL ALLOCATION 2.2 MULTIPLE ACCESS PROTOCOLSpclsoft.weebly.com/uploads/2/9/8/3/298350/cn_unit_2.pdf · 2.6 ELEMENTARY DATA LINK PROTOCOL: 2.6.1 Unrestricted Simplex Protocol

Computer Network NCS-601

EDITED BY: PAWAN PANDEY

2.9 ERROR CORRECTION (Single Bit):

Error Correction can be handled in two ways. One is when an error is discovered; the

receiver can have the sender retransmit the entire data unit. This is known as backward error

correction. In the other, receiver can use an error-correcting code, which automatically corrects

certain errors. This is known as forward error correction.

Basic approach for error detection by using Hamming code is as follows:

a) To each group of m information bits k parity bits are added to form (m+k) bit code as shown

in Figure

b) Location of each of the (m+k) digits is assigned a decimal value.

Page 17: 2.1 CHANNEL ALLOCATION 2.2 MULTIPLE ACCESS PROTOCOLSpclsoft.weebly.com/uploads/2/9/8/3/298350/cn_unit_2.pdf · 2.6 ELEMENTARY DATA LINK PROTOCOL: 2.6.1 Unrestricted Simplex Protocol

Computer Network NCS-601

EDITED BY: PAWAN PANDEY

c) The k parity bits are placed in positions 1, 2, …, 2k-1 positions.–K parity checks are

performed on selected digits of each codeword.

d) At the receiving end the parity bits are recalculated. The decimal value of the k parity bits

provides the bit-position in error, if any.