The University of Western Australia
Computer Science and Software Engineering
 
 

Department of Computer Science and Software Engineering

CITS3002 Computer Networks

Labsheet 3 - sample solutions and discussion

  1. For this task, using the cnet network simulator:

    • Add piggybacking to the standard stop-and-wait protocol.
    • Modify the topology file, changing the attributes of message delivery, bandwidth, frame corruption and loss, to determine under which conditions piggybacking offers an advantage.

    We need to make a small number of modifications to the stop-and-wait protocol to construct our piggyback protocol:

    1. Every frame carries two sequence numbers - one identifying any data in the frame (in the payload), and one identifying any acknowledgment in the frame. As in the stop-and-wait protocol, the sequence numbers can only meaningfully alternate between 0 or 1, so we can use an 'impossible' value, such as -1, to indicate if the frame does not carry either data or an acknowledgment (it must be carrying one of them).

    2. We now require two timers - the original to retransmit a data frame if its acknowledgment does not return in time, and a second to transmit an acknowledgment by itself if there is no outgoing data on which to piggyback it.

    3. When a frame arrives at the Physical Layer, we must process the data it (may be) carrying and process the acknowledgment it (may be) carrying. If the frame contains only data, we do not send corresponding acknowledgment immediately, but start our second timer to possibly send the acknowledgment by itself in the future.

    [sample solution: piggyback.c]

  2. To perform a valid scientific experiment (which, after all, is what we're doing), we need to hold all conditions/arrtibutes constant and vary just one over time, perform the same experiment for both the stop-and-wait and piggybacking protocols.

    As in Labsheet 2, develop a plot to help you to visually compare the results of your experiment.

    It is important compare the stop-and-wait and piggyback protocols under the same conditions. An easy way to manage this is to write the common attributes into a single file, and then have the STOPANDWAIT and PIGGYBACK topology include this common information (cnet topology files are first passed through the C pre-processor). For example:

    // TOPOLOGY FILE FOR A SIMPLE DATA-LINK LAYER PROTOCOL EMPLOYING PIGGYBACKING
    compile     = "piggyback.c"
    
    #include    "ATTRIBUTES.common"
    

    Remember why we are considering piggybacking - to reduce the number of frames crossing the Physical Layer and, thus, to reduce the number of hardware interrupts managed by each node's operating system. Because the piggyback protocol introduces an artificial delay, waiting for an outgoing data-frame to carry each acknowledgment, the rate of progress of the protocol is necessarily slower and will transmit fewer Application Layer messages.

    [sample solution, containing C source and topology files: stopandwait-vs-piggyback.zip]

 

Chris McDonald

March 2020.

This Page

Written by: [email protected]