Download presentation
Presentation is loading. Please wait.
Published byArlene Evans Modified over 8 years ago
2
Basics The data link layer is the protocol layer that transfers data between adjacent network nodes in a wide area network. To implement data link control, we need protocols. Data link control functions include framing, flow and error control & software implemented protocols. Two main function of data link layer are data link control & media access control.
3
FRAMING FRAMING Data Transmission in physical layer means moving bits in the form of a signal from source to destination. The data link layer needs to pack bits into frames, so that each frame is distinguishable from another. Our postal system practices a type of framing. The simple act of inserting a letter into an envelope separates one piece of information from another; the envelope serves as the delimiter.
4
Types of Framing Fixed-Size: No need for defining boundaries. Variable size: Need to define end & beginning of frame. Two approaches a) Character-Oriented approach b) Bit-Oriented approach
5
Character-Oriented Protocol Here data to carried are 8 bit characters. Header normally carries the source and destination address. To separate one frame from the next, an 8-bit (1 byte) flag is added at the beginning & at the end of frame.
6
A frame in a character-oriented protocol
7
Byte Stuffing In byte stuffing a special byte is added to the data section of the frame when there is a character with same pattern or flag. Data section is stuffed with extra byte called as escape character(ESC)
8
Byte stuffing and unstuffing
9
Byte stuffing is the process of adding 1 extra byte whenever there is a flag or escape character in the text. Note
10
Bit-Oriented Protocol Data section of a frame is a sequence of bits Most protocols uses a special 8-bit pattern flag 01111110 as the delimiter to define beginning and end of the frame.
11
A frame in a bit-oriented protocol
12
Bit stuffing is the process of adding one extra 0 whenever five consecutive 1s follow a 0 in the data, so that the receiver does not mistake the pattern 0111110 for a flag. Bit stuffing is the process of adding one extra 0 whenever five consecutive 1s follow a 0 in the data, so that the receiver does not mistake the pattern 0111110 for a flag. Note
13
Bit stuffing and un-stuffing
14
FLOW AND ERROR CONTROL FLOW AND ERROR CONTROL The most important responsibilities of the data link layer are flow control and error control. Collectively, these functions are known as data link control.
15
Flow control refers to a set of procedures used to restrict the amount of data that the sender can send before waiting for acknowledgment. Flow control refers to a set of procedures used to restrict the amount of data that the sender can send before waiting for acknowledgment. Note
16
Error Control Error control is both error detection & correction. It allows the receiver to inform the sender of any frames lost or damaged in transmission & coordinates for the retransmission. If error is detected in exchange, the specified frames are retransmitted this process is called as Automatic Repeat Request(ARQ)
17
Error control in the data link layer is based on automatic repeat request, which is the retransmission of data. Note
18
PROTOCOLS PROTOCOLS The protocols are normally implemented in software by using one of the common programming languages. We divide the discussion of protocols into those that can be used for noiseless (error-free) channels and those that can be used for noisy (error-creating) channels. The protocols in the first category cannot be used in real life, but they serve as a basis for understanding the protocols of noisy channels.
19
Taxonomy of protocols
20
NOISELESS CHANNELS Let us first assume we have an ideal channel in which no frames are lost, duplicated, or corrupted. We introduce two protocols for this type of channel. Simplest Protocol Stop-and-Wait Protocol
21
Model of Frame Transmission
22
Simplest Protocol Simplest protocol is one that has no flow or error control. It is a unidirectional protocol in which data frames are traveling in only one direction from sender to receiver. At the receiver it immediately removes the header from the frame and hands the data packet to the network layer. Here the receiver can never be overwhelmed with incoming frames.
23
Design & Procedure The procedure at the sender site is constantly running; there is no action until there is a request from network layer. The procedure at the receiver site is also constantly running; but there is no action until notification from the physical layer arrives. Both procedures are constantly running because they don’t know when the corresponding event will occur.
24
The design of the simplest protocol with no flow or error control
25
Sender-site algorithm for the simplest protocol GetData takes a data packet from the network layer, MakeFrame adds a header and delimiter flags to the data packet to make a frame, and SendFrame delivers the frame to the physical layer for transmission
26
Analysis The algorithm has an infinite loop, which means lines 3 to 9 are repeated forever once the program starts. The algorithm is an event-driven one, which means that it sleeps (line 3) until an event wakes it up (line 4). This means that there may be an undefined span of time between the execution of line 3 and line 4; there is a gap between these actions. When the event a request from the network layer, occurs, lines 6 though 8 are executed. The program then repeats the loop and again sleeps at line 3 until the next occurrence of the event.
27
Receiver-site algorithm for the simplest protocol ReceiveFrame process, extracts the data from the frame using the ExtractData process, and delivers the data to the network layer using the DeliverData process.
28
This algorithm has the same format as sender Algorithm except that the direction of the frames and data is upward. The event here is the arrival of a data frame. After the event occurs, the data link layer receives the frame from the physical layer using the ReceiveFrame process, extracts the data from the frame using the ExtractData process, and delivers the data to the network layer using the DeliverData process. Analysis
29
Figure shows an example of communication using this protocol. The sender sends a sequence of frames without even thinking about the receiver. To send three frames, three events occur at the sender site and three events at the receiver site. Note that the data frames are shown by tilted boxes; the height of the box defines the transmission time difference between the first bit and the last bit in the frame.
30
Flow diagram for Example
31
Stop-and-Wait Protocol If data frames arrive at the receiver site faster than they can be processed, the frames must be stored until their use. If it is receiving data from many sources, this may result in either the discarding of frames. To prevent the receiver from becoming overwhelmed with frames, there must be feedback from the receiver to the sender. In Stop-and-Wait Protocol the sender sends one frame, stops until it receives confirmation from the receiver (okay to go ahead), and then sends the next frame.
32
Design of Stop-and-Wait Protocol
33
11.33 Sender-site algorithm for Stop-and-Wait Protocol
34
Analysis Here two events can occur: a request from the network layer or an arrival notification from the physical layer. we have used a simple canSend variable that can either be true or false. When a frame is sent, the variable is set to false to indicate that a new network request cannot be sent until canSend is true. When an ACK is received, canSend is set to true to allow the sending of the next frame.
35
11.35 Receiver-site algorithm for Stop-and-Wait Protocol
36
The sender sends one frame and waits for feedback from the receiver. When the ACK arrives, the sender sends the next frame. Note that sending two frames in the protocol involves the sender in four events and the receiver in two events. Example
37
Flow diagram for Example
38
NOISY CHANNELS NOISY CHANNELS Stop-and-Wait Protocol gives us an idea of how to add flow control to its predecessor, for noiseless channels Here three protocols in this section that use error control. Stop-and-Wait Automatic Repeat Request Go-Back-N Automatic Repeat Request Selective Repeat Automatic Repeat Request
39
Stop-and-wait ARQ For noisy link, pure stop and wait protocol will break down, and solution is to incorporate some error control mechanism Stop and wait with ARQ: Automatic Repeat reQuest (ARQ), an error control method, is incorporated with stop and wait flow control protocol – If error is detected by receiver, it discards the frame and send a negative ACK (NAK), causing sender to re-send the frame – In case a frame never got to receiver, sender has a timer: each time a frame is sent, timer is set
40
Contd… If no ACK or NAK is received during timeout period, it re-sends the frame – Timer introduces a problem: Suppose timeout and sender retransmits a frame but receiver actually received the previous transmission receiver has duplicated copies To avoid receiving and accepting two copies of same frame, frames and ACKs are alternatively labelled 0 or 1: ACK0 for frame 1, ACK1 for frame 0
41
11.41 Design of the Stop-and-Wait ARQ Protocol
42
11.42 Sender-site algorithm for Stop-and-Wait ARQ (continued)
43
11.43 Sender-site algorithm for Stop-and-Wait ARQ (continued)
44
11.44 Receiver-site algorithm for Stop-and-Wait ARQ Protocol
45
Stop and Wait - Diagram
46
11.46 Figure shows an example of Stop-and-Wait ARQ. Frame 0 is sent and acknowledged. Frame 1 is lost and resent after the time-out. The resent frame 1 is acknowledged and the timer stops. Frame 0 is sent and acknowledged, but the acknowledgment is lost. The sender has no idea if the frame or the acknowledgment is lost, so after the time-out, it resends frame 0, which is acknowledged.
47
11.47 Flow diagram for Example
48
C 0 C 1 C 2 C 3 Error Check ACK1 Error Check ACK2 3 4 Transmitter Receiver Next Frame Expected Next Ack Expected C 0 C 1 C 2 C 3 Frames and Acknowledgements with Sequence No. 0 1 2 3 4 1 2 3 4
49
C 0 C 1 C 2 C 3 C 1 C 0 C ACK Error Check Receiver ACK Noise Timeout Error Check ACK C 2 ACK C 3 ACK No match 0 1 2 3 Next Frame Expected Frame sequence number ‘0’ received successfully! Acknowledgement received successfully! Frame sequence number ‘1’ received successfully! Acknowledgement corrupted, hence rejected! Frame with sequence no. 1 retransmitted Frame sequence no. not matched Frame Sequence No. : Acknowledgement Error Acknowledgement received successfully! Frame with Sequence no. 2 received Image reached destination successfully!
50
11.50 Assume that, in a Stop-and-Wait ARQ system, the bandwidth of the line is 1 Mbps, and 1 bit takes 20 ms to make a round trip. What is the bandwidth-delay product? If the system data frames are 1000 bits in length, what is the utilization percentage of the link? Solution The bandwidth-delay product is Example
51
The system can send 20,000 bits during the time it takes for the data to go from the sender to the receiver and then back again. However, the system sends only 1000 bits. We can say that the link utilization is only 1000/20,000, or 5 percent. For this reason, for a link with a high bandwidth or long delay, the use of Stop-and-Wait ARQ wastes the capacity of the link. Example (continued)
52
Go-Back-N (GBN)
53
Go-Back-N protocol Concept ◦ Introduce a window of size n ◦ Can inject n packets into net before hearing an ACK Sliding window ◦ Label each packet with a sequence number ◦ A window is a collection of adjacent sequence numbers ◦ The size of the collection is the sender ’ s window size
54
Example
55
Send window for Go-Back-N ARQ
56
11.56 Receive window for Go-Back-N ARQ
57
Design of Go-Back-N ARQ
58
Window size for Go-Back-N ARQ
59
Selective Repeat ARQ
60
11.60 Send window for Selective Repeat ARQ
61
11.61 Receive window for Selective Repeat ARQ
62
HDLC
63
High-level Data Link Control (HDLC) is a bit-oriented protocol for communication over point-to-point and multipoint links. It implements the ARQ mechanisms.
64
HDLC Station Types Primary station ◦ Controls operation of link ◦ Frames issued are called commands ◦ Maintains separate logical link to each secondary station Secondary station ◦ Under control of primary station ◦ Frames issued called responses Combined station ◦ May issue commands and responses
65
HDLC Link Configurations Unbalanced ◦ One primary and one or more secondary stations ◦ Supports full duplex and half duplex Balanced ◦ Two combined stations ◦ Supports full duplex and half duplex
66
HDLC Transfer Modes (1) Normal Response Mode (NRM) ◦ Unbalanced configuration ◦ Primary initiates transfer to secondary ◦ Secondary may only transmit data in response to command from primary ◦ Used on multi-drop lines ◦ Host computer as primary ◦ Terminals as secondary
67
11.67 Normal response mode
68
HDLC Transfer Modes (2) Asynchronous Balanced Mode (ABM) ◦ Balanced configuration ◦ Either station may initiate transmission without receiving permission ◦ Most widely used ◦ No polling overhead
69
11.69 Asynchronous balanced mode
70
HDLC Transfer Modes (3) Asynchronous Response Mode (ARM) ◦ Unbalanced configuration ◦ Secondary may initiate transmission without permission form primary ◦ Primary responsible for line ◦ rarely used
71
Frame Structure Synchronous transmission All transmissions in frames Single frame format for all data and control exchanges
72
11.72 HDLC frames
73
11.73 Control field format for the different frame types
74
I- Frame
75
Information frame (I-frame) Each I-frame contains the send sequence number N(S) ◦ N(S) = Sequence number of the sending I-frame Positive piggybacked ACK N(R) ◦ N(R) = Sequence number of the next frame expected, meaning to acknowledge all frames up to and including N(R)-1 3 or 7 bit sequence number for N(S) and N(R) ◦ Maximum window sizes 7 or 127 Poll/Final Bit ◦ NRM: Primary polls station by setting P=1; Secondary sets F=1 in last I-frame in response ◦ Primary and secondary always interact via paired P/F bits
76
S Frame
78
Supervisory frames Supervisory frame is used for error control (ACK, NAK) and flow control (Don’t Send) Receive Ready (RR), SS=00 with N(R) ◦ RR frames are used to ACK frames when no I-frames are available to piggyback the acknowledgement Reject (REJ), SS=01 with N(R) ◦ REJ frames are used by the receiver to send a negative acknowledgement, indicating the transmitter should go back and retransmit frames from N(R) onwards (for Go-Back-N ARQ). Receive Not Ready (RNR), SS=10 with N(R) ◦ RNR frame acknowledges all frames up to N(R)-1 and informs the transmitter that the receiver has temporary problems, that is, no buffers, and will not accept any more frames. Selective Reject (SREJ), SS=11 with N(R) ◦ SREJ frame indicates to the transmitter that it should retransmit the frame indicated in the N(R) subfield (for selective repeat ARQ)
79
U-Frame
80
Unnumbered Frames Set the data transfer mode during call setup or release ◦ SABM: Set Asynchronous Balanced Mode ◦ SNRM: Set Normal Response Mode ◦ UA: acknowledges acceptance of mode setting command ◦ DISC: terminates logical link connection Unnumbered I-Information transfer between stations ◦ UI: Unnumbered information frame Recovery used when normal error/flow control fails ◦ FRMR: frame with correct FCS but impossible semantics ◦ RSET: indicates that the transmitter station is resetting the sequence numbers XID: exchange station id and characteristics
81
11.81 U-frame control command and response
82
Typical Frame Exchange Example: Exchange of frames for connection establishment and release in data link connection In HDLC ◦ Set Asynchronous Balanced Mode (SABM) ◦ Disconnect (DISC) ◦ Unnumbered Acknowledgment (UA) SABM UA DISC Data transfer
83
Primary A Secondaries B, C B, RR, 0, P B, I, 0, 0 B, I, 1, 0 B, I, 2, 0,F X B, SREJ, 1 C, RR, 0, P C, RR, 0, F B, SREJ, 1,P B, I, 1, 0 B, I, 3, 0 B, I, 4, 0, F B, I, 0, 5 Time Example: HDLC using NRM to Exchange Frames A polls B B sends 3 info frames A rejects frame 1 A polls C C nothing to send A polls B, requests selective retransmission of frame1 B resends frame1 Then frame 3 & 4 A send info frame 0 to B, ACKs up to 4 N(R) N(S) N(R) Address of secondary Information frame Supervisory frame Unnumbered frame
84
Combined Station A Combined Station B B, I, 0, 0 A, I, 0, 0 B, I, 1, 0 B, I, 2, 1 A, I, 1, 1 A, I, 2, 1 X B, REJ, 1 B, I, 3, 2 B, I, 4, 3 B, I, 1, 3 B, I, 2, 4 B, I, 3, 4 A, I, 3, 1 B, RR, 2 B, RR, 3 Example: HDLC using Asynchronous Balanced Mode to Exchange Frame B sends 5 frames ACKs frame 0 from A Rejects frame 1 of A B goes back to 1 ACKs frame 1 from A ACKs frame 2 N(S), N(R)
85
POINT-TO-POINT PROTOCOL POINT-TO-POINT PROTOCOL Although HDLC is a general protocol that can be used for both point-to-point and multipoint configurations, one of the most common protocols for point-to-point access is the Point-to-Point Protocol (PPP). PPP is a byte-oriented protocol. Internet uses the point-to-point protocol (PPP): It handles error detection, supports multiple protocols, allows IP addresses to be negotiated at connection time, permit authentication
86
11.86 PPP frame format
87
PPP frame format is: – Frame flag: 01111110, and byte stuffing is used, i.e. – If flag pattern appears in data stream, a special escape byte (ESC) is added before it, and if ESC appears inside data, it also needs byte stuffing – Address: 11111111, which means all stations can accept the frame. This avoids issue of assigning data link addresses -Control: 11000000 is a default value, indicating unnumbered frame – Note there is no sequence number, so data link layer does not do flow/error control, but PPP has FSC and is able to detect errors
88
– Protocol field: tells what kind of packet is in payload. Protocols starting with a 0 bit are network protocols such as IP, IPX, OSI, and others; starting with a 1 bit are used to negotiate other protocols, and these include LCP and different NCPs
89
PPP Operation PPP is multiprotocol framing mechanism suitable for use over modems, HDLC lines, SONET, and other physical layers
90
Operation Start with physical line state ‘Dead’, after physical connection is established, the line moves to Establish. LCP option negotiation then begins, which lead to Authenticate if successful, and two parties can now check each other’s identities if so desired. Network phase is next entered, and appropriate NCP protocol is invoked to configure network layer If configuration successful, Open state is reached and data transport can take place. After data transport is completed, the line moves to Termination phase, and from there back to Dead when carrier is dropped.
91
Peer- to – Peer Model “Peer-to-Peer (P2P) is a way of structuring distributed applications such that individual nodes have symmetric roles. Rather than being divided into clients and servers each with quite distinct roles, in P2P applications, a node may act as both a client and a server.”
92
Peer-to-Peer Systems In a P2P network, every node is both a client and a server ◦ Provide and consume data ◦ Any node can initiate a connection No centralized data source As no. of clients increases, no. of servers also increases ◦ Perfectly scalable ◦ Distributed costs ◦ Increased privacy
93
P2P Network Characteristics Clients are also servers and routers Nodes contribute content, storage, memory, CPU Nodes are autonomous (no administrative authority) Network is dynamic: nodes enter and leave the network “frequently” Nodes collaborate directly with each other (not through well-known servers) Nodes have widely varying capabilities
94
P2P Network Benefits Efficient use of resources ◦ B/W, storage, and processing power at the edge of the network Scalability ◦ Consumers of resources also donate resources ◦ Aggregate resources grow naturally, as more peers join Reliability ◦ Replicas ◦ Geographic distribution ◦ No single point of failure Ease of administration ◦ Self-organization ◦ No need for server deployment and provisioning ◦ Built-in fault tolerance, replication, and load balancing
95
Popular P2P Systems Napster, Gnutella, Kazaa, Freenet Large scale sharing of files. User A makes files (music, video, etc.) on their computer available to others User B connects to the network, searches for files and downloads files directly from user A
96
Napster
97
A way to share music files with others Users upload their list of files to Napster server You send queries to Napster server for files of interest Keyword search (artist, song, album, bitrate, etc.) Napster server replies with IP address of users with matching files You connect directly to user A to download file
98
98 n – 1 peer process n peer process n + 1 peer process Peer-to-Peer Protocols Layer-n peer processes execute protocol to provide service to layer- (n+1) Layer-(n+1) peer calls layer- n and passes Service Data Units (SDUs) for transfer Layer-n peers exchange Protocol Data Units (PDUs) to effect transfer Layer-n delivers SDUs to destination layer-(n+1) peer SDU PDU
99
99 Service Models The service model specifies the information transfer service layer-n provided to layer-(n+1) Two categories of service models: ◦ Connection-oriented services ◦ Connectionless services A service offered by a given layer can include some of the following features: ◦ Arbitrary message size or structure ◦ Sequencing and Reliability ◦ Timing, Pacing, and Flow control ◦ Multiplexing ◦ Privacy, integrity, and authentication
100
100 Connection Establishment phase Connection must be established between layer-(n+1) peers Layer-n protocol must set initial parameters, e.g. sequence numbers; and Allocate resources, e.g. buffers Data transfer phase Exchange of SDUs Disconnection phase Example: TCP, PPP Connection-Oriented Transfer Service n + 1 peer process send n + 1 peer process receive Layer n connection-oriented service SDU
101
101 No Connection setup is required, simply send SDU Each block of information is transmitted independently All address information per block must be provided Acknowledge is not required (Simple & quick) or required Example: UDP, IP Connectionless Transfer Service n + 1 peer process send n + 1 peer process receive SDU Layer n connectionless service
102
End-to-End Versus Hop-by-Hop
103
1 2 3 4 5 Data ACK/NAK Data 1 2 3 4 5 ACK/ NAK End-to-end Hop-by-hop Adaptation functions may be implemented end-to-end or hop-by-hop Data are ACK or NAK by the other end Data are ACK or NAK by each hop
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.