CMPE 150 Introduction to Computer Networks Dr Chane L Fullmer chane cse ucsc edu Spring 2003 UCSC cmpe150 1 Mid Term Next Tuesday April 29th Bring Scantron large pink one 30 50 questions Multiple choice Questions come from both text and lectures Some may be similar to homework Closed book closed notes Spring 2003 UCSC cmpe150 2 Homework Assignments Homework assignment 2 Due by May 1 Spring 2003 UCSC cmpe150 3 CMPE 150 Introduction to Computer Networks LECTURE 7 Logical Link Control Part I Spring 2003 UCSC cmpe150 4 Logical Link Control MAC protocol provides best effort service Even when ACKs are used in the MAC the LLC layer can decide when to retransmit LLC bridges the gap between service expected by network layer and service provided by MAC layer LLC uses the header information in MAC frames Example PPP LLC over Ethernet MAC Spring 2003 UCSC cmpe150 5 Functions at The Link Layer MAC Framing Error checking Naming within LANs with MAC addresses Sharing of medium Flow control in some cases LLC Retransmission strategy Link management deciding when a link exists or does not Flow control in some cases Spring 2003 UCSC cmpe150 6 Types of Service LLC Can Provide Unacknowledged connectionless service Datagram transmission no connection exists no error checking framing is the only service provided e g SLIP Acknowledged connectionless service No connections each frame is ACKed individually This service can be provided as part of the MAC itself e g CSMA CA protocols Connection Oriented Service Data exchanged within a connection provides net layer with a virtual reliable packet stream e g HDLC PPP Spring 2003 UCSC cmpe150 7 Retransmission Strategies Called Automatic Repeat reQuest ARQ algorithms or protocols Read Sections 3 4 of text Design Issues How does a receiver ask for a retransmission How does the sender know when to retransmit How are packets associated with requests for retransmissions Performance and correctness We will assume point to point links for simplicity Spring 2003 UCSC cmpe150 8 ARQ Assumptions The protocol operates at the link layer One sender and one receiver Links and nodes behave in FIFO order Nodes execute ARQ protocol correctly Session between sender and receiver is already initialized and is permanent All errors are detected correctly and framing is done perfectly Spring 2003 UCSC cmpe150 9 Generic ARQ Scheme SENDER INITIATED PACKET SENDER CRC SEQ RECEIVER acknowledge packet if no errors TIMEOUT ACK retransmit if no ACK time time Spring 2003 UCSC cmpe150 10 Generic ARQ Scheme RECEIVER INITIATED SENDER RECEIVER POLL PACKET TIMEOUT CRC SEQ ACK POLL acknowledge packet if no errors poll retransmit if asked time time Spring 2003 UCSC cmpe150 11 Example of Simple ARQ Assume receiver labels every ACK with the same label A regardless of the packet being acknowledged P 1 P 2 SENDER time A RECEIVER T1 Spring 2003 T2 T3 UCSC T4 cmpe150 12 Errors Can Confuse Receiver Assume that sender retransmits packet when it receives no ACK within a timeout P 1 timeout copy of P 1 SENDER time Works correctly x A A RECEIVER T1 Spring 2003 T2 T4 UCSC T5 cmpe150 13 Errors Can Confuse Receiver P 1 timeout copy of P 1 SENDER P 2 time A A x S erroneously concludes that P 1 and P 2 were received correctly RECEIVER T1 T2 T4 T5 T6 T5 To avoid confusion at S each ACK must reference the packet for which it is sent Spring 2003 UCSC cmpe150 14 Requirements in ARQ Sender labels each packet it sends using a linear sequence number space Receiver ACKs each packet it receives without errors and numbers each ACK with the sequence number of the corresponding packet Sender times out after not receiving an ACK for the packet within some finite amount of time and retransmits the packet then Sender sends up to a certain number of un ACKed packets Spring 2003 UCSC cmpe150 15 Stop and Wait ARQ Sender transmits packets labeled 1 2 Receiver ACKs every packet received correctly and ACK specified the packet being acknowledged or next expected packet Receiver passes copy of packet correctly received to the network layer and drops packets with errors Sender retransmits copy of packet if no ACK arrives within a timeout interval Sender and receiver are initialized to start sending and receiving packet 1 Spring 2003 UCSC cmpe150 16 Stop and Wait Protocol SWP Sender s algorithm 1 Initialize packet number PN to 0 or1 for example 2 Wait until packet is received from network layer assign PN to packet 3 Transmit or retransmit packet in frame with PN as its sequence number 4 Start timeout timer and wait for ACK from receiver 5 If error free ACK specifying PN is received within timeout interval then set PN PN 1 and go to Step 2 else go to Step 3 Spring 2003 UCSC cmpe150 17 Stop and Wait Protocol Receiver s algorithm 1 Initialize next packet NP to 0 or 1for example and repeat Step 2 forever 2 If packet is received then if error in packet then discard packet else do if PN NP then give packet to network layer and set NP NP 1 send ACK containing PN or NP Spring 2003 UCSC cmpe150 18 Selective Repeat ARQ Motivation SWP leaves sender idle for long periods of time waiting for ACKs Solution Allow sender to transmit multiple packets while waiting for the ACK of a given packet Have a pipeline of packets Requirements Sender and receiver can buffer a number W of packets Sender labels packets using consecutive numbers 1 2 Receiver buffers packets received without error ACKs them and delivers packets to network layer in the correct order e g if packet P1 is in error and P2 and P3 are received correctly the receiver buffers them until it receives P1 correctly Sender buffers copies of transmitted packet until it receives the corresponding ACK Sender retransmits a packet when its timeout expires with no ACK ACK refers to the sequence number of the packet it acknowledges Spring 2003 UCSC cmpe150 19 How Many Packets Allowed in Sender s Buffer Assume we allow a maximum of W 4 in buffer 1 S 1 1 1 1 2 2 2 3 3 3 4 4 1 1 1 1 5 5 5 3 3 6 6 4 4 4 and sender can keep transmitting new packets timeout 1 X R Spring 2003 3 4 5 1 3 6 time 4 X 2 2 2 2 2 3 3 3 3 4 4 4 5 5 UCSC cmpe150 6 overflows buffer 20 Solution To Buffer Overflow Sender cannot transmit a new packet if the difference in smallest and largest seq in buffer is not smaller than W ASSUME W 4 1 1 1 1 2 2 2 3 3 3 3 4 4 4 S 1 1 1 X 3 4 R 2 3 1 X 2 timeout timeout 4 1 5 timeout 1 1 time 4 1 1 transmit 1 until ACK is received 2 2 2 3 3 3 4 4 5 1 Spring 2003 UCSC cmpe150 21 Selective Repeat Protocol
View Full Document
Unlocking...