%  6.826 (POCS Seminar) style file for scribe notes.
%
% You should save this file as pocs-header.sty
%
% Your main LaTeX file should look like this:
%
%        \documentstyle[12pt,pocs-header]{article}
%        \Scribes{*First1 Last1* and *First2 Last2*}
%         or \Scribe{*First Last*}
%        \Lecturer{*First Last*}
%         or \Lecturers{*First1 Last1* and *First2 Last2*}
%        \LectureNumber{*N*}
%        \LectureDate{*Date*}
%        \begin{document}
%        \MakeScribeTop
%
%        \section{*Section Name*}
%
%        *stuff*
%
%        \section{*Section Name*}
%
%        *stuff*
%
%        etc.
%
%       \end{document}
%
\documentstyle[12pt,pocs-header]{article}
\Scribes{Clifford Tse}
\Lecturer{Butler Lampson}
\LectureNumber{14}
\LectureDate{October 30, 1991}
\begin{document}
\MakeScribeTop

\section{Distributed Systems}

\subsection{Definition of a Distributed System}

A distributed system consists of a set of nodes and a set of links between
the nodes.  Distributed systems usually have the following characteristics:

\begin{itemize}

\item {\em Tolerant to Partial Failure}:  A distributed system is composed
of components.  Ideally, distributed systems should be able to tolerate
partial failure.  If one component fails, the rest of system should not
have to reset.  For example, the United States telephone system is designed
to be a distributed system --- if one section goes down, the whole
country's phones should not stop working.

\item {\em Communication is Expensive}: Communications between nodes on a
distributed systems are usually expensive, compared with process cycle
time.

\item {\em Multiple Management}:  As oppose to centralized systems, the nodes on
a distributed system normally have separated managements which are not
necessarily coordinated.

\end{itemize}

The definition of a distributed system can sometimes be a little fuzzy.  A
multiprocessor computer is an example of a single computer that is
sometimes treated as a distributed system: If one task or component fails,
the whole system shouldn't go down.

While many properties of distributed systems can be abstracted away, a
critical property is communication.  We will consider some communication
mechanisms for distributed systems in the next few lectures.  Today, we
will concentrate on the basic network architectures.

\section{ISO Seven-Layered Cake}

To reduce the their complexity, most networks are organized in a highly
structured way as series of layers or levels.  The number of layers, the
name of each layer, the contents of each layer and the function of each
layer differ from network to network.  However, in all networks the purpose
of each layer is to offer certain services to the higher layers, shielding
those layers from the details of how the offered services are actually
implemented.

The ISO defines a network model called the OSI (Open system
Interconnection) Reference Model.  The OSI model has seven layers:

\begin{enumerate}

\item {\em The Physical Layer}:  The physical layer is concerned with
transmitting raw bits, without regard to their meaning, over a physical
communication channel.

\item {\em The Data Link Layer}:  The data link layer is concerned with 
making a raw transmission facility appear free of transmission errors to
the network layer.  It accomplishes this task by having the sender break
the input data up into {\em data frames}, transmit the frames sequentially,
and process the {\em acknowledgment frame} sent back by the receiver.

\item {\em The Network Layer}:  The network layer is concerned with
encapsulation of the data and controlling operation of the network.  Given
the data to be transmitted, the network layer wraps headers, CRC and etc
around the data.  It is also responsible for handling routing,
congestion/overload.  The network layer should be fault tolerance.  Even in
times of failure, it should still provide some service, e.g. deliver a
fraction of the messages, instead of crashing.

\item {\em The Transport Layer}: The basic function of the transport layer
is to accept data from the session layer, split it up into smaller unit if
need be, pass these to the network layer, and ensure that the pieces all
arrive correctly at the other end.  The transport layer is an {\em
end-to-end} layer.  It takes care of establishing, deleting and
multiplexing connections across the network.  More details will be
discussed in next Monday's lecture.

\item {\em The Session Layer}:  The session layer allows users on different
machines to establish sessions between them.  A session allows ordinary
data transport, but also provides enhanced services useful in some
applications.  More details will be discussed in next Wednesday's lecture.

The definitions of the other two layers, {\em the presentation layer} and
{\em the application layer}, are not totally clear.  They are not discussed
during the lecture, but are included below for completeness.

\item {\em The Presentation Layer}:  The presentation layer performs
certain functions that are requested sufficiently often to warrant a
general solution for them.  It is mainly concerned with information
representation, such as the encoding and compression of the data.

\item {\em The Application Layer}:  The application layer contains a
variety of protocols that are commonly needed, such as the network virtual
terminal protocol and the file transfer protocol. 

\end{enumerate}

\section{Modelling a Network}

A network can be modeled as a multiset.  Packets on the network correspond
to elements of the multiset.  To send a message, the sender adds the
message to the multiset.  To receive a message, the receiver removes the
message from the multiset.  To allow for duplication of a packet by the
network, Dup() indeterminately duplicates a message of the multiset.  To
allow for loss of a packet by the network, Lose() indeterminately deletes a
message from the multiset.  We assume that messages cannot be corrupted.

\begin{small}

\ \\

{\bf MODULE} Network\\

{\bf TYPE}  

\ \ \ \ \ \ \ \ \ \ \ N = Multiset$[$M$]$

{\bf VAR}

\ \ \ \ \ \ \ \ \ \ \  m := N\{\}\\

{\bf APROC} Send($m$) = 

\ \ \ \ \ \ \ \ \ \ \ $<<$ m := m ++ $m$ $>>$\\

{\bf APROC} Rcr () -$>$ M = 

\ \ \ \ \ \ \ \ \ \ \ $<<$ {\bf VAR} $m$ $|$ $m$ $\in$ m =$>$ m := m $--$ $m$; RET $m$ $>>$\\

{\bf APROC} Lose() = 

\ \ \ \ \ \ \ \ \ \ \ $<<$ {\bf VAR} $m$ $|$ $m$ $\in$ m =$>$ m := m $--$ $m$ $>>$\\

{\bf APROC} Dup() = 

\ \ \ \ \ \ \ \ \ \ \ $<<$ {\bf VAR} $m$ $|$ $m$ $\in$ m =$>$ m := m ++ $m$ $>>$\\

{\bf END} Network\\

\end{small}

\section{Common Types of Network Architecture}

We will consider two common types of the networks, the broadcast network
and the switch network.

\subsection{Broadcast Networks}

Broadcast networks are commonly used for LANs.  On a broadcast network, all
stations are connected to a common transmission medium in a bus structure.
Each packet is broadcasted to the network and each station listens to the
network for packets with its address.  Flat addresses, usually 48 bits, are
usually used for broadcast networks.  Broadcasts and multicasts on such a
network are simple and cheap and are usually done by using hierarchical
addressing, e.g. designating some bit pattern to signify
broadcast/multicast modes.

The two common types of broadcast networks are the Ethernet and the Token
Ring.

\subsubsection{Ethernet}

Ethernet was originally proposed by researchers at Xerox PARC in the late
70's.  Ethernet has a bus structure.  The transmission medium is a coaxial
cable and all stations tap on the cable.  The medium access protocol for
Ethernet is CSMA/CD (Carrier Sense Multiple Access with Collision
Detection).  In CSMA/CD, when a station wants to transmit, it listens to
the channel.  If the channel is busy, it waits until the channel is idle.
If the channel is idle, it transmits a frame.  If more than one station
sense the channel to be idle and begin transmitting simultaneously, they
will both detect the collision.  In case of collisions, all stations abort
their transmissions and wait a random amount of time and start all over
again.  If after the maximum round trip time (see below), there is still no
collision, the transmission is safe.

If $\tau$ is the time that a signal takes to go from one end of the cable
to the other.  Then the round trip time is $2\tau$.  The standard length of
an Ethernet cable is 500m and the typical $\tau$ is 25 $\mu s$.  Each
transmission has to last for at least $2\tau$, otherwise collision will not
be detected.  So, with 10 Mbps transmission rate, the minimum size of a
packet is 64 bytes.

Ethernet has a bandwidth of 10 Mbps and has a limit on the length of the
cable and the number of stations on the network.

Ethernet uses exponential backoff time in cases of collision.  In other
words, the backoff time of a station increases exponentially in subsequent
collisions.

To compute the efficiency of Ethernet, let $k$ be the number of stations
and $p$ be the probability that a transmission will succeed.  Then the
time, $A$, required for one successful transmission (by any station) is
given by: \[ A = kp(1-p)^{k-1},\ where\ p = \frac{1}{k} \] As the number of
stations in the network increases, i.e.  $k \rightarrow \infty$: \[ A =
\frac{1}{e} \approx 0.34 \] The probability that a transmission takes $j$
trials before succeeding, $P(j\_trials)$, is given by: \[ P(j\_trials) =
\sum j(1-A)^{j-1}A \approx 1.7
\] The efficiency, $\eta$, is given by: \[
\eta = \frac{l}{l+1.7+2\tau},\ where\ l\ is\ the\ transmission\ time\ for\ a\ packet \]
$\eta$ is 99\% for packet sizes of 1500 bytes, 82\% for packet sizes of 100
bytes and 34\% for packet sizes of 64 bytes (the minimum packet size).


(cf: IEEE Standard 802.3)

\subsubsection{Token Ring}

On a token ring, the stations are connected to a ring via some ring
interfaces.  The ring is not a broadcast medium, but a collection of
individual point-to-point links that happen to form a circle.  In a token
ring, a special bit pattern, called the {\em token}, circulates around the
ring whenever all stations are idle.  When a station wants to transmit, it
seizes the token and removes it from the ring and then transmits a frame.
The frame is relayed by the stations on the ring.  Each station also copies
the frame if the frame is destined to it.  Eventually, the frame is
returned to the sending station.  The sending station removes the frame
from the ring and transmits another frame or return the token back to the
network if there is no more frame to be transmitted.  

The bandwidth for token ring is 4 or 16 Mbps with coaxial or twisted pair.

FDDI (Fiber Distributed Data Interface) is a fiber optics token ring with
bandwidth of about 100 Mbps.  In the original proposal, FDDI consists of
two rings, one transmitting clockwise and one transmitting
counterclockwise.  If either one breaks, the other can be used as backup.
If both break at the same point, the two rings can be joined together to
form a single long ring.  But, current implementations usually use hubs or
wire centers.

Compared with Ethernets, the size and speed of Token Rings are more
scalable.  But, the management of Token Rings is not as simple, e.g. (1)
when the token is corrupted, it has to be regenerated somehow, (2) when
some stations crash, the crashed stations have to be bypassed.

(cf: IEEE standard 802.5)

\subsection{Switch Networks}

Switch networks are commonly used for WANs.  On a switch network, each node
is connected to some other nodes.  If one node wants to send a packet to
another and there is no direct link between them, the packet is sent
through several links; at each intermediate node, the packet is {\it
switched} to the next link.  The path of a packet can be determined either
by the user, e.g. in UUCP, or more commonly by the nodes.  In the latter
case, the algorithm for determining the path can either be static or
dynamic (maybe adjustable to the loads on the node and links).  In either
case, each node keeps a routing table.  When a packet arrives, the packet's
destination is used as the index into the routing table to find the next
link.  To improve the performance (of this table lookup and others), switch
networks usually have hierarchical addressing, such that only part of the
whole address need to be considered at a time.  There are two common types
of switch networks, {\it circuit switching} and {\it packet switching}.

\begin{enumerate}

\item {\em Circuit Switching}: For circuit switching, a connection is
established before transmission.  One example of the switch circuit network
is the telephone system.

\item {\em Packet Switching}: For packet switching, no connection is
established in advance.  When a node receives a packet to some destination,
it decides which link the packet should be switched to.  One example of
packet switching network is the Internet.

\end{enumerate}

\end{document}
