protocol stack networking
play

Protocol Stack Networking Email Generally speaking, sending an - PDF document

Protocol Stack Networking Email Generally speaking, sending an email message is equivalent to copying a file from sender to receiver. Packetization Representation It is impossible to send arbitrary long messages. Correspondents may


  1. Protocol Stack Networking Email Generally speaking, sending an email message is equivalent to copying a file from sender to receiver. Packetization Representation • It is impossible to send arbitrary long messages. • Correspondents may use different type of computers that represent text characters in different encoding. • The representation program will forward the message to its local packetization program, this in turn, breaks the • The email program passes the message to the message into packets, add a header with number, and send representation program, which adds header that specifies these packets to packetization program at the destination the representation and sends it to the representation computer. program on the destination computer. • On arrival the packets will be reassembled at the remote • The representation program at the destination forms a packetization program and passed to the representation translation to local encoding and then passes the message program. up to the email program at the destination computer. Error Routing • The message must be routed through the network. • Data is sometimes corrupted during transmission due to noise on the communication channels. • The packetization program forwards the each packet to the router, this in turn, adds a routing header and determine • It is possible to devise means to recognize errors. where to send them. • The router on the receiving host check the rout header and • If the sender recognized an error the sender is asked to re- forward the packets towards the destination computer. send the packet, otherwise, an acknowledgment is sent back to sender. • Eventually, the packets arrive to the destination computer, and then passed to the packetization program at the destination computer. 1

  2. Protocol Stack ISO-OSI Layered Model International Standard Organization • The set of programs that the message goes through is Open System Interconnected called a protocol stack. • Logically, each layer talks directly with its counterpart on the other machine, using particular protocol. ISO-OSI Layered Model ISO-OSI Layered Model The communication network is partitioned into the following multiple layers: • Physical layer – handles the mechanical and electrical details of the physical transmission of a bit stream • Data-link layer – Flow control over a signal link, buffering, and error correcting. • Network layer – Routing. • Transport layer – Partitioning messages into packets, maintaining packet order, controlling flow. ISO-OSI Layered Model • Session layer – implements sessions, or process-to-process communications protocols (often unused). The TCP/IP Protocol Suite • Presentation layer – resolves the differences in formats among the various sites in the network. • Application layer – interacts directly with the users. In practice, the TCP/IP protocol suite became a de-facto standard of the Internet before the OSI model was defined. 2

  3. Internet Protocol The TCP/IP Protocol Layers • The IP creates an internet: a network that is composed of networks. • The IP performs the routing of messages across different networks. Flow Control • The recipients must have a buffer large enough to hold at least a single packet. Implementation Issues • If more packets arrive than there is no space in the buffer, the buffer will overflow . • The situation in which the network is overloaded and drop packets is called congestion. • In order to avoid congestion, flow control is needed. Flow Control • Each sender has to estimate how much free space is available in the recipient’s buffer. Acknowledgements & Timeouts Acknowledgements & Timeouts Sender Receiver Sender Receiver • An acknowledgement (ACK) is a packet sent by one host Frame Frame Timeout Timeout in response to a packet it has received Time K C K A C A • A timeout is a signal that an ACK/NACK to a packet that Frame Timeout was sent has not yet been received within a specified C K A timeframe. (a) (c) – A timeout triggers a retransmission of the original packet from the sender. Sender Receiver Sender Receiver Frame Frame – Propagation delay is defined as the delay between Timeout Timeout K transmission and receipt of packets between hosts. A C Frame Timeout Frame – Propagation delay (a.k.a. Round Trip Time RTT) can Timeout K A C be used to estimate timeout period A C K (b) (d) 3

  4. Stop-and-Wait Process Buffering Sender Receiver • Sender needs to buffer data so that if data is lost, it can be resent. • Receiver needs to buffer data so that if data is received out of order, it can be held until all packets are received – Flow control . • How can we prevent sender overflowing receiver’s buffer? – Receiver tells sender its buffer. • Sender doesn’t send next packet until he’s sure receiver has last packet (i.e. buffer can contain a single packet). • The packet/Ack sequence enables reliability • Sequence numbers help avoid problem of duplicate packets. • Leads to large gap between packets, due to RTT. Solution: Pipelining via Sliding Sliding Window: Sender Window • Assign sequence number to each packet • Allow multiple outstanding (un-ACKed) packets. • Maintain three state variables: • Upper bound on un-ACKed packets, called window. – send window size ( SWS ) – last acknowledgment received ( LAR ) • Increased utilization – last packet sent ( LFS ) Sender Receiver • Maintain invariant: LFS - LAR <= SWS • Advance LAR when ACK arrives • Buffer up to SWS frames … T ime ≤ SWS … … … LAR LFS Sliding Window: Receiver Sliding Window Example Receiver Sender • Maintain three state variables – receive window size ( RWS ) 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 – largest packet acceptable ( LFA ) 0 – last packet received ( LFR ) 1 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 • Maintain invariant: LFA - LFR <= RWS 2 • Packet SeqNum arrives: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 – if LFR < SeqNum < = LFA accept 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 A3 – if SeqNum < = LFR or SeqNum > LFA discarded 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 3 4 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 5 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 6 ≤ RWS 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 A4 … … 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 LFR LFA 4

  5. Piggybacking Sliding Window Summary • The recipient needs to inform the sender of two unrelated • First role is to enable reliable delivery of packets: conditions: – Timeouts and acknowledgements. – The data has arrived correctly or not (ACK or NACK) • Second role is to enable in order delivery of packets (FIFO): – The buffer space available for additional transmissions. – Receiver doesn’t pass data up to app until it has packets in • If the communication is bidirectional, the control data can order. be piggybacked in the data going on the other direction. • Third role is to enable flow control: – Prevents server from overflowing receiver’s buffer TCP Congestion Control • A special case of flow control is the congestion control algorithm used in TCP. – Cooperation: The control is not exercised by a single system, but the combined actions of all the system involved. Implementation Issues – External resources: The resource being managed is external to the controlling systems. – Indirection: The controlling systems do not have direct access to the controlled resource. Congestion Control • Congestion: – Packets are dropped by routers that implement the network. – Dropped packets are retransmitted, which incurs additional overhead, thus, communication progressively worse. – Communication slows down. TCP Congestion Control • Congestion control is manifested in selecting the appropriate window size. • In actual transmission, the system uses the minimum of the flow-control window size and congestion control window size. • Start slowly and build up: – The initial window size is 1. – As each ACK arrives, increased window size by 1. • Congestion avoidance: – Set a threshold window size to half of the current size. – Set the window size to 1 and restart the slow-start algorithm. – When the window size reaches the threshold, increase it by 1/w on each ACK, where w is the current window size. 5

Recommend


More recommend