Network Hardware Module
Role in the System
This module encapsulates the implementation of a physical network. The pertinent files are network.h and network.cc. The first task is to be able to uniquely identify each computer connected to the network. This is done by the "NetworkAddress" type definition. The network is formed by running several copies of NACHOS simultaneously. Hence, the number of open copies of NACHOS on a computer is the number of terminals in the network. The machine id of each computer is specified by the user on the command line of each open copy. Messages are transmitted in collections of data called "packets". The packet must contain special information in the packet header. In NACHOS, this is implemented in class "PacketHeader". This segment contains information about:
- the machine id of the destination for the packet
- the machine id of the source of the packet
- the size (in bytes) of the remaining data being transported in the packet
Furthermore, the maximum size of information that can be transmitted down a "wire" of the network and the largest size that a packet can possibly assume also needs to be established. This is done by the variable names "MaxWireSize" and "MaxPacketSize" respectively. The baseline NACHOS initially sets up an unreliable network with fixed-length packets. The reliability of the network is specified by initializing the constructor for the class Network a number between 0 and 1. This represents the probability that a packet will not be delivered. When a packet is sent or received, an interrupt is generated; being either "readAvail" or "writeDone" (note the similarity of this to the console module). One of the assignments for NACHOS involves implementing a reliable network with variable-length packets.
Uses Relation