[Instructions] [Search] [Current] [News] [Syllabus] [Glance] [Links] [Handouts] [Outlines] [Labs] [Assignments] [Exams] [Examples] [Project]
Back to Miscellaneous Data-Link Issues. On to Work on Data-Link Project.
Held Monday, March 6, 2000
Overview
Today we conclude our discussion of the data-link layer with more details of the sliding window algorithm and new details of token ring networks.
Notes
Contents
Summary
FramedMessage senderWindow[SWS]; // The messages to send
Process processes[SWS]; // For repeated sends
int[] seqNums[SWS]; // The sequence numbers for each slot
int slot = 0; // The slot for the next message
int seqNo = 0; // The sequence number for next message
int filledSlots = 0; // The number of slots filled
int needsAck = 0; // The number of the first slot that
// needs an acknowledgement
void sendMessage(byte *message) {
// Wait until there's room in the window.
blockUntil(filledSlots < SWS)
++filledSlots;
// Frame the message and put in the window.
frame(sendWindow[slot], message, seqNo);
seqNums[slot] = seqNo;
// Send the message
physicalSendMessage(sendWindow[slot]);
// Prepare to send copies
processes[slot] = createResendProcess(slot);
// Move on to the next message
seqNo = (seqNo + 1) % MAXSEQ;
slot = (slot + 1) % SWS;
} // sendMessage(byte *message)
void resend(int slot) {
while (1) {
sleep(TIMEOUT);
physicalSendMessage(sendWindow[slot]);
}
}
void ackReceived(int acknum) {
// Make sure that it's a useful acknowledgement
if (!validAcknowledgement(acknum))
return;
// Clear appropriate messages
while (seqNums[needsAck] != acknum) {
killProcess(proccesses[needsAck]);
clearFrame(senderWindow[needsAck]);
--filledSlots;
needsAck++;
}
// Ugh. Duplicated code. Due to bad design
killProcess(proccesses[needsAck]);
clearFrame(senderWindow[needsAck]);
--filledSlots;
needsAck++;
} // ackReceived(int)
FramedMessage receiveWindow[RWS]; // The messages received More to come.
Thursday, 20 January 2000
Back to Miscellaneous Data-Link Issues. On to Work on Data-Link Project.
[Instructions] [Search] [Current] [News] [Syllabus] [Glance] [Links] [Handouts] [Outlines] [Labs] [Assignments] [Exams] [Examples] [Project]
Disclaimer Often, these pages were created "on the fly" with little, if any, proofreading. Any or all of the information on the pages may be incorrect. Please contact me if you notice errors.
This page may be found at http://www.math.grin.edu/~rebelsky/Courses/CS364/2000S/Outlines/outline.19.html
Source text last modified Mon Mar 6 14:08:04 2000.
This page generated on Mon Mar 6 14:11:35 2000 by Siteweaver. Validate this page's HTML.
Contact our webmaster at rebelsky@grinnell.edu