T
Explain: The data line is controlled by the slave when the bus master specifies
a read operation. Acknowledgements are always performed by the receiver (master
or slave).
2. If
multiple devices attempt to master the bus at the same time the one with the
lowest I2C address will become the master and the others must back off. (3 pts)
F
Explain: The master’s I2C address is irrelevant. Collision detection happens when one master
writes a “1” to the SDA at the same time that another writes a “0”. The master writing the “1” can detect the
collision so it must back off. Therefore, it is the address of the addressee (the slave) that
determines priority since this is the first thing that is written to the bus by
the bus masters.
Session
Layer
3.
In our shared memory
implementation, it is okay for session layer messages be processed out of order
as long as the transport layer guarantees that the messages themselves are not
corrupted. (3 pts)
F
Explain: It is the job of the transport
layer to guarantee in-order message delivery, so that the session layer can
just process messages as they come in. In a more sophisticated system you might
want to have the ability to specify whether or not a message has an order dependency or not, perhaps by
setting up separate queues for separate ordered message streams.... but it would still be the job of the
transport layer to establish and manage these queues.
4.
There is no constraint on session
layer message lengths because I2C frames can be infinitely long. (3 pts)
F
Explain: Session layer message length has
nothing to do with the physical layer. That is the point of having layers. Even
though I2C allows infinite frames, your data link layer would probably limit
actual frame sizes so that you could achieve a good balance between throughput
and latency in the network (as discussed in class).
5.
What was the specific hazard that
the young engineer from Toyco was concerned about? list at least two for
mitigating (reducing the likelihood of) this hazard. (3 pts)
Over time, the plastic degrades to the point
that it does not cool off as fast, leaving that possibility that the young user
of the kid’s oven could get burned. There are several ways to mitigate this hazard,
including: Warning labels, leaving the warning light on longer, or adding
another thermister to sense the temperature of the plastic.
For safety reasons, you decided that each
device in your I2C embedded network should expect a message from its neighbor
once per second regardless of other activity. Assuming that the session layer
is capable of scheduling periodic tasks, how would you implement this protocol?
Describe the messages, system calls, and routines that you would add to the
session layer. Your design should require the application layer to set up the
chain, but not manage the protocol.
English or psuedo-code is fine. (10pts)
I would define the
following two systems calls:
ping(address, period); // cause the
session layer to send a “ping” message to the specified address at the
specified period in seconds.
watch(address, period); // cause the
session layer to expect at least one “ping” message from the specified address
in any given interval of the specified length (period) in seconds.
Example usage:
by pinging at twice the watch frequency, we can be sure that there is at least one
ping for every watch period, assuming that network latency does not hold things
up for more than ˝ of a second.
Application Code
...
ping(SELF+1,
.5); // ignoring the modulo arithmetic
watch(SELF-1,
1); // ignoring the modulo arithmetic
...
What to
add to the session layer (code handles only one watch/ping pair, could be
generalized)
void
ping(address, period);
ping_address = address;
schedule periodic_ping()
void
watch(address, period);
watch_address = address;
schedule periodic_watch()
void
periodic_ping(){
transport_send(ping_address,
makeMessage(PING,SELF));
}
void
periodic_watch(){
if (ping_received) ping received = FALSE;
else signal(WATCHDOG_FAILURE);
}
code to add to
the session_recv routine
...
PING: if (message[2] == watch_address)
ping_received = TRUE;
...