网络计算代写 | CSCI 3171 Network Computing

这个作业是编写一个实现ATWP的程序

CSCI 3171 Network Computing
Assignment 3: Adaptive Tree Walk Protocol

Detailed Requirements
1) Overview: Adaptive Tree Walk Protocol (ATWP) is a limited-contention protocol, which
can be used to determine the order in which a number of stations send their frames in a
network. In this assignment, you need to write a program that implements ATWP.
In this assignment, we have the following assumptions:
a) Slotted Time: Time is divided into a series of timeslots (i.e. Timeslot 0, Timeslot 1,
Timeslot 2, etc.).
b) Network Model: There are N stations in the network under investigation. Note that,
in this assignment, N could be 2, 4, 8, or 16. After the network is initialized, some of
the stations in the network have a frame to send (note that each of these stations has
only one frame to send).
c) Station Name: The name of a station is simply an uppercase character. When there are
N stations in the network, the first N uppercase characters (starting from “A”) are
used to name these stations. For example, when there are 2 stations in the network,
their names are A and B; when there are 4 stations in the network, their names are A,
B, C, and D.
d) Single Channel: There is only one transmission channel in the network under
investigation.
e) Collision: When two or more stations attempt to send their frames in the same
timeslot, there will be a collision because there is only one shared channel in the
network. In this scenario, the frames will be damaged; consequently, these frames
need to be retransmitted.
In this assignment, your program needs to:
a) Retrieve the specific value of N and the stations that have a frame to send from the
input file; display the value of N and the stations that have a frame to send on the
screen.
b) Use ATWP to determine what stations would send a frame during the upcoming
timeslots; display the names of the stations that would send a frame during upcoming
timeslots on the screen.
2) Input File: In this assignment, there is one input file: “Input.txt”. This file includes two lines.
The specific value of N is specified in the first line. The stations that have a frame to send are
listed in the second line. Note that the station names are separated by commas. An example
“Input.txt” is provided in this assignment. The content of the example “Input.txt” is:
8
C,E,F,H
For this example input file, the following sentences should be displayed on the screen:
For this example network, ATWP would organize the stations using the following tree:
3) Output: Once the value of N and the stations that have a frame to send are available, ATWP
could be used to determine what stations would send a frame during the upcoming timeslots.
The information on what stations would send a frame in the upcoming timeslots should be
displayed on the screen.
Specifically, there should be one line for each timeslot. Each line includes three parts:
timeslot number, a list of stations that would send a frame in the timeslot, and the outcome
of the timeslot. If a frame is successfully transmitted during the timeslot, the outcome of the
timeslot is “Success”; otherwise, the outcome of the timeslot is “Conflict”. Once the line
corresponding to the timeslot that is used to successfully send the last frame is displayed,
your program will be terminated.