You are on page 1of 26
WELCOME | LEARNERS |e INDIA’S LARGEST LEARNING PLATFORM @ unacademy ‘Zunacademy we 7 ov ( educator ABOUT ME My Name is SWETA KUMARI. Completed B.TECH IN COMPUTER SCIENCE. Verified & Unacademy PLUS Educator. Presented Research Paper in NCCCS Got Selected in 2 IT Companies. Hobbies : Like Playing Different Games , Comedy Shows & Obviously Teaching. Zs Accolades : Top Educator at Unacademy. . é& ¥ 4 FOLLOW POLL QU lips /iacaieryconlinrraiomn) 20-60 Bytes @ unacademy TCP Segment structure a Source Port Address Destination Port 16 Bits Exley Secours teas Acknowledgement Number 32 Bits eae) » A elt = Hi Dr ur alas Tomi ee es Address 16 Bits eed reduc pS pC icy eure unacademy (ol Yt 40a aaa el c=) Source Port Address — 16 bit field that holds the port address of the application that is sending the data segment. Destination Port Address — 16 bit field that holds the port address of the application in the host that is receiving the data segment. 20-60 Bytes J veaoen | para | TCP Segment structure Source Port Address Poems pars fries Bete ‘Acknowledgement Number 32 Bits ene ey os Co eRe ML Coe pc Cie eed unacademy TCP Segment structure — Sequence Number - 32 bit field that holds the sequence number, i.e, the byte number of the first byte that is sent in that particular segment. It is used to reassemble the message at the receiving end if the segments are received out of order. 20-60 Bytes TCP Segment structure Source Port Address Poems pars Et Bete ‘Acknowledgement Number 32 Bits Pen rs Cea Perec Coe pc Cie eed unacademy TCP Segment structure — Acknowledgement Number — 32 bit field that holds the acknowledgement number, i.e, the byte number that the receiver expects to receive next. It is an acknowledgment for the previous bytes being received successfully. 20-60 Bytes J veaoen | para | TCP Segment structure Source Port Address Poems pars eet Bete ‘Acknowledgement Number 32 Bits Pen rs Cea Perec Coe pc Cie eed unacademy TCP Segment structure — Header Length (HLEN) — This is a 4 bit field that indicates the length of the TCP header by number of 4-byte words in the header, i.e, if the header is of 20 bytes(min length of TCP header), then this field will hold 5 (because 5 x 4 = 20) and the maximum length: 60 bytes, then it’ll hold the value 15(because 15 x4 = 60). Hence, the value of this field is always between 5 and 15. 20-60 Bytes J veaoen | para | TCP Segment structure Source Port Address Poems pars eet Bete ‘Acknowledgement Number 32 Bits Pen rs Cea Perec Coe pc Cie eed TCP Segment structure — Control flags — These are 6 1-bit control bits that contr connection establishment, connection termination, connection abortion, flow control, mode of transfer etc. Their function is: URG: Urgent pointer is valid ACK: Acknowledgement number is valic used in case of cumulative acknowledgement) PSH: Request for push RST: Reset the connection SYN: Synchronize sequence numbers FIN: Terminate the connection 20-60 Bytes J veaoen | para | TCP Segment structure Source Port Address Poems pars fete Bete ee Number 32 Bits ee ire Perera’ ems Bick ted Coe pc Cie eed unacademy unacademy TCP Segment structure — * Window size - __20-60Bytes This field tells the window size of Ee ae the sending TCP in bytes. * Checksum — TCP Segment structure rare eer) Peery This field holds the checksum for error control. It is mandatory in TCP as opposed to UDP. ene ey os Co eRe ML Coe pc Cie eed unacademy TCP Segment structure — Urgent pointer — This field (valid only if the URG control flag is set) is used to point to data that is urgently required that needs to reach the receiving process at the earliest. The value of this field is added to the sequence number to get the byte number of the last urgent byte. 20-60 Bytes J veaoen | para | TCP Segment structure Source Port Address Poems pars fries Bete ‘Acknowledgement Number 32 Bits ene ey os Co eRe ML Coe pc Cie eed unacademy TCP Congestion Control TCP uses a congestion window and a congestion policy that avoid congestion. Previously, we assumed that only receiver can dictate the sender’s window size. We ignored another entity here, the network. If the network cannot deliver the data as fast as it is created by the sender, it must tell the sender to slow down. In other words, in addition to the receiver, the network is a second entity that determines the size of the sender’s window. academy Congestion policy in TCP Slow Start Phase: * starts slowly increment is exponential to threshold Congestion Avoidance Phase: + After reaching the threshold increment is by 1 Congestion Detection Phase: * Sender goes back to Slow start phase or Congestion avoidance phase. unacademy Slow Start Phase : exponential increment * Inthis phase after every RTT the congestion window size increments exponentially. * Initially cwnd =1 After 1 RTT, cwnd = 24(1) = 2 2 RTT, cwnd = 24(2) = 4 3 RTT, cwnd = 24(3) =8 unacademy Congestion Avoidance Phase : ad * This phase starts after the threshold value also denoted as ssthresh. * The size of cwnd(congestion window) increases additive. + After each RTT cwnd = cwnd + 1. Initially cwnd =i After 1 RTT, cwnd = i+1 2 RTT, cwnd = i+2 3 RTT, cwnd = i+3 Congestion Detection Phase : multiplica decrement — . unacademy If congestion occurs, the congestion window size is decreased. The only way a sender can guess that congestion has occurred is the need to retransmit a segment. Retransmission is needed to recover a missing packet which is assumed to have been dropped by a router due to congestion. Retransmission can occur in one of two cases: when the RTO timer times out or when three duplicate ACKs are received. unacademy Slow Start Phase : exponential increment * Case 1: Retransmission due to Timeout — In this case congestion possibility is high. * (a) ssthresh is reduced to half of the current window size. (b) set cwnd = 1 (c) start with slow start phase again. * Case 2: Retransmission due to 3 Acknowledgement Duplicates — In this case congestion possibility is less. * (a) ssthresh value reduces to half of the current window size. (b) set cwnd= ssthresh (c) start with congestion avoidance phase academy ATE CS 2008 In the slow start phase of the TCP congestion control algorithm, the size of the congestion window (A) does not increase (B) increases linearly (C) increases quadratically (D) increases exponentially unacademy * Although the name is slow start, during the slow start phase, window size is increased by the number of segments acknowledged, which means window size grows exponentially. * This happens until either an acknowledgment is not received for some segment or a predetermined threshold value is reached. unacademy E CS 2012 Consider an instance of TCP’s Additive Increase Multiplicative Decrease(AIMD) algorithm where the window size at the start of the slow start phase is 2 MSS and the threshold at the start of the first transmission is 8 MSS. Assume that a time out occurs during the fifth transmission. Find the congestion window size at the end of the tenth transmission. (A) 8 Mss (B) 14 Mss (C) 7 MSs (D) 12 Mss 'Y unacademy Since Slow Start is used, window size is increased by the number of segments successfuly sent. This happens until either threshold value is reached or time out occurs. In both of the above situations AIMD is used to avoid congestion. If threshold is reached, window size will be increased linearly. If there is timeout, window size will be reduced to half. Window size for 1st transmission = 2 MSS. Window size for 2nd transmission = 4 MSS ee eon Answer (C) threshold reached, increase linearly (according to AIMD) Window size for 4th transmission = 9 MSS. Window size for 5th transmission 0 MSS time out occurs, resend 5th with window size starts with as slow start. Window size for 6th transmission MSS Window size for 7th transmission = 4 MSS. threshold reached, now increase linearly (according to AIMD) Additive Increase: 5 MSS (since 8 MSS isn’t permissible anymore) Window size for 8th transmission = 5 MSS. Window size for 9th transmission MSS Window size for 10th transmission = 7 MSS nacademy TE CS 2014 Let the size of congestion window of a TCP connection be 32 KB when a timeout occurs. The round trip time of the connection is 100 msec and the maximum segment size used is 2 KB. The time taken (in msec) by the TCP connection to get back to 32 KB congestion window is : (A) 1100 to 1300 (B) 800 to 1000 (C) 1400 to 1600 (D) 1500 to 1700 unacademy Current size of congestion window in terms of number of segments = (Size in Bytes)/(Maximum Segment Size) = 32KB / 2KB = 16 MSS When timeout occurs, in TCP's Slow Start algorithm, threshold is reduced to half which is 16KB or 8MSS. Also, slow start phase begins where congestion window is increased twice. So from 1MSS to 8 MSS window size will grow exponentially. Congestion window becomes 2MSS after one RTT and becomes 4MSS after 2 RTTs and 8MSS after 3 RTTs. At 8MSS, threshold is reached and congestion avoidance phase begins. In congestion avoidance phase, window is increased linearly. So to cover from 8MSS to 16MSS, it needs 8 RTTs Together, 11RTTS are needed (3 in slow start phase and 8 in congestion avoidance phase). unacademy GATE IT 20 On a TCP connection, current congestion window size is Congestion Window = 4 KB. The window size advertised by the receiver is Advertise Window = 6 KB. The last byte sent by the sender is LastByteSent = 10240 and the last byte acknowledged by the receiver is LastByteAcked = 8192. The current window size at the sender is (A) 2048 bytes (B) 4096 bytes (C) 6144 bytes (D) 8192 bytes YF unacademy Congestion Window: It is the factor which tells how much maximum byte can be sent througn network in TCP connection. It is dynamic in TCP. Receiver Advertised Window: It is the factor which tells what is the maximum capacity of receiver to receive the data in bytes. Total amount of maximum bytes that can be send by receiver at any time is called receiver window size. At any time receiver can send minimum of Congestion Window and Receiver Advertised Window. Thus current window size=min(congestion window ,receiver advertised window) in(4KB,6KB) ZgP1004 byteseaodsbytes ANSWER (B) But this is confusing question In my opinion 4KB will be for first time After that Receiver Window Size will be = buffered data(unacknowledged) + min(congestion window ,receiver advertised window) = Unacknowledged data= (10240-8192)bytes=2048 bytes. = (4096+2048) bytes=6144 bytes @ unacademy ae OE Waar lalekith ma celeetty TCP stands for Transmission Control Protocol which indicates that it does something to control the transmission of the data in a reliable way. The process of communication between devices over the internet happens according to the current TCP/IP suite model(stripped out version of OSI reference model). The Application layer is a top pile of stack of TCP/IP model from where network referenced application like web browser on the client side establish connection with the server. From the application layer , the information is transferred to the transport layer where our topic comes into picture. The two important protocols of this layer are - TCP, UDP(User Datagram Protocol) out of which TCP is prevalent(since it provides reliability for the connection established). However you can find application of UDP in querying the DNS server to get the binary equivalent of the Domain Name used for the website. © unacademy

You might also like