









Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!










Example Questions for Final Exam CS 162 I. Stoica Spring 2011 Store and Forward 1 Hosts A and B are connected to each other via router R. R is a store-and-forward router. The bandwidth from A to R is 10Mbps, and the bandwidth from R to B is 5Mbps. The one-way latency of each link is 22ms. Assume host A sends a 30KB file to host B. a) Assume the file is divided into two packets, p1 and p2, where p1 has a length of 10KB, and assume the packets are sent back-to-back. What is the difference between the arrival times of the first and the second packet at host B? b) What is the effective throughput between A and B in part (a)? (The transmission time is the time interval from the time the first bit is sent at A until the final bit is received at B). c) Does the throughput increase or decrease if we divide the file into smaller packets? Why? d) Now, assume each packet is acknowledged. The file is divided into 6 packets of the same size. How long would it take to send the entire file assuming that the sender cannot send a new packet before it receives an acknowledgment for the previous packet? (The transfer time is the time interval measure at source A from the time the first segment is sent until the acknowledgement of the last segment is received). Ignore the transmission time of the acknowledgements Solution: a) The difference is the transmission time of packet B over the second link time: size/bw= 820/5000 = 160/5000 = 32ms b) Total transfer-time: calculate how long the second packet takes and add the wait for the first packet over link A-R. A-R wait is: 810/10000 = 8ms Now time to send B is 820/10000 + 820/5000 + 44ms = 16ms + 32ms + 44ms=92ms Total time: 100ms THROUGHPUT: 30k/100ms = 0.3MBps or 2.4 Mbits/s c) The throughput will increase – because a smaller packet is received at R and can be forwarded immediately (don’t have to wait till the entire original packet is transmitted over the first link to start transmitting over the slower second link) d) Size of 1 packet = 5KB transmit time /packet= 44 + 44ms + 58/10000+58/5000= 44ms +44ms + 4ms + 8ms = 100ms so for 6 = 600ms
Store and Forwarding 2 Consider two packets that are sent back to back (i.e., one right after another) along the path A-B-C-D, where A, B, C, and D are store-and-forward routers. Assume the capacity of link (A, B) is 10Mbps, the capacity of (B, C) is 1Mbps, and the capacity of (C, D) is 100Mbps. The propagation delay along each link is 10 ms. Assume the size of the first packet is 1000 bits, and that the size of the second packet is 500 bits. What is the inter-arrival time between the two packets at node D? The inter-arrival time is equal to the arrival time of the second packet minus the arrival time of the first packet at node D. Notes: Assume there is no cross-traffic; the two packets are the only ones in the network. The arrival time of a packet is the time when the last bit of the packet was received. With a store-and-forward router a packet is forwarded only after the last bit of the packet was received. Answer See the time diagram below bellow (l 1 = 1000b, l 2 = 500b, C 1 = 10Mbps, C 2 = 1Mbps, C 3 = 100Mbps) The inter-arrival time between the two packets at D is l 2 /C 2 – l 1 /C 3 + l 2 /C 3 = 500b/10^6 Mbps - 1000b/10^8 Mbps + 500b/10^8 Mbps = 0.495 ms
l 1 /C 1 l 2 /C 1 l 1 /C 2 l 2 /C 2 l 1 /C 3 l 2 /C 3 l 2 /C 2 – l 1 / C 3 + l 2 /C 3
T (ms) I (ms) 0
Store and Forward 4 (Measuring link capacities ) Consider the network below where three hosts A, B, and C, respectively, are connected to router R. The capacity of the links are x Kbps, y Kbps, and z Kbps, respectively. Assume the users of hosts A, B, and C, respectively, want to measure the capacities of the three links. To achieve this, they send the following messages:
Sliding Window 1 Assume two end-hosts communicate using the sliding window protocol. Assume the receiver window is always smaller than the sender’s window and the size of the receiver window is w bits. Let C be the link capacity between the two end-hosts in bps, and RTT be the roundtrip time between the two end-hosts in sec. What is the maximum throughput achieved by the two end-hosts? Note: Assume every bit is acknowledged. Answer: There are two cases (see figure below) case a: RTT > w/C, throughput = w/RTT case b: RTT <= w/C, throughput = C RTT w/C sender receiver w/C
sender receiver (a) (b)
Page 8 Sliding Window 2 Consider two links, (A,B) and (B,C), with propagation delays of d1 and d2, respectively. Assume that host A sends M packets to host C using a sliding window flow control protocol with a window of size W. a) How much does it take to send all packets from A to C when the flow control protocol is implemented end-to-end between A and C? (5 pt) b) How much does it take to send all packets from A to C when the flow control protocol is implemented on each link instead of end-to-end? (5 pt) Notes: Ignore queueing delay and transmission times. The time it takes to transfer all packets is the difference between the time when the last acknowledgement is received and the time the sender sent the first packets.
this functionality. (b) The transport layer can detect errors that occur after a packet has passed the data link layer. For example, a packet can be corrupted in the buffer or the switching backplane of a router. Another example is when a stronger error detection technique is used at the transport layer. Since the transport layer is implemented only at end-hosts and not on every router along the path, typically more computational resources are available at the transport layer. Note: You have to give an example that some how involves corrupt bits. If you talk about lost or corrupt packets, you receive partial credit only. (c) Implementing error detection at a lower layer can improve performance. The transport layer can only detect errors at the destination, and hence the packet with the error is carried over the entire path wasting bandwidth. The retransmission has to be done over the entire path too. Another example is that different data link layer technologies have different error characteristics, so a high error rate technology (wireless) can have strong error detection, while a low error rate technology (optical) can have weak error detection. We can thus avoid the overhead of having strong error detection over the entire path. Cryptography (a) What is the main advantage of the public key cryptography (e.g., RSA) over the symmetric key cryptography (e.g., DES)? (5 pt) (b) Assume that two hosts A and B use public key cryptography to ensure confidentiality. Enumerate the steps followed by the two hosts to send a message from A to B. (You don’t need to give any formulas) ( pt) Answer: (a) The main advantage of public key over symmetric key cryptography is that the public key cryptography does not require sending any secret key over the network.
(b)
Each node contains approximately log(N) successors, where N is the number of nodes in the system. The ring gets disconnected only if a node loses its successors, which is a relatively small probability. b) Imagine a Chord overlay network is formed by connecting a few nodes in UC Berkeley and a few nodes in MIT. Consider the two following approaches for assigning node IDs. i) The IDs of the UCB nodes have the first bit set as 1, where the IDs of the MIT nodes have the first bit set as 0. ii) Node IDs are generated by taking a hash of the IP address and port number at which the nodes run. Name the advantages and disadvantages of these two approaches? i) Advantage: Faster lookups, as nodes in the same geographic region can find other nodes in the same geographic region contacting only close by nodes. Disadvantage: Less resilience, as the failures of nodes in the same geographic region of nodes at MIT will very likely disconnect the network. ii) The other way around. c) In the basic Chord protocol, node n maintains fingers fi = succ( n + 2i-^1 ), for i = 1, 2, …, m , where m represents the number of bits of an ID. Now assume a variant of Chord where node n keeps a fingers fi = succ( n+ 4 i-^1 ), for i = 1, 2, …, m/2. How does the number of hops of a lookup in the modified Chord protocol compare to the number of hops of a lookup in the basic Chord? Explain your answer. Let d be the distance between the source and the destination node. In the case of basic Chord, every hop you reduces the distance to the destination by at least half (1/2) so it will take at most log 2 d. In contrast, in the modified Chord, each hop reduces the distance to the destination by at least one quarter (1/4), so in the worst case there are still three quarters (3/4) of the distance to the destination. Thus, in this case it will take at most log(4/3)d to reach the destination. Security – Programming Bugs Consider the following simple C code: #include <stdio.h> void manipulate(char *buffer) { char newbuffer[80]; strcpy(newbuffer,buffer); } int main() { char ch, buffer[256];
int i=0; while ((ch = getchar()) != '\n') { buffer[i] = ch; i++; } manipulate(buffer); printf("The value of i is : %d\n",i); return 0; } (a) Identify two bugs in the code above and explain their implications. i) strcpy() in manipulate() needs to check for length of the buffer before copying in newbuffer. ii) The while() in main() should make sure that i doesn’t exceed buffer length. (b) Explain how you can fix the two bugs. i) strcpy() should make sure that length of buffer doesn’t exceed the size of newbuffer, i.e., 80. ii) Replace while() in main with while (((ch = getchar()) != '\n') && i < 256) Network Performance Metrics Complete each statement with a short “fill in the blank” phrase (1 point per fill-in): a. File transfer, Email, and web access require two properties from the network:
you. Can you design a simple protocol to communicate confidentially with X in both directions (i.e., no one else knows what you and X are sending to each other)? If yes, specify the protocol, otherwise argue why this is not possible. Yes. You send messages to X encrypted with X’s public key and only X can decrypt them. Also, you send X in the first message your public key or a secret key with each X can encrypt the return communication. Note that this does not imply you are authenticated to X. Miscellaneous 2 For each of the following statements, indicate whether the statement is True or False, and provide a very short explanation of your selection. a. Time division multiplexing allows a connection to use unused slots of another connection. T F Rationale: False. Unused slots cannot be used by other connection. b. In datagram switching networks two packets of the same flow always take the same route. T F Rationale: False. Each packet is forwarded independently. c. Sliding window achieves higher throughput than Stop-and-Go. T F Rationale: True. Sliding window allows more in-the-fly packets during the same RTT. d. Flow control slows down the sender when the network is congested. T F Rationale: False. Flow control slows down the sender when the receiver is slow. (Congestion control slows down the sender when the network is congested.) e. Multiplexing a large number of flows reduces burstiness. T F Rationale: True. As number of flows increases, aggregate_peak/aggregate_avg decreases, as there less chance that the peak utilization of all flows coincide. Concurrency Control For parts (a-d), consider the following schedule of three transactions. Commit abbreviated “com” Operation 1 2 3 4 5 6 7 8 9 10 11 12 T1: R(C) R(A) W(A) com T2: W(C) R(A) W(B) com T3: R(A) R(A) W(B) com a) Draw the dependency graph for this schedule. Be sure to list the object(s) (A, B, or C) that is (are) the cause of each dependency on each edge.
b) Is this schedule conflict-serializable? If so, list a serial ordering of the transactions that would produce an equivalent schedule. If not, state why not. Yes. T3 - > T1 - > T2. c) This schedule of read and write operations could be generated by a system following the regular 2PL (two phase locking) protocol. (Circle one) TRUE FALSE d) This schedule of read and write operations could be generated by a system following the Strict 2PL protocol. (Circle one) TRUE FALSE e) In general, is Strict 2PL is more likely to encounter deadlocks than regular 2PL? State Why or Why Not. Yes. Locks are held longer in Strict 2PL, thus increasing the likelihood of deadlocks.