SlideShare a Scribd company logo
1 of 48
Download to read offline
Computer Networks
   Data Link Layer

            By
  Md. Abdullah al mamun
       Sr. Lecturer
Data Link Layer

• Provides a well-defined service interface to the
  network layer.
• Determines how the bits of the physical layer
  are grouped into frames (framing).
• Deals with transmission errors (CRC and ARQ).
• Regulates the flow of frames.
• Performs general link layer management.

                     Data Link Layer             2
Data Link Layer: Introduction
                                                “link”
Terminology:
•   Hosts and routers/ bridges/
    switches are nodes
•   Communication channels that
    connect adjacent nodes along
    communication path are links, e.g.:
     – Wired links
     – Wireless links
     – LANs
•   2-PDU is a frame, encapsulates
    datagram

    Data-link layer has the responsibility of
    transferring datagram from one node
    to adjacent node over a link
                                                         3
Data Link Layer Services (1)
• Datagram transferred by different link protocols over
  different links:
   – Ethernet, FDDI,802.11, etc
   – Different protocols  different services
• Framing, link access:
   – Encapsulate datagram into frame, adding header, trailer
   – Channel access if shared medium
   – Physical addresses used in frame headers to identify source,
     destination
• Reliable delivery between adjacent nodes
   – Rarely used on low bit error link (e.g., fiber)
   – Essential in links with high error rates
       • e.g., wireless


                                                                    4
Link Layer Services (2)
• Flow Control:
   – Pacing between adjacent sending and receiving nodes
• Error Detection:
   – Errors are caused by signal attenuation, noise.
   – Receiver detects presence of errors
       • Either signals sender for retransmission or drops frame
• Error Correction:
   – Receiver identifies and corrects bit error(s) without resorting to
     retransmission
   – Recovery depends on the encoding scheme
• Half-duplex and full-duplex
   – Half duplex  nodes at both ends of link can transmit, but not at
     same time


                                                                          5
Adaptors Communicating
                   datagram
                               link layer protocol
sending                                                                 receiving
   node                                                                 node
                   frame                             frame
                   adapter                           adapter

 • Link layer implemented in            • Receiving side
   network “adapter”                        – Looks for errors, flow control,
     – Ethernet card, PCMCI card,             etc
       802.11 card, …                       – Extracts datagram, passes to
 • Sending side:                              receiving node
     – Encapsulates datagram in a       • Adapter is semi-
       frame
     – Adds error checking bits, flow     autonomous link & physical
       control, etc.                      layers

                                                                                6
Error Detection




• EDC: Error Detection and Correction bits (redundancy)
• D: Data protected by error checking,
   – May include header fields
• Note: Error detection not 100% reliable!
   – Depends on the encoding
   – Larger EDC  better error detection/correction capabilities
       • Plus more overhead!
                                                                   7
Parity Checking
Single Bit Parity:         Two Dimensional Bit Parity:
Detect single bit errors   Detect and correct single bit errors




                                0               0



                                                                  8
CRC: Cyclic Redundancy Check



• View data bits, D, as a binary number
• Choose r+1 bit pattern (generator), G
• Goal: Choose r CRC bits, R, such that
   – <D,R> exactly divisible by G (modulo 2)
   – Receiver knows G, divides <D,R> by G.
       • If non-zero remainder  error detected
• CRC can detect all burst errors less than r+1 bits
• Very practical, e.g., ATM, HDCL
                                                       9
CRC Example
Want:
  D.2r XOR R = nG
D.2r = nG XOR R
 Divide D.2r by G & take
 the remainder R




                              10
Packets                               Packets

(a)        Data link                                Data link
            Layer                 Frames             Layer
      A                                                          B
           Physical                                 Physical
            Layer                                    Layer




(b)

          12     3       21                     12      3       21
                                 Medium
                                                        2
                         A                      B       1


           1      Physical layer entity
                                            3    Network layer entity
           2 Data link layer entity
                                                                     Figure 5.2


                          Data Link Layer                                11
End to End
                                               ACK/NAK




             1                         2                    3                         4               5

                      Data                  Data                     Data                   Data


                                                   Hop by Hop



                      Data                  Data                     Data                   Data
             1                         2                    3                         4               5
                      ACK/                  ACK/                   ACK/                     ACK
                      NAK                   NAK                    NAK                      /NA
                                                                                             K     Figure 5.7
Copyright ©2000 The McGraw Hill Companies
                                                   Data Link Layer                                     12
                                            Leon-Garcia & Widjaja: Communication Networks
Basic Elements of ARQ
                                                     Information                              Error-free
              Packet
                                                       frames                                   packet
             sequence
                                                                                               sequence
                             Transmitter                                      Receiver

                              Station A            Control                    Station B
                                                   frames




               CRC
                                                                                 CRC          Header
                     Information Header
                                                                                       Control frame
                        packet
                  Information Frame
Copyright ©2000 The McGraw Hill Companies     Leon-Garcia & Widjaja: Communication Networks            Figure 5.8


                                                     Data Link Layer                                          13
packet

network layer     buffer


                                      frame

data link layer    info                 ack   seq   kind




physical layer



                    Data Link Layer                        14
Ambiguities with Stop-and-Wait
                               [unnumbered frames]
            (a) Frame 1 lost                             Time-out
                                                                                                       time
                       A          frame              frame                   frame            frame
                                     0                  1                       1                2
                                       ACK                                        ACK
                       B

           (b) ACK lost                                   Time-out
                                                                                                        time
                       A           frame              frame                   frame           frame
                                      0                  1                       1               2
                                        ACK                     ACK                     ACK
                       B

                  In parts (a) and (b) transmitting station A acts the same way, but part
                     (b) receiving station B accepts frame 1 twice.
Copyright ©2000 The McGraw Hill Companies   Leon-Garcia & Widjaja: Communication Networks             Figure 5.9
                                                        Data Link Layer

                                                                                                                   15
PAR [OLD] problem
                Ambiguities when ACKs are not numbered

                                time-out
                                                                                            time
                    A          frame
                                  0              frame           frame      frame
                                                    0               1          2
                                    ACK
                                                     ACK
                    B

                        Transmitting station A misinterprets duplicate ACKs




Copyright ©2000 The McGraw Hill Companies   Leon-Garcia & Widjaja: Communication Networks   Figure 5.10


                                                       Data Link Layer                                16
State Machine for Stop-and-Wait
       0    10       10        10      1                              0    10       10         10    1


                       Slast                                                         Rnext
                                            Timer

                                                                        Slast
                       Transmitter                                                    Receiver

                         Station A                  Rnext                             Station B


                                            (0,0)          Error-free frame 0                       (0,1)
                                                           arrives at receiver
           Global State:
                                                                                                         ACK for
            (Slast, Rnext)                       ACK for                                                 frame 0
                                                 frame 1                                                arrives at
                                                arrives at                                             transmitter
                                               transmitter Error-free frame 1
                                                           arrives at receiver
                                            (1,0)                                                   (1,1)
                                               Leon-Garcia & Widjaja: Communication Networks                Figure 5.11
Copyright ©2000 The McGraw Hill Companies


                                                      Data Link Layer                                               17
Sliding Window Protocols
                        [Tanenbaum]

• Must be able to transmit data in both
  directions.
• Choices for utilization of the reverse channel:
  – mix DATA frames with ACK frames.
  – Piggyback the ACK
     • Receiver waits for DATA traffic in the opposite direction.
     • Use the ACK field in the frame header to send sequence
       number of frame being ACKed.
  –  better use of the channel capacity.
                           Data Link Layer                      18
Sliding Window Protocols
• ACKs introduce a new issue – how long does
  receiver wait before sending ONLY an ACK
  frame.
  We need an ACKTimer!!
   sender timeout period needs to set longer.
• The protocol must deal with the premature
  timeout problem and be “robust” under
  pathological conditions.

                    Data Link Layer              19
Sliding Window Protocols
Each outbound frame must contain a sequence number. With n
   bits for the sequence number field, maxseq = 2**n - 1 and
   the numbers range from 0 to maxseq.
Sliding window :: sender has a window of frames and maintains a
   list of consecutive sequence numbers for frames that it is
   permitted to send without waiting for ACKs.
receiver has a window that is a list of frame sequence numbers it
   is permitted to accept.
Note – sending and receiving windows do NOT have to be the
   same size.
Windows can be fixed size or dynamically growing and shrinking.

                           Data Link Layer                     20
Sliding Window Protocols
• Host is oblivious, message order at transport level
  is maintained.
sender’s window :: frames sent but not yet ACKed.
   – new packets from the Host cause the upper
     edge inside sender window to be incremented.
   – ACKed frames from the receiver cause the
     lower edge inside window to be incremented.
• All frames in the sender’s window must be saved
  for possible retransmission and we need one
  timer per frame in the window.
                       Data Link Layer                  21
Sliding Window Protocols
• If the maximum sender window size is B,
  the sender needs B buffers.
• If the sender window gets full (i.e., reaches
  its maximum window size, the protocol
  must shut off the Host (the network layer)
  until buffers become available.
• receiver window
  Frames received with sequence numbers outside
    the receiver window are not accepted.
                    Data Link Layer               22
Sliding Window Protocols
receiver window
  – Frames received with sequence numbers
    outside the receiver window are not accepted.
  – The receiver window size is normally static.
    The set of acceptable sequence numbers is
    rotated as “acceptable” frames arrive.
a receiver window size = 1  the protocol
  only accepts frames in order.
There is referred to as Go Back N.
                     Data Link Layer                23
Standard Ways to ACK


 1. ACK sequence number indicates the
      last frame successfully received.
 2. ACK sequence number indicates the
     next frame the receiver expects to
                  receive.
 Both of these can be strictly individual
  ACKs or represent cumulative ACKing.
Cumulative ACKing is the most common
                 technique.


                 Data Link Layer            24
Go Back N


                Go-Back-4:                         4 frames are outstanding; so go back 4

                  fr    fr   fr    fr       fr   fr    fr       fr   fr   fr   fr   fr    fr       fr               time
                  0     1    2     3        4    5     6        3    4    5    6    7     8        9
       A



      B
                               A    A       A        Out-of-sequence frames
                                                                        A       A     A        A        A   A
                               C    C       C                           C       C     C        C        C   C
                               K    K       K                           K       K     K        K        K   K
                               1    2       3    error                  4       5     6        7        8   9


                                                 ACKing next frame expected
Copyright ©2000 The McGraw Hill Companies         Leon-Garcia & Widjaja: Communication Networks                 Figure 5.13



                                                            Data Link Layer                                             25
Go Back N
                                   with NAK error recovery
                                                            Transmitter goes back to frame 1

                Go-Back-7:

                   fr    fr   fr   fr       fr   fr    fr      fr   fr   fr    fr   fr   fr   fr        time
                   0     1    2    3        4    5     1       2    3    4     5
     A                                                                              6    7    0




    B
                               A            N          Out-of-      A      A    A    A    A    A
                               C            A         sequence      C      C    C    C    C    C
                               K            K          frames       K      K    K    K    K    K
                               1            1                       2      3    4    5    6    7


                                   error
Copyright ©2000 The McGraw Hill Companies
                                                                                                   Figure 5.17


                                                         Data Link Layer                                   26
Selective Repeat
                                 with NAK error recovery


              fr     fr   fr   fr    fr     fr    fr     fr   fr    fr    fr    fr fr fr             time
              0      1    2    3     4      5     6      2    7     8     9
    A                                                                           10 11 12




   B
                          A     A            N     A     A    A       A     A    A     A    A    A
                          C     C            A     C     C    C       C     C    C     C    C    C
                          K     K            K     K     K    K       K     K    K     K    K    K
                          1     2            2     2     2    2       7     8    9     1    1    1
                                     error                                             0    1    2


Copyright ©2000 The McGraw Hill Companies        Leon-Garcia & Widjaja: Communication Networks       Figure 5.21



                                                        Data Link Layer                                      27
Multiple Access Links and Protocols
• Link types:
   – Point-to-point, e.g.:
      • PPP for dial-up access
      • Point-to-point link between Ethernet switch and host
   – Broadcast (shared wire or medium), e.g.:
      • traditional Ethernet
      • 802.11 wireless LAN




                                                               28
Multiple Access Protocols
• Single shared broadcast channel
• Simultaneous transmissions  interference
    only one node can send successfully at a time
• Multiple access protocol:
  A distributed algorithm that determines how nodes
  share channel, i.e., determine when node can
  transmit.
• Note: Communication about channel sharing must
  use channel itself!

                                                      29
Protocol Requirements
• Assume broadcast channel of R bps
• Requirements:
  – When one node wants to transmit, it can send at rate R.
  – When M nodes want to transmit, each can send at average
    rate R/M
  – Fully decentralized:
     • no special node to coordinate transmissions
     • no synchronization of clocks, slots
  – Simple
      cheap to implement


                                                         30
Taxonomy of MAC Protocols
• Channel Partitioning
  – Divide channel into smaller “pieces”
     • time slots
     • frequency
     • code
  – Allocate piece to node for exclusive use
• Random Access
  – Channel not divided, allow collisions
  – Handle collisions
• Turn-taking
  – Tightly coordinate shared access to avoid collisions

                                                           31
Channel Partitioning: TDMA
• TDMA: Time Division Multiple Access
  – Slice bandwidth into time slots
  – Each station gets fixed length slot (length = packet
    transmission time) in each round
  – Unused slots go idle
• Example:
  – 6-station LAN,
  – 1,3,4 have pkt, slots 2,5,6 idle:




                                                           32
Channel Partitioning: FDMA
• FDMA: Frequency Division Multiple Access
   – Channel spectrum divided into frequency bands
   – Each station assigned fixed frequency band
   – Unused transmission time in frequency bands go idle
• Example:
   – 6-station LAN,
   – 1,3,4 have pkt, frequency bands 2,5,6 idle
                frequency bands




                                                           33
Channel Partitioning: CDMA
• Used mostly in wireless broadcast channels
   – cellular, satellite, etc
• CDMA: Code Division Multiple Access)
   – All users share same frequency, but
   – each user has own “chipping” sequence (code) to encode data
   – Allows multiple users to transmit simultaneously with minimal
     interference
• Encoding:
   – signal = (original data) X (chipping sequence)
• Decoding:
   – inner-product of encoded signal and chipping sequence


                                                                     34
CDMA Encoding/Decoding




                         35
CDMA: Handling Interference




                              36
Random Access Protocols
• When node has packet to send:
   – Transmits at full channel data rate R
   – with no a priori coordination among nodes
• Two or more transmitting nodes  collision
• Random access MAC protocol specifies:
   – How to detect collisions
   – How to recover from collisions
      • e.g., via delayed retransmissions
• Examples of random access MAC protocols:
   – Slotted ALOHA
   – ALOHA
   – CSMA, CSMA/CD, CSMA/CA


                                                 37
Slotted ALOHA (1)
                                Operation
Assumptions                     • When node obtains fresh
• All frames same size            frame, it transmits in next
• Time is divided into equal      slot
  size slots == time to         • No collision  node can
  transmit 1 frame                send new frame in next
• Nodes start to transmit         slot
  frames only at beginning of
  slots                         • Collision, node retransmits
                                  frame in each subsequent
• Nodes are synchronized
                                  slot with probability p until
• If 2 or more nodes transmit
                                  success
  in slot, all nodes detect
  collision

                                                                  38
Slotted ALOHA (2)




Pros                                   Cons
• Single active node can               • Collisions  wasted slots
   continuously transmit at full       • Idle slots
   rate of channel
                                       • Nodes may be able to detect
• Decentralized:
                                          collision in less than time to
    – only slots in nodes need to be
      in sync                             transmit packet
•   Simple
                                                                           39
Slotted ALOHA Efficiency
Efficiency:long-run                   • Max efficiency:
fraction of successful                  Find p* that maximizes
slots given many nodes
                                             Np(1-p)N-1
with many frames to send
                                      • For many nodes:
Analysis:
• Suppose N nodes with many
  frames to send, each transmits in                      
                                         lim Np * 1  p *  1 / e
                                         N
  slot with probability p
• Probability that 1st node has
  success in a slot:
         p(1-p)N-1                     At best: channel used
                                         At
• Probability that any node has a
  success                              for useful transmissions
         Np(1-p)N-1                    ~37% of time!

                                                                    40
Pure (Unslotted) ALOHA
• Same as slotted but no synchronization:
   – When frame first arrives transmit immediately
    Collision probability increases!




                   Efficiency = 1/(2e)
                                                     41
CSMA: Carrier Sense Multiple Access
• CSMA:
  – Listen before transmit:
     • If channel sensed idle: transmit entire frame
     • If channel sensed busy, defer transmission
• Human analogy
  – Don’t interrupt others!




                                                       42
CSMA Collisions
• Collisions can still occur:
   – propagation delay means
     two nodes may not hear each
     other’s transmission


• On collision:
   – entire packet transmission
     time wasted


• Collision probability
   – depends on propagation
     delay

                                     43
CSMA/CD (Collision Detection)
• CSMA/CD: Carrier sensing, deferral as in CSMA
   – Collisions detected within short time
   – Colliding transmissions aborted
• Collision detection:
   – On wired LANs:
      • measure signal strengths,
      • compare transmitted & received signals
   – On wireless LANs:
      • receiver shut off while transmitting
• Human analogy:
   – the polite conversationalist

                                                  44
CSMA/CD Collision Detection




                              45
Turn-Taking MAC Protocols
• Channel partitioning:
   – High load  efficiently and fair
   – Low load  inefficient
       • 1/N bandwidth allocated even if only 1 active node!
• Random access:
   – Low load  efficient
       • single node can fully utilize channel
   – High load  inefficient
       • collision overhead
• Turn-taking protocols:
   Look for best of both worlds!

                                                               46
“Taking Turns” MAC protocols
Polling:                       Token passing:
• Designated “master”           Control token passed from
  node                           one node to next sequentially.
• Master node invites           Concerns:
  “slave” nodes to                 Token overhead
  transmit
                                   Latency
   – Round robin
                                   Single point of failure (token)
   – Max frames
• Concerns:
   – Polling overhead
   – Latency
   – Single point of failure


                                                                      47
Summary of MAC Protocols
• Sharing of shared media:
   – Channel (static) partitioning
      • by time, frequency, code
      • TDMA, FDMA, CDMA
   – Random (dynamic) partitioning
      •   carrier sensing: collision detection
      •   easy in wire technologies,harder in wireless
      •   ALOHA, S-ALOHA, CSMA, CSMA/CD
      •   CSMA/CD used in Ethernet
   – Turn-Taking
      • polling from a central site
      • token passing

                                                         48

More Related Content

What's hot

What's hot (20)

Content aware p2 p video streaming with lowlatency
Content aware p2 p video streaming with lowlatencyContent aware p2 p video streaming with lowlatency
Content aware p2 p video streaming with lowlatency
 
Chapter 2 point-to-point protocol (ppp)
Chapter 2   point-to-point protocol (ppp)Chapter 2   point-to-point protocol (ppp)
Chapter 2 point-to-point protocol (ppp)
 
Mpls101
Mpls101Mpls101
Mpls101
 
Mpls by vidhu
Mpls by vidhuMpls by vidhu
Mpls by vidhu
 
03 internetworking
03 internetworking03 internetworking
03 internetworking
 
Multi protocol label switching (mpls)
Multi protocol label switching (mpls)Multi protocol label switching (mpls)
Multi protocol label switching (mpls)
 
Rpl dodag
Rpl dodagRpl dodag
Rpl dodag
 
The Network Layer
The Network LayerThe Network Layer
The Network Layer
 
Unit 2
Unit 2Unit 2
Unit 2
 
Network & Internet Working Devices
Network & Internet Working DevicesNetwork & Internet Working Devices
Network & Internet Working Devices
 
Cs8591 Computer Networks
Cs8591 Computer NetworksCs8591 Computer Networks
Cs8591 Computer Networks
 
Cs8591 Computer Networks
Cs8591 Computer NetworksCs8591 Computer Networks
Cs8591 Computer Networks
 
CCNA Report
CCNA ReportCCNA Report
CCNA Report
 
Label Distribution Protocol
Label Distribution ProtocolLabel Distribution Protocol
Label Distribution Protocol
 
Studying_the_TCP_Flow_and_Congestion_Con.pdf
Studying_the_TCP_Flow_and_Congestion_Con.pdfStudying_the_TCP_Flow_and_Congestion_Con.pdf
Studying_the_TCP_Flow_and_Congestion_Con.pdf
 
Ch4 net layer network
Ch4 net layer networkCh4 net layer network
Ch4 net layer network
 
Chapter 5 v6.01
Chapter 5 v6.01Chapter 5 v6.01
Chapter 5 v6.01
 
MPLS Deployment Chapter 1 - Basic
MPLS Deployment Chapter 1 - BasicMPLS Deployment Chapter 1 - Basic
MPLS Deployment Chapter 1 - Basic
 
Networking Concepts Lesson 06 - Protocols - Eric Vanderburg
Networking Concepts Lesson 06 - Protocols - Eric VanderburgNetworking Concepts Lesson 06 - Protocols - Eric Vanderburg
Networking Concepts Lesson 06 - Protocols - Eric Vanderburg
 
Dublin mngmt140120
Dublin mngmt140120Dublin mngmt140120
Dublin mngmt140120
 

Viewers also liked

Introduction to the OSI 7 layer model and Data Link Layer
Introduction to the OSI 7 layer model and Data Link LayerIntroduction to the OSI 7 layer model and Data Link Layer
Introduction to the OSI 7 layer model and Data Link LayerVNIT-ACM Student Chapter
 
Unit 4 data link layer
Unit 4 data link layerUnit 4 data link layer
Unit 4 data link layermekind
 
Network Fundamentals: Ch7 - Data Link Layer
Network Fundamentals: Ch7 - Data Link LayerNetwork Fundamentals: Ch7 - Data Link Layer
Network Fundamentals: Ch7 - Data Link LayerAbdelkhalik Mosa
 
1. Introduction to DBMS
1. Introduction to DBMS1. Introduction to DBMS
1. Introduction to DBMSkoolkampus
 
Introduction to Cloud Computing
Introduction to Cloud Computing Introduction to Cloud Computing
Introduction to Cloud Computing CloudSyntrix
 
Erik maconkeynote
Erik maconkeynoteErik maconkeynote
Erik maconkeynoterobertmack9
 
Using social technologies to engage and empower the workforce - SCN presentat...
Using social technologies to engage and empower the workforce - SCN presentat...Using social technologies to engage and empower the workforce - SCN presentat...
Using social technologies to engage and empower the workforce - SCN presentat...Anna Dreyzin
 
София Ефимова. Cказки
София Ефимова. CказкиСофия Ефимова. Cказки
София Ефимова. Cказкиklepa.ru
 
Armenian Association of Telemedicine Furthers eHealth Research
Armenian Association of Telemedicine Furthers eHealth ResearchArmenian Association of Telemedicine Furthers eHealth Research
Armenian Association of Telemedicine Furthers eHealth ResearchPeter Killcommons
 
แบบนำเสนอโครงงานเรื่องไมโครโพรเซสเซอร์5.4
แบบนำเสนอโครงงานเรื่องไมโครโพรเซสเซอร์5.4แบบนำเสนอโครงงานเรื่องไมโครโพรเซสเซอร์5.4
แบบนำเสนอโครงงานเรื่องไมโครโพรเซสเซอร์5.4pornnapafang
 

Viewers also liked (20)

Introduction to the OSI 7 layer model and Data Link Layer
Introduction to the OSI 7 layer model and Data Link LayerIntroduction to the OSI 7 layer model and Data Link Layer
Introduction to the OSI 7 layer model and Data Link Layer
 
DBMS an Example
DBMS an ExampleDBMS an Example
DBMS an Example
 
Unit 4 data link layer
Unit 4 data link layerUnit 4 data link layer
Unit 4 data link layer
 
Network Fundamentals: Ch7 - Data Link Layer
Network Fundamentals: Ch7 - Data Link LayerNetwork Fundamentals: Ch7 - Data Link Layer
Network Fundamentals: Ch7 - Data Link Layer
 
Data link layer
Data link layer Data link layer
Data link layer
 
1. Introduction to DBMS
1. Introduction to DBMS1. Introduction to DBMS
1. Introduction to DBMS
 
Dbms models
Dbms modelsDbms models
Dbms models
 
Dbms
DbmsDbms
Dbms
 
Data Base Management System
Data Base Management SystemData Base Management System
Data Base Management System
 
Introduction to Cloud Computing
Introduction to Cloud Computing Introduction to Cloud Computing
Introduction to Cloud Computing
 
Erik maconkeynote
Erik maconkeynoteErik maconkeynote
Erik maconkeynote
 
Presentatie1
Presentatie1Presentatie1
Presentatie1
 
Shadow the hedgehog
Shadow the hedgehogShadow the hedgehog
Shadow the hedgehog
 
8 filter
8 filter8 filter
8 filter
 
Using social technologies to engage and empower the workforce - SCN presentat...
Using social technologies to engage and empower the workforce - SCN presentat...Using social technologies to engage and empower the workforce - SCN presentat...
Using social technologies to engage and empower the workforce - SCN presentat...
 
Victus dosya 1
Victus dosya 1Victus dosya 1
Victus dosya 1
 
София Ефимова. Cказки
София Ефимова. CказкиСофия Ефимова. Cказки
София Ефимова. Cказки
 
Armenian Association of Telemedicine Furthers eHealth Research
Armenian Association of Telemedicine Furthers eHealth ResearchArmenian Association of Telemedicine Furthers eHealth Research
Armenian Association of Telemedicine Furthers eHealth Research
 
แบบนำเสนอโครงงานเรื่องไมโครโพรเซสเซอร์5.4
แบบนำเสนอโครงงานเรื่องไมโครโพรเซสเซอร์5.4แบบนำเสนอโครงงานเรื่องไมโครโพรเซสเซอร์5.4
แบบนำเสนอโครงงานเรื่องไมโครโพรเซสเซอร์5.4
 
Ticfinal
TicfinalTicfinal
Ticfinal
 

Similar to Networking lecture 4 Data Link Layer by Mamun sir

Basic networking 07-2012
Basic networking 07-2012Basic networking 07-2012
Basic networking 07-2012Samuel Dratwa
 
Computer Network Notes UNIT II
Computer Network Notes UNIT IIComputer Network Notes UNIT II
Computer Network Notes UNIT IINANDINI SHARMA
 
module 2 cn new.pptx
module 2 cn new.pptxmodule 2 cn new.pptx
module 2 cn new.pptxDrPreethiD1
 
Networking lectures unit 2, MCA VII
Networking lectures unit 2, MCA VIINetworking lectures unit 2, MCA VII
Networking lectures unit 2, MCA VIIVasanti Dutta
 
Data Link Layer of OSI Model responsibilities
Data Link Layer of OSI Model responsibilitiesData Link Layer of OSI Model responsibilities
Data Link Layer of OSI Model responsibilitiesHemantPareek21
 
communication system l2
communication system l2communication system l2
communication system l2MR Z
 
CS8591 Computer Networks - Unit II
CS8591 Computer Networks - Unit II CS8591 Computer Networks - Unit II
CS8591 Computer Networks - Unit II pkaviya
 
CN R16 -UNIT-3.pdf
CN R16 -UNIT-3.pdfCN R16 -UNIT-3.pdf
CN R16 -UNIT-3.pdfJoshuaeeda1
 
Report on data link layer
Report on data link layerReport on data link layer
Report on data link layerAlisha Korpal
 
IEEE standards and Data Link Layer Protocol
IEEE standards and Data Link Layer ProtocolIEEE standards and Data Link Layer Protocol
IEEE standards and Data Link Layer ProtocolSajith Ekanayaka
 
Jaimin chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batchJaimin   chp-3 - data-link layer- 2011 batch
Jaimin chp-3 - data-link layer- 2011 batchJaimin Jani
 
Presentation of computer network on data link layer
Presentation of computer network on data link layerPresentation of computer network on data link layer
Presentation of computer network on data link layersumit gyawali
 

Similar to Networking lecture 4 Data Link Layer by Mamun sir (20)

Basic networking 07-2012
Basic networking 07-2012Basic networking 07-2012
Basic networking 07-2012
 
Computer Network Notes UNIT II
Computer Network Notes UNIT IIComputer Network Notes UNIT II
Computer Network Notes UNIT II
 
Gsm protl
Gsm protlGsm protl
Gsm protl
 
module 2 cn new.pptx
module 2 cn new.pptxmodule 2 cn new.pptx
module 2 cn new.pptx
 
unit2-210710110327.pptx
unit2-210710110327.pptxunit2-210710110327.pptx
unit2-210710110327.pptx
 
Networking lectures unit 2, MCA VII
Networking lectures unit 2, MCA VIINetworking lectures unit 2, MCA VII
Networking lectures unit 2, MCA VII
 
Data Link Layer of OSI Model responsibilities
Data Link Layer of OSI Model responsibilitiesData Link Layer of OSI Model responsibilities
Data Link Layer of OSI Model responsibilities
 
Data_Link_Layer.ppt
Data_Link_Layer.pptData_Link_Layer.ppt
Data_Link_Layer.ppt
 
communication system l2
communication system l2communication system l2
communication system l2
 
CS8591 Computer Networks - Unit II
CS8591 Computer Networks - Unit II CS8591 Computer Networks - Unit II
CS8591 Computer Networks - Unit II
 
04ip
04ip04ip
04ip
 
Chapter13
Chapter13Chapter13
Chapter13
 
Chapter4[one.]
Chapter4[one.]Chapter4[one.]
Chapter4[one.]
 
CN R16 -UNIT-3.pdf
CN R16 -UNIT-3.pdfCN R16 -UNIT-3.pdf
CN R16 -UNIT-3.pdf
 
Report on data link layer
Report on data link layerReport on data link layer
Report on data link layer
 
MODULE-2_CCN.pptx
MODULE-2_CCN.pptxMODULE-2_CCN.pptx
MODULE-2_CCN.pptx
 
IEEE standards and Data Link Layer Protocol
IEEE standards and Data Link Layer ProtocolIEEE standards and Data Link Layer Protocol
IEEE standards and Data Link Layer Protocol
 
Jaimin chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batchJaimin   chp-3 - data-link layer- 2011 batch
Jaimin chp-3 - data-link layer- 2011 batch
 
Presentation of computer network on data link layer
Presentation of computer network on data link layerPresentation of computer network on data link layer
Presentation of computer network on data link layer
 
Chp4
Chp4Chp4
Chp4
 

Recently uploaded

Meghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentMeghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentInMediaRes1
 
Capitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitolTechU
 
MARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupMARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupJonathanParaisoCruz
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
 
Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...jaredbarbolino94
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Celine George
 
CELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxCELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxJiesonDelaCerna
 
Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfMahmoud M. Sallam
 
Blooming Together_ Growing a Community Garden Worksheet.docx
Blooming Together_ Growing a Community Garden Worksheet.docxBlooming Together_ Growing a Community Garden Worksheet.docx
Blooming Together_ Growing a Community Garden Worksheet.docxUnboundStockton
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxthorishapillay1
 
Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementmkooblal
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersSabitha Banu
 
Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaVirag Sontakke
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...JhezDiaz1
 

Recently uploaded (20)

Meghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentMeghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media Component
 
Capitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptx
 
MARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupMARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized Group
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 
Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17
 
CELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxCELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptx
 
Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdf
 
Blooming Together_ Growing a Community Garden Worksheet.docx
Blooming Together_ Growing a Community Garden Worksheet.docxBlooming Together_ Growing a Community Garden Worksheet.docx
Blooming Together_ Growing a Community Garden Worksheet.docx
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptx
 
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 
Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of management
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginners
 
Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of India
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
 

Networking lecture 4 Data Link Layer by Mamun sir

  • 1. Computer Networks Data Link Layer By Md. Abdullah al mamun Sr. Lecturer
  • 2. Data Link Layer • Provides a well-defined service interface to the network layer. • Determines how the bits of the physical layer are grouped into frames (framing). • Deals with transmission errors (CRC and ARQ). • Regulates the flow of frames. • Performs general link layer management. Data Link Layer 2
  • 3. Data Link Layer: Introduction “link” Terminology: • Hosts and routers/ bridges/ switches are nodes • Communication channels that connect adjacent nodes along communication path are links, e.g.: – Wired links – Wireless links – LANs • 2-PDU is a frame, encapsulates datagram Data-link layer has the responsibility of transferring datagram from one node to adjacent node over a link 3
  • 4. Data Link Layer Services (1) • Datagram transferred by different link protocols over different links: – Ethernet, FDDI,802.11, etc – Different protocols  different services • Framing, link access: – Encapsulate datagram into frame, adding header, trailer – Channel access if shared medium – Physical addresses used in frame headers to identify source, destination • Reliable delivery between adjacent nodes – Rarely used on low bit error link (e.g., fiber) – Essential in links with high error rates • e.g., wireless 4
  • 5. Link Layer Services (2) • Flow Control: – Pacing between adjacent sending and receiving nodes • Error Detection: – Errors are caused by signal attenuation, noise. – Receiver detects presence of errors • Either signals sender for retransmission or drops frame • Error Correction: – Receiver identifies and corrects bit error(s) without resorting to retransmission – Recovery depends on the encoding scheme • Half-duplex and full-duplex – Half duplex  nodes at both ends of link can transmit, but not at same time 5
  • 6. Adaptors Communicating datagram link layer protocol sending receiving node node frame frame adapter adapter • Link layer implemented in • Receiving side network “adapter” – Looks for errors, flow control, – Ethernet card, PCMCI card, etc 802.11 card, … – Extracts datagram, passes to • Sending side: receiving node – Encapsulates datagram in a • Adapter is semi- frame – Adds error checking bits, flow autonomous link & physical control, etc. layers 6
  • 7. Error Detection • EDC: Error Detection and Correction bits (redundancy) • D: Data protected by error checking, – May include header fields • Note: Error detection not 100% reliable! – Depends on the encoding – Larger EDC  better error detection/correction capabilities • Plus more overhead! 7
  • 8. Parity Checking Single Bit Parity: Two Dimensional Bit Parity: Detect single bit errors Detect and correct single bit errors 0 0 8
  • 9. CRC: Cyclic Redundancy Check • View data bits, D, as a binary number • Choose r+1 bit pattern (generator), G • Goal: Choose r CRC bits, R, such that – <D,R> exactly divisible by G (modulo 2) – Receiver knows G, divides <D,R> by G. • If non-zero remainder  error detected • CRC can detect all burst errors less than r+1 bits • Very practical, e.g., ATM, HDCL 9
  • 10. CRC Example Want: D.2r XOR R = nG D.2r = nG XOR R  Divide D.2r by G & take the remainder R 10
  • 11. Packets Packets (a) Data link Data link Layer Frames Layer A B Physical Physical Layer Layer (b) 12 3 21 12 3 21 Medium 2 A B 1 1 Physical layer entity 3 Network layer entity 2 Data link layer entity Figure 5.2 Data Link Layer 11
  • 12. End to End ACK/NAK 1 2 3 4 5 Data Data Data Data Hop by Hop Data Data Data Data 1 2 3 4 5 ACK/ ACK/ ACK/ ACK NAK NAK NAK /NA K Figure 5.7 Copyright ©2000 The McGraw Hill Companies Data Link Layer 12 Leon-Garcia & Widjaja: Communication Networks
  • 13. Basic Elements of ARQ Information Error-free Packet frames packet sequence sequence Transmitter Receiver Station A Control Station B frames CRC CRC Header Information Header Control frame packet Information Frame Copyright ©2000 The McGraw Hill Companies Leon-Garcia & Widjaja: Communication Networks Figure 5.8 Data Link Layer 13
  • 14. packet network layer buffer frame data link layer info ack seq kind physical layer Data Link Layer 14
  • 15. Ambiguities with Stop-and-Wait [unnumbered frames] (a) Frame 1 lost Time-out time A frame frame frame frame 0 1 1 2 ACK ACK B (b) ACK lost Time-out time A frame frame frame frame 0 1 1 2 ACK ACK ACK B In parts (a) and (b) transmitting station A acts the same way, but part (b) receiving station B accepts frame 1 twice. Copyright ©2000 The McGraw Hill Companies Leon-Garcia & Widjaja: Communication Networks Figure 5.9 Data Link Layer 15
  • 16. PAR [OLD] problem Ambiguities when ACKs are not numbered time-out time A frame 0 frame frame frame 0 1 2 ACK ACK B Transmitting station A misinterprets duplicate ACKs Copyright ©2000 The McGraw Hill Companies Leon-Garcia & Widjaja: Communication Networks Figure 5.10 Data Link Layer 16
  • 17. State Machine for Stop-and-Wait 0 10 10 10 1 0 10 10 10 1 Slast Rnext Timer Slast Transmitter Receiver Station A Rnext Station B (0,0) Error-free frame 0 (0,1) arrives at receiver Global State: ACK for (Slast, Rnext) ACK for frame 0 frame 1 arrives at arrives at transmitter transmitter Error-free frame 1 arrives at receiver (1,0) (1,1) Leon-Garcia & Widjaja: Communication Networks Figure 5.11 Copyright ©2000 The McGraw Hill Companies Data Link Layer 17
  • 18. Sliding Window Protocols [Tanenbaum] • Must be able to transmit data in both directions. • Choices for utilization of the reverse channel: – mix DATA frames with ACK frames. – Piggyback the ACK • Receiver waits for DATA traffic in the opposite direction. • Use the ACK field in the frame header to send sequence number of frame being ACKed. –  better use of the channel capacity. Data Link Layer 18
  • 19. Sliding Window Protocols • ACKs introduce a new issue – how long does receiver wait before sending ONLY an ACK frame. We need an ACKTimer!!  sender timeout period needs to set longer. • The protocol must deal with the premature timeout problem and be “robust” under pathological conditions. Data Link Layer 19
  • 20. Sliding Window Protocols Each outbound frame must contain a sequence number. With n bits for the sequence number field, maxseq = 2**n - 1 and the numbers range from 0 to maxseq. Sliding window :: sender has a window of frames and maintains a list of consecutive sequence numbers for frames that it is permitted to send without waiting for ACKs. receiver has a window that is a list of frame sequence numbers it is permitted to accept. Note – sending and receiving windows do NOT have to be the same size. Windows can be fixed size or dynamically growing and shrinking. Data Link Layer 20
  • 21. Sliding Window Protocols • Host is oblivious, message order at transport level is maintained. sender’s window :: frames sent but not yet ACKed. – new packets from the Host cause the upper edge inside sender window to be incremented. – ACKed frames from the receiver cause the lower edge inside window to be incremented. • All frames in the sender’s window must be saved for possible retransmission and we need one timer per frame in the window. Data Link Layer 21
  • 22. Sliding Window Protocols • If the maximum sender window size is B, the sender needs B buffers. • If the sender window gets full (i.e., reaches its maximum window size, the protocol must shut off the Host (the network layer) until buffers become available. • receiver window Frames received with sequence numbers outside the receiver window are not accepted. Data Link Layer 22
  • 23. Sliding Window Protocols receiver window – Frames received with sequence numbers outside the receiver window are not accepted. – The receiver window size is normally static. The set of acceptable sequence numbers is rotated as “acceptable” frames arrive. a receiver window size = 1  the protocol only accepts frames in order. There is referred to as Go Back N. Data Link Layer 23
  • 24. Standard Ways to ACK 1. ACK sequence number indicates the last frame successfully received. 2. ACK sequence number indicates the next frame the receiver expects to receive. Both of these can be strictly individual ACKs or represent cumulative ACKing. Cumulative ACKing is the most common technique. Data Link Layer 24
  • 25. Go Back N Go-Back-4: 4 frames are outstanding; so go back 4 fr fr fr fr fr fr fr fr fr fr fr fr fr fr time 0 1 2 3 4 5 6 3 4 5 6 7 8 9 A B A A A Out-of-sequence frames A A A A A A C C C C C C C C C K K K K K K K K K 1 2 3 error 4 5 6 7 8 9 ACKing next frame expected Copyright ©2000 The McGraw Hill Companies Leon-Garcia & Widjaja: Communication Networks Figure 5.13 Data Link Layer 25
  • 26. Go Back N with NAK error recovery Transmitter goes back to frame 1 Go-Back-7: fr fr fr fr fr fr fr fr fr fr fr fr fr fr time 0 1 2 3 4 5 1 2 3 4 5 A 6 7 0 B A N Out-of- A A A A A A C A sequence C C C C C C K K frames K K K K K K 1 1 2 3 4 5 6 7 error Copyright ©2000 The McGraw Hill Companies Figure 5.17 Data Link Layer 26
  • 27. Selective Repeat with NAK error recovery fr fr fr fr fr fr fr fr fr fr fr fr fr fr time 0 1 2 3 4 5 6 2 7 8 9 A 10 11 12 B A A N A A A A A A A A A C C A C C C C C C C C C K K K K K K K K K K K K 1 2 2 2 2 2 7 8 9 1 1 1 error 0 1 2 Copyright ©2000 The McGraw Hill Companies Leon-Garcia & Widjaja: Communication Networks Figure 5.21 Data Link Layer 27
  • 28. Multiple Access Links and Protocols • Link types: – Point-to-point, e.g.: • PPP for dial-up access • Point-to-point link between Ethernet switch and host – Broadcast (shared wire or medium), e.g.: • traditional Ethernet • 802.11 wireless LAN 28
  • 29. Multiple Access Protocols • Single shared broadcast channel • Simultaneous transmissions  interference  only one node can send successfully at a time • Multiple access protocol: A distributed algorithm that determines how nodes share channel, i.e., determine when node can transmit. • Note: Communication about channel sharing must use channel itself! 29
  • 30. Protocol Requirements • Assume broadcast channel of R bps • Requirements: – When one node wants to transmit, it can send at rate R. – When M nodes want to transmit, each can send at average rate R/M – Fully decentralized: • no special node to coordinate transmissions • no synchronization of clocks, slots – Simple  cheap to implement 30
  • 31. Taxonomy of MAC Protocols • Channel Partitioning – Divide channel into smaller “pieces” • time slots • frequency • code – Allocate piece to node for exclusive use • Random Access – Channel not divided, allow collisions – Handle collisions • Turn-taking – Tightly coordinate shared access to avoid collisions 31
  • 32. Channel Partitioning: TDMA • TDMA: Time Division Multiple Access – Slice bandwidth into time slots – Each station gets fixed length slot (length = packet transmission time) in each round – Unused slots go idle • Example: – 6-station LAN, – 1,3,4 have pkt, slots 2,5,6 idle: 32
  • 33. Channel Partitioning: FDMA • FDMA: Frequency Division Multiple Access – Channel spectrum divided into frequency bands – Each station assigned fixed frequency band – Unused transmission time in frequency bands go idle • Example: – 6-station LAN, – 1,3,4 have pkt, frequency bands 2,5,6 idle frequency bands 33
  • 34. Channel Partitioning: CDMA • Used mostly in wireless broadcast channels – cellular, satellite, etc • CDMA: Code Division Multiple Access) – All users share same frequency, but – each user has own “chipping” sequence (code) to encode data – Allows multiple users to transmit simultaneously with minimal interference • Encoding: – signal = (original data) X (chipping sequence) • Decoding: – inner-product of encoded signal and chipping sequence 34
  • 37. Random Access Protocols • When node has packet to send: – Transmits at full channel data rate R – with no a priori coordination among nodes • Two or more transmitting nodes  collision • Random access MAC protocol specifies: – How to detect collisions – How to recover from collisions • e.g., via delayed retransmissions • Examples of random access MAC protocols: – Slotted ALOHA – ALOHA – CSMA, CSMA/CD, CSMA/CA 37
  • 38. Slotted ALOHA (1) Operation Assumptions • When node obtains fresh • All frames same size frame, it transmits in next • Time is divided into equal slot size slots == time to • No collision  node can transmit 1 frame send new frame in next • Nodes start to transmit slot frames only at beginning of slots • Collision, node retransmits frame in each subsequent • Nodes are synchronized slot with probability p until • If 2 or more nodes transmit success in slot, all nodes detect collision 38
  • 39. Slotted ALOHA (2) Pros Cons • Single active node can • Collisions  wasted slots continuously transmit at full • Idle slots rate of channel • Nodes may be able to detect • Decentralized: collision in less than time to – only slots in nodes need to be in sync transmit packet • Simple 39
  • 40. Slotted ALOHA Efficiency Efficiency:long-run • Max efficiency: fraction of successful Find p* that maximizes slots given many nodes Np(1-p)N-1 with many frames to send • For many nodes: Analysis: • Suppose N nodes with many frames to send, each transmits in   lim Np * 1  p *  1 / e N slot with probability p • Probability that 1st node has success in a slot: p(1-p)N-1 At best: channel used At • Probability that any node has a success for useful transmissions Np(1-p)N-1 ~37% of time! 40
  • 41. Pure (Unslotted) ALOHA • Same as slotted but no synchronization: – When frame first arrives transmit immediately  Collision probability increases! Efficiency = 1/(2e) 41
  • 42. CSMA: Carrier Sense Multiple Access • CSMA: – Listen before transmit: • If channel sensed idle: transmit entire frame • If channel sensed busy, defer transmission • Human analogy – Don’t interrupt others! 42
  • 43. CSMA Collisions • Collisions can still occur: – propagation delay means two nodes may not hear each other’s transmission • On collision: – entire packet transmission time wasted • Collision probability – depends on propagation delay 43
  • 44. CSMA/CD (Collision Detection) • CSMA/CD: Carrier sensing, deferral as in CSMA – Collisions detected within short time – Colliding transmissions aborted • Collision detection: – On wired LANs: • measure signal strengths, • compare transmitted & received signals – On wireless LANs: • receiver shut off while transmitting • Human analogy: – the polite conversationalist 44
  • 46. Turn-Taking MAC Protocols • Channel partitioning: – High load  efficiently and fair – Low load  inefficient • 1/N bandwidth allocated even if only 1 active node! • Random access: – Low load  efficient • single node can fully utilize channel – High load  inefficient • collision overhead • Turn-taking protocols: Look for best of both worlds! 46
  • 47. “Taking Turns” MAC protocols Polling: Token passing: • Designated “master”  Control token passed from node one node to next sequentially. • Master node invites  Concerns: “slave” nodes to  Token overhead transmit  Latency – Round robin  Single point of failure (token) – Max frames • Concerns: – Polling overhead – Latency – Single point of failure 47
  • 48. Summary of MAC Protocols • Sharing of shared media: – Channel (static) partitioning • by time, frequency, code • TDMA, FDMA, CDMA – Random (dynamic) partitioning • carrier sensing: collision detection • easy in wire technologies,harder in wireless • ALOHA, S-ALOHA, CSMA, CSMA/CD • CSMA/CD used in Ethernet – Turn-Taking • polling from a central site • token passing 48