Salsa - Networking Topics Nachos Virtual Memory in Nachos


[ Source code in code/network | Quiz ]

Distribution of computation between several physical processors has become common in computer systems. This document discusses the networking component of operating systems. We first discuss networking in general terms and then explain the network implementation in Nachos.

Networking

Two schemes are in vogue for distributed computation. In a multiprocessor system, the processors share memory and a clock, and communication usually takes place through shared memory. In a distributed system, the processors do not share memory or a clock and communicate with one another through various communication networks, such as high-speed buses or telephone lines. From the point of view of a specific processor in a distributed system, the rest of the processors are remote, whereas its own resources are local. The processors in a distributed system may be called a host, site, or a node. When a process at site A wants to communicate with a process at site B, the message needs to routed properly to that site. This is the responsibility of a router. It can either be a host computer with routing software or a special-purpose device. Various routing protocols exist for determining the actual route on which a message will be sent.

The sites in a distributed network can be connected physically in a number of ways. We list the most common ones below:

The actual design (and implementation) of a network is specified by the International Standards Organization (ISO). In the ISO model, the network is organized as seven layers on each site. Each layer on a site communicates with the equivalent layer on the remote site. These are briefly listed below:

Networking in Nachos

Nachos provides the abstraction of unreliable, ordered, fixed-size message delivery to mailboxes on other directly connected machines. Messages can be dropped by the network but are never corrupted. Any thread running on Nachos can send a message to a mailbox on a directly connected machine using the PostOffice object. The PostOffice delivers packets to a specific buffer (a MailBox), based on the mailbox number stored in the packet header. Mail waits in the mailbox until a thread asks for it; if the mailbox is empty, threads can wait for mail to arrive in it. Thus, the PostOffice de-multiplexes incoming packets, delivering them to the appropriate thread. Each message contains a return address which is the id of the machine that sent the message, and a from box which is the number of the mailbox on the sending machine to which the receiving thread can send an acknowledgement.

The PostOffice class

The PostOffice class is defined in the the files post.h and post.cc in the network directory. This class defines a post-office or a collection of mailboxes. It is a synchronized object that provides two main operations: Send - send a message to a remote machine, and Receive - wait until a message is in the mailbox, then remove and return it. Incoming messages are put by the PostOffice into the appropriate mailbox, waking up any threads waiting on Receive.

The file post.h also defines three other classes - Mail, MailHeader and MailBox. Mail defines the format of an incoming/outgoing message. The constructor function of this class initializes a single mail message, by concatenating the PacketHeader (explained below) and the MailHeader. The MailHeader is part of the message header. It is prepended to the message by the PostOffice before the message is sent to the Network and contains the the destination mailbox address, the source mailbox address and the number of bytes in the message data. Thus, the packet that is delivered to the remote machine contains the actual message, the MailHeader and the PacketHeader (the Mail object). Finally, the MailBox class defines a single mailbox for messages. Incoming messages are put by the PostOffice into the appropriate mailbox, and these messages can then be retrieved by threads on that machine. A mailbox is implemented simply as a list of messages using the SynchList object (synchlist.h(cc)).

The Network Device

The emulation of a physical network connection is implemented in the files network.h and network.cc in the machine directory. The abstraction is one of ordered, unreliable, fixed-size packet delivery to other machines on the network. The class PacketHeader defines a network packet header and contains the network address of the destination and source machine, and the number of bytes in the message (excluding the PacketHeader but including the MailHeader).

The actual network device is defined by the Network class. This class simulates a network interface, using UNIX sockets to deliver packets between multiple invocations of Nachos. It contains routines to send and receive a packet from a remote machine.

The following figure summarizes the above discussion.

Want to know more about Networking?
Source code in code/network
Quiz

Back to Top

Last modified on Thursday, 29-May-97 17:04:06 EDT