240 likes | 541 Views
Packets. Packets. Data link Layer. Data link Layer. Frames. A. B. Physical Layer. Physical Layer. Lecture 8 - Link-Layer Protocol. Frame Synchronization Flow Control Error Control Addressing Link Management. Flow Control.
E N D
Packets Packets Data link Layer Data link Layer Frames A B Physical Layer Physical Layer Lecture 8 - Link-Layer Protocol • Frame Synchronization • Flow Control • Error Control • Addressing • Link Management ECS 152A Computer Networks
Flow Control • Ensuring the sending entity does not overwhelm the receiving entity • Preventing buffer overflow • Transmission time • Time taken to emit all bits into medium • Propagation time • Time for a bit to traverse the link ECS 152A Computer Networks
Model of Frame Transmission ECS 152A Computer Networks
Stop and Wait • Source transmits frame • Destination receives frame and replies with acknowledgement • Source waits for ACK before sending next frame • Destination can stop flow by not sending (or delaying) ACK • Works well for few large frames ECS 152A Computer Networks
Fragmentation • Large block of data may be split into small frames • Limited buffer size • Errors detected sooner (when whole frame received) • On error, retransmission of smaller frames is needed • Prevents one station occupying medium for long periods • Stop and wait becomes inadequate ECS 152A Computer Networks
Transmission delay: R=link bandwidth (bps) L=packet length (bits) time to send bits into link = L/R Propagation delay: d = length of physical link s = propagation speed in medium (~2x108 m/sec) propagation delay = d/s transmission A propagation B nodal processing queueing Delays Note: s and R are very different quantitites! ECS 152A Computer Networks
Stop and Wait Protocol – Analysis • Sender utilization • The fraction of the time the transmitter is busy • U = 1/(1 + 2a) where a = tprop/ttrans • tprop = Distance/Velocity • ttrans = Packet length/data rate ECS 152A Computer Networks
8kb/pkt t = = 8 microsec transmit 10**9 b/sec Performance of Stop-and-wait • Stop-and-wait works, but performance stinks • example: 1 Gbps link, 15 ms e-e prop. delay, 1KB packet: • Tprop = 15ms. a = Tprop/Ttransmit = 0.008/15 • U = 1/ (1+ 2a) = ECS 152A Computer Networks
Sliding Windows Flow Control • Allow multiple frames to be in transit • Receiver has buffer W long • Transmitter can send up to W frames without ACK • Each frame is numbered • ACK includes number of next frame expected • Sequence number bounded by size of field (k) • Frames are numbered modulo 2k ECS 152A Computer Networks
Pipelining: sender allows multiple, “in-flight”, yet-to-be-acknowledged pkts range of sequence numbers must be increased buffering at sender and/or receiver Two generic forms of pipelined protocols: go-Back-N, selective repeat Sliding Window Protocol ECS 152A Computer Networks
Sender: k-bit seq # in pkt header “window” of up to N, consecutive unack’ed pkts allowed Sliding Window Protocol • ACK(n): ACKs all pkts up to, including seq # n - “cumulative ACK” • may deceive duplicate ACKs (see receiver) ECS 152A Computer Networks
Sliding Window Protocol – Example ECS 152A Computer Networks
Example Sliding Window ECS 152A Computer Networks
Sliding Window Protocol – Analysis • Let N be the size of the window • Let a = tprop/ttrans where tprop is the propagation delay and ttrans is the transmission delay • U = 1 if N > 1 + 2a • U = N/(1 + 2a) if N < 1 + 2a • By increasing N you can achieve higher utilization ECS 152A Computer Networks
Sliding Window Enhancements • Receiver can acknowledge frames without permitting further transmission (Receive Not Ready) • Must send a normal acknowledge to resume • If duplex, use piggybacking • If no data to send, use acknowledgement frame • If data but no acknowledgement to send, send last acknowledgement number again, or have ACK valid flag (TCP) ECS 152A Computer Networks
Error Control • Types of error • Packets (data packets and acks) are corrupted • Packets (data packets and acks ) are lost ECS 152A Computer Networks
Error-free packet sequence Information frames Packet sequence Transmitter Receiver Station B Station A Control frames CRC CRC Header Header Control frame Information packet Information Frame Basic elements of ARQ ECS 152A Computer Networks
Stop and Wait - ARQ • Source transmits single frame • Wait for ACK • If received frame damaged, discard it • Transmitter has timeout • If no ACK within timeout, retransmit • If ACK damaged,transmitter will not recognize it • Transmitter will retransmit • Receive gets two copies of frame • Use ACK0 and ACK1 ECS 152A Computer Networks
Stop-and-wait ARQ Example ECS 152A Computer Networks