
CS 228 Midterm of Fun
1) I plug my Ethernet card into a switch. Then I turn on the switch. How does the switch know
the MAC address of my Ethernet card?
2) I have a Macbook Pro. I has a 1Ghz CPU. It has 512 megabytes of ram. I'm connected to the
cable modem with a 100 megabits/second ethernet. The cable company tells me my account in
1 megabits/second each way. I notice that if I send a 1,000 byte packet to www.ceasar.com it
takes 400 milliseconds round trip, and that a 100 byte packet takes 300 milliseconds. What is
the bandwidth between me and www.ceasar.com?
3) Name one thing that select can do that poll simply cannot.
4) Assume this code is correctly used, and that fd1, fd2, and max are correctly set. Someone
running the following could would have a problem. Which problem would they have?
void wait4it(int fd1, int fd2, int max) {
while(1) {
fd_set r;
struct timeval tv;
FD_ZERO(&r);
FD_SET(fd1, &r); FD_SET(fd2, &r);
tv.tv_sec = 0; tv.tv_usec = 100;
int ret = select(max+1, &r, 0, 0, &tv);
if (ret < 0) { cout << “Error”; exit(1); }
if (ret >0) break;
}
}
5) Does a switch decide which port to forward a packet based on MAC addresses or IP numbers?
6) Why is an Ethernet's maximum theoretical usage 34%, but normal Aloha is only 17%? What
makes Ethernet so much more theoretically able to use more of it's bandwidth?