Binary exponential algorithm to be implemented in java language

CSCI 3171 Network Computing
Assignment 3: Binary Exponential Backoff
Due: 23:55, April 2, 2021
– Teaching Assistants:
o Yang Di ([email protected])
o Raouf Rokhjavan ([email protected])
o Hui Huang ([email protected])
o David Dempsey ([email protected])
o Rao Huang ([email protected])
– TA Help Hours via the Channel “Office Hour – TAs” on MS Teams:
o Monday: 11:35am-12:55pm, Yang Di (Languages: Java, C, Python)
o Tuesday: 4pm-5pm, Raouf Rokhjavan (Languages: Java, C, Python)
o Wednesday: 9am-10am, Hui Huang (Languages: C, Python)
o Thursday: 3pm-4pm, David Dempsey (Languages: Java, C, Python)
o Friday: 10am-11am, Rao Huang (Languages: Java, C, Python)
1. Assignment Overview
In Ethernet, Binary Exponential Backoff (BEB) is used to schedule frame retransmissions
when a collision takes place. In this assignment, you need to implement a program that uses
BEB to schedule frame retransmissions. Your program will be tested on the undergraduate
server “timberlea.cs.dal.ca”, which is a Linux machine.
2. Important Information
There is a zero-tolerance policy on academic offenses such as plagiarism or inappropriate
collaboration. By submitting your solution for this assignment, you acknowledge that the
code submitted is your own work. You also agree that your code may be submitted to a
plagiarism detection software (such as MOSS) that may have servers located outside Canada
unless you have notified me otherwise, in writing, before the submission deadline. Any
suspected act of plagiarism will be reported to the Faculty’s Academic Integrity Officer in
accordance with Dalhousie University’s regulations regarding Academic Integrity. Please
note that:
1) The assignments are individual assignments. You can discuss the problems with your
friends/classmates, but you need to write your program by yourself. There should not be
much similarity in terms of coding.
2) When you refer to some online resources to complete your program, you need to
understand the mechanism, then write your own code. In addition, you should cite the
sources via comments in your program.
2
3. Detailed Requirements
1) Overview: In Ethernet, Binary Exponential Backoff (BEB) is used to schedule frame
retransmissions when a collision takes place. In this assignment, you need to write a program
that implements BEB.
In this assignment, we have the following assumptions:
a) Slotted Time: In this assignment, Ethernet is operated in a slotted manner. That is,
time is divided into a series of timeslots (i.e. Timeslot 0, Timeslot 1, etc.).
b) Frame Transmission: All the stations that have data to send are only permitted to
transmit frames at the beginning of a timeslot. In addition, it takes 1 timeslot to
transmit a frame successfully. This means that if a station sends out a frame at the
beginning of a timeslot, with no collision, the frame is successfully received by the
destination station by the end of the timeslot.
c) Single Channel: There is only one transmission channel in the network under
investigation.
d) Collision: When two or more stations 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.
e) Collision Detection: Collision detection is finished during the same timeslot in which
multiple frames are sent out simultaneously. Namely, if two or more stations send
their frames at the beginning of a timeslot, all the stations will know that there has
been a collision by the end of the timeslot.
f) Retransmission Scheduling: In the case of collision, BEB is used to schedule
retransmissions. Specifically, after i collisions, a random integer R between 0 and 2i –
1 is generated by each station involved in the collision. Once the random number R is
generated, the corresponding station will wait R timeslots and thereafter retransmit
its frame. For simplicity, we assume that a station gives up its frame transmission
after 5 retransmissions. Namely, if the fifth retransmission leads to a collision, the
station will not retransmit its frame any more.
g) Random Numbers: In real Ethernet, each station generates its own random numbers
when necessary. In this assignment, the random numbers used by the stations are
provided via an input file named “Input.txt”.
h) Number of Stations: In the network under investigation, there are N stations. Note
that, in this assignment, N could be 2, 3, 4, or 5.
i) Station Name: When there are N stations in the network, the names of the stations are
simply Station1, Station2, …, StationN respectively.
j) Network Traffic: For simplicity, we assume that every station in the network has only
one frame to send at the beginning of Timeslot 0. With this assumption, there is
always a collision during Timeslot 0 because N is at least 2. Once Timeslot 0 is over,
the stations in the network will use BEB to reschedule their frame retransmissions. A
station will remain inactive (i.e. it will not send a frame any more) after its frame is
successfully transmitted. After each unsuccessful frame transmission, a station will
use BEB to reschedule a retransmission till five retransmissions have been completed.
3
In this assignment, your program needs to:
a) Retrieve the specific value of N and the random numbers from the input file; display
the value of N and the retrieved random numbers on the screen.
b) Use BEB to reschedule frame retransmissions; display the timeslot in which a station
successfully completes its frame retransmission and the total number of
retransmissions that the station has completed (or display the timeslot in which a
station completes its last retransmission and the total number of retransmissions that
the station has completed if the last retransmission does not lead to a successful
transmission).
2) Input File: In this assignment, there is one input file: “Input.txt”. This file includes N+1
lines. The specific value of N is specified in the first line. The remaining lines in the file are
used to provide the random numbers for the stations. Specifically, line X+1 includes the
random numbers for StationX (note that X is a positive integer). The Y-th number in line X+1
is the Y-th random number for StationX. For example, the 1st random number in line 2 is the
1st random number used by Station1 to schedule its 1st retransmission. Similarly, the 2nd
random number in line 4 is the 2nd random number used by Station3 to schedule its 2nd
retransmission.
Since a station gives up its frame transmission after 5 retransmissions, only 5 random
numbers need to be provided for each station. Consequently, each line in “Input.txt” (except
the first line) includes 5 numbers. An example “Input.txt” is provided in this assignment. The
content of the example “Input.txt” is:
2
1,1,6,11,6
1,3,2,4,29
For this example input file, the following sentences should be displayed on the screen:
The number of stations in the network under investigation is:
2
The random numbers used by the stations are:
1,1,6,11,6
1,3,2,4,29
3) Output: Once the value of N and the random numbers are available, BEB is used to
schedule frame retransmissions.
If a station can successfully retransmit its frame within 5 attempts, the outcome of the station
is “Success”. The timeslot in which a station successfully completes its frame retransmission
and the total number of retransmissions that the station has completed should be displayed
on the screen.
4
If a station cannot successfully retransmit its frame within 5 attempts, the outcome of the
station is “Failure”. The timeslot in which a station completes its last retransmission and the
total number of retransmissions that the station has completed should be displayed on the
screen.
For the example input file mentioned previously, the following output lines should be
displayed on the screen:
Station1: Success
Timeslot for Successful Retransmission: 4
Total Number of Retransmission: 2
Station2: Success
Timeslot for Successful Retransmission: 6
Total Number of Retransmission: 2
Note that in this example, after the first collision in Timeslot 0, both Station1 and Station2
wait 1 timeslot according to their first random numbers (which is 1 for both Station1 and
Station2 in this example) and retransmit their frames during Timeslot 2. Since there are two
frame transmissions in Timeslot 2, there will be a collision. Consequently, both Station1 and
Station2 need to use their second random numbers (i.e. 1 for Station1 and 3 for Station2) to
reschedule their second retransmission. Therefore, after waiting for 1 timeslot, Station1
retransmits its frame in Timeslot 4, which leads to a successful retransmission. After waiting
for 3 timeslots, Station2 retransmits its frame in Timeslot 6, which also leads to a successful
retransmission.
If the content of the example “Input.txt” is changed to:
3
0,3,2,6,22
0,2,7,13,19
0,3,2,6,22
The output should be:
Station1: Failure
Timeslot for Last Retransmission: 38
Total Number of Retransmission: 5
Station2: Success
Timeslot for Successful Retransmission: 4
Total Number of Retransmission: 2
Station3: Failure
Timeslot for Last Retransmission: 38
Total Number of Retransmission: 5
5
Note that in this modified example, after the first collision in Timeslot 0, Station1 and
Station3 tried to retransmit their frames five times after waiting for 0,3,2,6,22 timeslots
respectively. However, since Station1’s and Station3’s attempts are carried out during the
same timeslots, their attempts always lead to collisions. Their last attempts are completed in
Timeslot 38, which lead to “Failure”. The specific timeslot number “38” is based on the
random numbers “0,3,2,6,22”. It can be calculated using the following equation: (0+1) +
(3+1) + (2+1) + (6+1) +(22+1) = 38. In the case of Station2, after two retransmissions (note
that the wait periods are 0 and 2 timeslots respectively), a successful retransmission is
completed in Timeslot 4.
4) Additional Information:
a) The first timeslot is Timeslot 0 (instead of Timeslot 1).
b) You should assume that “Input.txt” is in the same directory as your program.
c) You can use the example input file to test your program. Note that the marker will use
different test cases to evaluate your program.
d) “timberlea.cs.dal.ca” is the computer used by the TA to evaluate your program.
Therefore, you need to make sure that your program works on timberlea.
a. You can use your CS ID to log on to “timberlea.cs.dal.ca” in order to write your
program. Alternatively, you can write your program on other machines, then
transfer your program to timeberlea and thereafter test it on timberlea.
b. If you do not know your CS ID, you can visit the following webpage to get your
CS ID. If your CS ID does not work or you have a question about your CS ID,
please send an email to “[email protected]”.
https://csid.cs.dal.ca/
e) Programming Languages: You can use any of the following programming languages
to write your program: Java, C, and Python. However, you need to make sure your
program can be correctly compiled and executed on “timberlea.cs.dal.ca”.
f) To compile and run your program on timberlea, you have to use the command-linebased
user interface. Note that timberlea only provides a command-line-based user
interface. The marker CANNOT use an IDE (such as IntelliJ IDEA) to run your program
on timberlea. Instead, the marker needs to enter compiling/running commands to
compile and run your program.
a. Here is a tutorial on compiling and running a Java program via the commandline-
based user interface on Linux (note that Step 1 in the tutorial can be
ignored because Java software development kit has been installed on
timberlea):
https://www.techinfected.net/2018/04/compile-and-run-java-program-inlinux-
ubuntu.html
b. Here is a tutorial on compile a Java program involving multiple Java source
files:
https://www.codejava.net/java-core/tools/using-javac-command
g) To compile and run your program on timberlea, you might need to upload a file to or
download a file from timberlea (of course, if you write your program directly on
timberlea, you do not need to transfer files to timberlea). The following webpage
includes a tutorial on timberlea downloading/uploading. Note that the example
6
computer used in the tutorial is bluenose.cs.dal.ca (which is the old undergraduate
server). You should replace bluenose.cs.dal.ca with timberlea.cs.dal.ca when you go
through the webpage.
https://web.cs.dal.ca/~society/#/
h) Compiling and running your program on timberlea.cs.dal.ca should not lead to errors
or warnings.
5) Readme File: You need to complete a readme file named “Readme.txt”, which includes the
instructions that the TA could use to compile and execute your program on timberlea via the
command-line-based user interface.
6) Submission: Please pay attention to the following submission requirements:
a) You should place “Readme.txt” in the directory where your program files are located.
b) Your program source files and “Readme.txt” should be placed in a folder named
“YourFirstName-YourLastName-ASN4”. Thereafter, you need to convert the folder
into a zip file named “YourFirstName-YourLastName-ASN4.zip”. For example, my zip
file should be called “Qiang-Ye-ASN4.zip”.
c) Finally, you need to submit your zip file for this assignment via brightspace
(specifically, via Assignment 4: Submission Link).
Note that there is an appendix at the end of this document, which includes the commands
that you can use to generate zip files on timberlea. In addition, there is another appendix,
which illustrates how to view and kill your processes on timberlea.
4. Grading Criteria
The TA will use your submitted zip file to evaluate your assignment. The full grade is 12
points. The details of the grading criteria are presented as follows.
• “Readme.txt” with the correct command-based compilation/execution instructions is
provided. [1 Point]
• Retrieve the specific value of N and the random numbers from the input file; display the
value of N and the retrieved random numbers on the screen. [1 Point]
• Use BEB to reschedule frame retransmissions; display the timeslot in which a station
successfully completes its frame retransmission and the total number of retransmissions
that the station has completed (or display the timeslot in which a station completes its
last retransmission and the total number of retransmissions that the station has
completed if the last retransmission does not lead to a successful transmission). [9
Points]
• Proper programming format/style (e.g. proper indentation, proper variable names,
proper comments, release the memory that is dynamically allocated when it is not
needed any more, etc.). [1 Point]
Please note that when “Readme.txt” is not provided or “Readme.txt” does not include the
compilation/execution instructions, you will receive a zero grade if your program cannot be
successfully compiled/executed by the marker.
7
5. Academic Integrity
At Dalhousie University, we respect the values of academic integrity: honesty, trust, fairness,
responsibility and respect. As a student, adherence to the values of academic integrity and
related policies is a requirement of being part of the academic community at Dalhousie
University.
1) What does academic integrity mean?
Academic integrity means being honest in the fulfillment of your academic responsibilities
thus establishing mutual trust. Fairness is essential to the interactions of the academic
community and is achieved through respect for the opinions and ideas of others. Violations
of intellectual honesty are offensive to the entire academic community, not just to the
individual faculty member and students in whose class an offence occur (See Intellectual
Honesty section of University Calendar).
2) How can you achieve academic integrity?
– Make sure you understand Dalhousie’s policies on academic integrity.
– Give appropriate credit to the sources used in your assignment such as written or oral work,
computer codes/programs, artistic or architectural works, scientific projects, performances,
web page designs, graphical representations, diagrams, videos, and images. Use RefWorks to
keep track of your research and edit and format bibliographies in the citation style required
by the instructor. (See http://www.library.dal.ca/How/RefWorks)
– Do not download the work of another from the Internet and submit it as your own.
– Do not submit work that has been completed through collaboration or previously submitted
for another assignment without permission from your instructor.
– Do not write an examination or test for someone else.
– Do not falsify data or lab results.
These examples should be considered only as a guide and not an exhaustive list.
3) What will happen if an allegation of an academic offence is made against you?
I am required to report a suspected offence. The full process is outlined in the Discipline flow
chart, which can be found at:
http://academicintegrity.dal.ca/Files/AcademicDisciplineProcess.pdf and includes the
following:
a. Each Faculty has an Academic Integrity Officer (AIO) who receives allegations from
instructors.
b. The AIO decides whether to proceed with the allegation and you will be notified of the
process.
c. If the case proceeds, you will receive an INC (incomplete) grade until the matter is resolved.
8
d. If you are found guilty of an academic offence, a penalty will be assigned ranging from a
warning to a suspension or expulsion from the University and can include a notation on your
transcript, failure of the assignment or failure of the course. All penalties are academic in
nature.
4) Where can you turn for help?
– If you are ever unsure about ANYTHING, contact myself.
– The Academic Integrity website (http://academicintegrity.dal.ca) has links to policies,
definitions, online tutorials, tips on citing and paraphrasing.
– The Writing Center provides assistance with proofreading, writing styles, citations.
– Dalhousie Libraries have workshops, online tutorials, citation guides, Assignment
Calculator, RefWorks, etc.
– The Dalhousie Student Advocacy Service assists students with academic appeals and
student discipline procedures.
– The Senate Office provides links to a list of Academic Integrity Officers, discipline flow chart,
and Senate Discipline Committee.
Appendix 1: How to Use Zip and Unzip on Timberlea
1) To convert a folder named “Assignment-Folder” into a zip file named “Assignment.zip”, use
the following command:
zip -r Assignment.zip Assignment-Folder
2) To unzip zipfile, use the following command:
unzip Assignment.zip
Appendix 2: How to View/Kill Your Processes on Timberlea
Due to programming mistakes, you might leave a number of running processes on timberlea.
When you leave too many running processes timberlea, your timberlea account could be locked
temporarily (then you need to talk to CS Help to unlock your account). To view/kill your
processes on timberlea, you can use the following commands. Please keep an eye on your
processes on timberlea.
1) Command to display the processes belonging to a specific ID (i.e. UID): ps -u UID
2) Command to kill a process using process ID (i.e. PID): kill -9 PID
3) Command to kill all processed belonging to a specific user ID (i.e. UID): pkill -u UID

Place your order
(550 words)

Approximate price: $22

Calculate the price of your order

550 words
We'll send you the first draft for approval by September 11, 2018 at 10:52 AM
Total price:
$26
The price is based on these factors:
Academic level
Number of pages
Urgency
Basic features
  • Free title page and bibliography
  • Unlimited revisions
  • Plagiarism-free guarantee
  • Money-back guarantee
  • 24/7 support
On-demand options
  • Writer’s samples
  • Part-by-part delivery
  • Overnight delivery
  • Copies of used sources
  • Expert Proofreading
Paper format
  • 275 words per page
  • 12 pt Arial/Times New Roman
  • Double line spacing
  • Any citation style (APA, MLA, Chicago/Turabian, Harvard)

Our guarantees

Delivering a high-quality product at a reasonable price is not enough anymore.
That’s why we have developed 5 beneficial guarantees that will make your experience with our service enjoyable, easy, and safe.

Money-back guarantee

You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.

Read more

Zero-plagiarism guarantee

Each paper is composed from scratch, according to your instructions. It is then checked by our plagiarism-detection software. There is no gap where plagiarism could squeeze in.

Read more

Free-revision policy

Thanks to our free revisions, there is no way for you to be unsatisfied. We will work on your paper until you are completely happy with the result.

Read more

Privacy policy

Your email is safe, as we store it according to international data protection rules. Your bank details are secure, as we use only reliable payment systems.

Read more

Fair-cooperation guarantee

By sending us your money, you buy the service we provide. Check out our terms and conditions if you prefer business talks to be laid out in official language.

Read more
error: Content is protected !!
Open chat
1
You can contact our live agent via WhatsApp! Via + 1 (929) 473-0077

Feel free to ask questions, clarifications, or discounts available when placing an order.

Order your essay today and save 20% with the discount code SCORE