CMSC 417 F99 |
Exam 1 |
Name:_______________ |
Total points 30. Total time 75 mins. 2 problems over 2 pages. No book, no notes, no calculator.
1. [15 pts]
This problem deals with TCP congestion control, using the ``per-window'' model (defined in Note 5). For the data flow from Source to Sink shown above, assume the following: Source is either in multiplicative decrease or additive increase (i.e., congestion window decreases by half upon timeout and increases by 1 upon receiving ack of previous window). Timeout value at the Source is constant at 250 ms (milliseconds). Packet payload is 1 Kbyte. Roundtrip time consists entirely of the delay encountered in the router queue (i.e., zero delay encountered by acks). The router queue holds at most 7 packets, and needs 10 ms to serve a packet. Queue overflow is the only cause of packet loss. No other traffic enters the router queue.
2. [15 pts] This problem deals with a variation of the sliding-window data transfer protocol defined in Note 4. Recall that the source maintains send window, ns and na, and sends (D, datablock, cj) messages; the sink maintains receive window and nr, and sends (ACK, cj, w) messages, where cj is a modulo-N sequence number and ns, na, nr are unbounded integers. (We have omitted source id and sink id fields.)
In this problem, you have to ``implement'' a version
of the protocol where
The outline of the protocol is given below.
Source
Variables sbuff; // buffer of size RW datablocks ns; // {0, 1, ...} na; // {0, 1, ...} sw; // {0, 1, ..., RW} UserTx(datablock) { // called by Source's user if sbuff can hold datablock then put datablock in sbuff else X.wait() } Receive(ACK, cj, w) { update variables; wake up Source user if needed; send data messages if needed; } |
Sink
Variables rbuff; // buffer of size RW datablocks nr; // {0, 1, ...} rw; // {0, 1, ..., RW} UserRx( datablock ) { // called by Sink's user if next-in-sequence datablock available then return that datablock else Y.wait() } Receive(D, datablock, cj){ update variables; wake up Sink user if needed; send ack if needed; } Timeout { send ack; restart timer; } |
Give the code for the Receive(ACK, cj, w) and Receive(D, datablock, cj) events.
Your code must not exceed 20 lines in total. Program elegance counts. You lose points for long/inelegant code.
In your code, assume that the entries of a buffer can be accessed by indexing starting from 0 (at the head) and ending at n-1 (where n is the number of items in buffer). Assume operations like Remove(item) (returns item at the head if any and removes it from the buffer) and Append(item) (append item at the tail of the buffer).