Download presentation
Presentation is loading. Please wait.
1
1 Fall 2005 Protocols and layering Qutaibah Malluhi Computer Science and Engineering Qatar University
2
2 Introduction LAN/WAN hardware can not solve all computer communication problems –Sending data through raw hardware is awkward and inconvenient »Equivalent to accessing files by making calls to disk controller to position read/write head and accessing individual sectors »Network software provides high-level interface to applications Software is needed –What problems should software handle? –Complex Layering is a structuring technique –Separate hardware and software functions –Organize networking software design and implementation –Manage complexity
3
3 Network Protocols Agreement on set of rules to be used for communication Specifies –Format of messages –Meaning of messages –Rules for exchange –Procedures for handling problems Protocols are implemented by protocol software
4
4 Need for Protocols Hardware is low level. Software needed to handle a number of problems. Many problems can occur –Bits corrupted or destroyed –Entire packet lost –Packet duplicated –Packets delivered out of order Need mechanisms to distinguish among –Multiple computers on a network –Multiple applications on a computer –Multiple copies of a single application on a computer
5
5 Protocol Suites A set of related protocols that are designed for compatibility is called a protocol suite Protocol suite designers: –Analyze communication problem –Divide problems into subproblems –Design a protocol for each subproblem A well-designed protocol suite –Is efficient and effective - solves the problem without redundancy and makes best use of network capacity –Allows replacement of individual protocols without changes to other protocols
6
6 Protocol Layering A way of managing the complexity Model suggests dividing the network protocol into layers, each of which solves part of the network communication problem Network protocol suite designed to have a protocol or protocols for each layer
7
7 The ISO 7-Layer Reference Model International Organization for Standards (ISO) defined a 7-layer reference model as a guide to the design of a network protocol suite Layers are named and numbered –reference to ``layer n'' often means the nth layer of the ISO 7-layer reference model Many modern protocols do not exactly fit the ISO model, and the ISO protocol suite is mostly of historic interest Reference model: used provides a common terminology among different protocol stacks. Concepts are still largely useful and terminology persists
8
8 The Seven Layers Layer 7: Application –Application-specific protocols such as HTTP, FTP and SMTP (electronic mail) Layer 6: Presentation –Common formats for representation of data Layer 5: Session –Management of sessions such as login to a remote computer and authentication Layer 4: Transport –Reliable delivery of data between computers Layer 3: Network –Address assignment, routing and data delivery across a physical network Layer 2: Data Link –Format of data in frames and delivery of frames through network interface Layer 1: Physical –Basic network hardware - such as RS-232 or Ethernet. –Includes media, hardware interfaces, bit encoding, etc.
9
9 Stacks: Software Layers Software stack: Software implementation of layered design Software modules can be viewed as:
10
10 Commercial Protocol Stack Examples Although the stacks share many general concepts, the details differ, making them incompatible
11
11 Layering Principle The software for each layer depends only on the services provided by lower layers The software at layer n at the destination receives exactly the same protocol message sent by layer n at the sender Each layer can be designed, implemented and tested independent of other layers Change of implementation of any layer’s should be transparent to rest of system.
12
12 Multiple Nested Headers The software at each layer at the sender communicates with the corresponding layer at the receiver through information stored in headers (a trailer may also be added)
13
13 Stacks and Messages (1) On the sender, each layer: –Accepts an outgoing message from the layer above –Adds a header and other processing –Passes resulting message to next lower layer On the receiver, each layer: –Receives an incoming message from the layer below –Removes the header for that layer and performs other processing –Passes the resulting message to the next higher layer
14
14 Stacks and Messages (2)
15
15 Control Messages Protocol layers often need to communicate directly without exchanging data –Acknowledge incoming data –Request next data packet Layers use control packets –Generated by layer n on sender –Interpreted by layer n on receiver –Transmitted like any other packet by layers n-1 and below
16
16 General Protocol Techniques Reliable communication –Protocol techniques: parity bit, checksum and CRC Out-of –order delivery –Packet sequence numbers Duplicate packets –Packet sequence numbers (duplicate seq. numbers) Lost packets –Positive acknowledgement with retransmission (see later) Replay (caused by excessive delay) –Unique session ID (see later) Data Overrun –Flow control mechanisms (see later).
17
17 Acknowledgement & Retransmission Error causes receiver to discard packet How does the sender decide that a packet has been lost? Protocols use positive acknowledgment with retransmission –Receiver sends short message acknowledging receipt of packets –Sender infers lost packets from missing acknowledgments –Sender retransmits lost packets Sender sets timer for each outgoing packet –Saves copy of packet –If timer expires before acknowledgment is received, sender can retransmit saved copy Protocols define upper bound on number of retransmissions to detect unrecoverable network failure Lost acknowledgement causes duplicate packets
18
18 What Can Go Wrong...
19
19 Replay Sufficiently delayed packets may affect later sessions Suppose two computers exchange data with packets numbered 1 to 5 Packet 4 encounters an extraordinary delay; computers use retransmission to deliver valid copy of packet 4 Two computers exchange data later on with packets numbered 1 to 10 Initial `packet 4' can arrive during second session, so that the data from that old packet (rather than the current `packet 4' is inserted into the data Protocols attach session number to each packet in a protocol session to differentiate packets from different sessions
20
20 Flow Control Data overrun can occur when sender transmits data faster than receiver can process incoming data Protocols use flow control mechanisms (related to buffering) –Stop-and-go –Fixed-size sliding window –Variable-size sliding window (credit-based flow control)
21
21 Stop-And-Go Flow Control Sending side –Transmits one packet –Waits for signal from receiver Receiving side –Receives and consumes packet –Transmits signal to sender Inefficient
22
22 Stop-And-Go is Inefficient Example: consider 2 Mbps link and a network latency of 50 ms (i.e., round trip time (RTT) = 100 ms), then a 1 KB packet takes about 100 ms. Or maximum rate is 80 Kbps. Use 4% of the available capacity. (i.e., rest of the time link stays idle waiting for the ACK) Frame 0 Ack 0 Frame 1 Ack 1 cycle Sender Receiver
23
23 Sliding Window Flow Control Allows sender to transmit multiple packets before receiving an acknowledgment Number of packets that can be sent before an acknowledgement is received is defined by the protocol and called the window As acknowledgments arrive from the receiver, the window is moved along the data packets; hence ``sliding window'' Sender maintains window. Window size is the number of frames that can be in flight (sent but not acknowledged)
24
24 Sliding Window On Sending Side Window tells how many packets can be sent without acknowledgement –Window size = 5 in the example Window moves as acknowledgements arrive 123456789101112131415 Window 123456789101112131415 Window Acknowledged Unsent 123456789101112131415 Window
25
25 Comparison of Flow Control SenderReceiver frame Ack. frame Ack. frame Ack. frame Ack. SenderReceiver 4 frames Acknowledgements Stop-and-goSliding Window
26
26 Transmission Times For stop-and-go, each packet takes 2L time to deliver (where L is the latency, or network delivery time) Sliding window can improve by number of packets in window: R w = R g * W (R w is sliding window throughput, R g is stop-and-go throughput Transmission time also limited by network transmission rate: R w = min(B, R g * W) (B is maximum network bandwidth)
27
27 Congestion Fundamental problem in networks Caused by traffic, not hardware failure Analogous to congestion on a highway Principle cause of delay Multiple sources Bottleneck
28
28 Avoiding and Recovering from Congestion Protocols attempt to avoid congestion and recover from network collapse by monitoring the state of the network and taking appropriate action Can use two techniques: –Notification from packet switches –Infer congestion from packet loss Packet loss can be used to detect congestion because modern networks are reliable and rarely lose packets through hardware failure Sender can infer congestion from packet loss through missing acknowledgments
29
29 Congestion Control Dynamically adjust the window size 1.Rate or percentage of lost packets can be used to gauge degree of congestion »Sliding window can be used for congestion control u Gauge the window size: decrease on high-loss and increase on no loss 2.Receiver may tell sender if it is congested on window size to use »Credit-based flow control u Receiver issues credit (window size to use) to sender
30
30 Summary Layering is a technique for guiding protocol design and implementation Protocols are grouped together into related protocol suites – sometimes called a protocol stack Protocols use a variety of techniques for solving the reliable data delivery problems –Reliable communication –Out-of –order delivery –Duplicate packets –Lost packets and congestion –Replay –Data Overrun
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.