| 1 |
\chapter{NoTA Overview}\label{chap:overview} |
| 2 |
\section{Introduction} |
| 3 |
This chapter introduces the main components of NoTA and its |
| 4 |
architecture\index{architecture}. In the next chapters we will discuss each of |
| 5 |
the parts in more detail, but this chapter should give you a good overall idea |
| 6 |
of what NoTA is all about. |
| 7 |
|
| 8 |
\section{Overview and terminology} |
| 9 |
We start with a short introduction into the core NoTA-concepts and |
| 10 |
terminology. NoTA sometimes has some of its own terminology, and sometimes |
| 11 |
uses existing terms in a slightly different way. It's helpful to understand |
| 12 |
where. |
| 13 |
|
| 14 |
\begin{wrapfigure}{r}{0.3\textwidth} |
| 15 |
\includegraphics[width=6cm]{image/an-sn.png} |
| 16 |
\caption{Application nodes and service nodes}\label{figure:an-sn} |
| 17 |
\end{wrapfigure} |
| 18 |
|
| 19 |
\subsection{Nodes, messages and streams} |
| 20 |
NoTA is all about communication between {\em nodes}, which are logical |
| 21 |
entities, either in hardware or software. For example, you can think of an |
| 22 |
video-player node requesting some video data from a file-storage node. After |
| 23 |
receiving the data, it can send it to the MPEG-node for decoding, and |
| 24 |
finally to the video and audio nodes for showing the video. |
| 25 |
|
| 26 |
Structurally, there are \textbf{two} kinds of nodes: |
| 27 |
\begin{itemize} |
| 28 |
\item {\em application nodes}\index{application node} (ANs) - the nodes |
| 29 |
(subsystems) that request services to other nodes; also known as {\em |
| 30 |
clients}; |
| 31 |
\item {\em service nodes}\index{service node} (SNs) - the nodes (subsystems) |
| 32 |
that provide services to other nodes; also known as {\em services}. |
| 33 |
\end{itemize} |
| 34 |
|
| 35 |
These nodes can communicate in two ways: |
| 36 |
\begin{itemize} |
| 37 |
\item sending {\em messages}\index{message} to other nodes. Messages are blobs |
| 38 |
of structured data for asking other nodes to do something or inform them of |
| 39 |
some event; this is sometimes called the {\em control plane}\index{control |
| 40 |
plane}; |
| 41 |
\item sending {\em streams}\index{stream} of data to other nodes. For |
| 42 |
bulk-transfer of data, it's much more efficient to send it as opaque data to |
| 43 |
other nodes. This is sometimes called the {\em data plane}\index{data |
| 44 |
plane}. |
| 45 |
\end{itemize} |
| 46 |
|
| 47 |
\subsection{Message passing} |
| 48 |
As mentioned, control between nodes takes place by sending {\em messages}; |
| 49 |
this is called {\em message passing}\index{message passing}. At least |
| 50 |
conceptually, the sending of messages is fully asynchronous. That is, a node |
| 51 |
sends a message to another node; depending on the kind of message, the |
| 52 |
receiver may send a response message, which could come at some later |
| 53 |
time. Asynchronous messages are different from function calls, in that the |
| 54 |
caller (sender) does not wait for the answer, but instead has to be ready |
| 55 |
receive the response at any time. |
| 56 |
|
| 57 |
Message passing is more flexible than mere function calls -- the latter can be |
| 58 |
considered a special, simple case of the former. The flip side of that coin is |
| 59 |
that true message passing makes things harder for the programmer. |
| 60 |
|
| 61 |
As an example of message passing, one could think of an SN that implements a |
| 62 |
music player, and accepts messages such as {\tt play()}, {\tt pause()} and |
| 63 |
{\tt stop()}. At any time during playing some songs, the SN could send |
| 64 |
messages back to the AN, for example to indicate song changes, or error |
| 65 |
conditions. |
| 66 |
|
| 67 |
\subsection{Programming NoTA nodes} |
| 68 |
Application programmers usually interface with NoTA on the {\tt |
| 69 |
h\_in}-level. Technically, the core NoTA specifications do {\bf not} specify |
| 70 |
the API\index{application programming interface} of the {\tt h\_in}. For |
| 71 |
practical reasons, we use the API that the reference implementation offers, |
| 72 |
which was inspired by BSD-sockets\cite{Stevens2003}. However, one could imagine |
| 73 |
other interfaces to the underlying NoTA-protocol as well. The BSD-socket |
| 74 |
interface was chosen because it provides a familiar abstraction. The |
| 75 |
similarity is {\em not} complete though, so you should be careful with |
| 76 |
assumptions based on knowledge of BSD-sockets. |
| 77 |
|
| 78 |
On top of the {\tt h\_in} lives a special service node that is part of the |
| 79 |
NoTA specification: the {\em resource manager}\index{resource manager} |
| 80 |
(RM). The resource manager's role is somewhat similar to that of a combination |
| 81 |
DNS and DHCP-server in a network: it hands out addresses to services, and |
| 82 |
allows you to find them. |
| 83 |
|
| 84 |
Services register themselves with the RM to retrieve an address (the {\em |
| 85 |
service-id}\index{service-id} or {\em SID}). Applications can then query the |
| 86 |
RM for these services, and provide the information they need for |
| 87 |
connecting. In addition, the RM has an \emph{event interface}, which means |
| 88 |
that it can notify you when some service (SN) becomes available or goes away. |
| 89 |
|
| 90 |
Finally, the NoTA reference implementation offers a tool called the {\tt |
| 91 |
stubgen}, which takes specification in the {\em Web Service Description |
| 92 |
Language}~\cite{Booth:07:WSD}\index{Web Services Description Language} |
| 93 |
(WSDL), and generates the stub code for ANs and SNs. The stub-generator |
| 94 |
generates some of the low-level 'plumbing' code, allowing software developers to |
| 95 |
concentrate on the problem they try to solve, rather than on the details of |
| 96 |
NoTA. The stub-generator is the NoTA-equivalent of what is called an |
| 97 |
IDL-compiler in e.g. CORBA\index{CORBA} and COM\index{COM}. |
| 98 |
|
| 99 |
Figure~\ref{figure:an-sn} gives a schematic overview of a NoTA-based system. |
| 100 |
|
| 101 |
\section{NoTA Components} |
| 102 |
\subsection{Architecture} |
| 103 |
\begin{figure} |
| 104 |
\centering |
| 105 |
\includegraphics[width=80mm]{image/nota-arch.png} |
| 106 |
\caption{NoTA layered architecture} |
| 107 |
\label{fig:nota-layered-architecture} |
| 108 |
\end{figure} |
| 109 |
NoTA nodes live on top of the NoTA architecture, which consists of two layers, inspired by the classic ISO/OSI network |
| 110 |
model\cite{ISOOSI94}: |
| 111 |
\begin{itemize} |
| 112 |
\item The {\tt l\_in} ({\em low-level interconnect}\index{low-level interconnect}) |
| 113 |
is an abstraction of the network layer. This allows nodes to communicate |
| 114 |
over e.g. TCP/IP, USB or Bluetooth, without having to worry about the |
| 115 |
idiosyncrasies of the network protocols involved. The {\tt l\_in} is |
| 116 |
subdivided in the {\tt l\_in-down} and the {\tt l\_in-up}; |
| 117 |
\item On top of that, there is the {\tt h\_in} ({\em high-level |
| 118 |
interconnect}\index{high-level interconnect}), which provides an API for |
| 119 |
applications that want to use NoTA. |
| 120 |
\end{itemize} |
| 121 |
|
| 122 |
Some of the other NoTA literature refers to the {\tt h\_in} and {\tt l\_in} |
| 123 |
together as the \emph{Device Interconnect Protocol} or DIP\index{device |
| 124 |
interconnect protocol}. We will not use that name; just remember that DIP |
| 125 |
refers to the protocol that {\tt h\_in} and {\tt l\_in} offer, i.e. what goes |
| 126 |
on inside the cloud of figure~\ref{figure:an-sn}. |
| 127 |
|
| 128 |
\subsection{L\_IN}\index{low-level interconnect} |
| 129 |
The {\tt l\_in} or {\em low-level |
| 130 |
interconnect}\cite{Eriksson2008:1,Eriksson2008:2} abstracts various network |
| 131 |
technologies (transport) that NoTA can use. It consists of two sub-layers: |
| 132 |
\begin{enumerate} |
| 133 |
\item the {\tt l\_in-down}, is the network adaption layer, and translates |
| 134 |
between the NoTA world and the various network types or {\em transports}), |
| 135 |
for example TCP, Bluetooth and USB; |
| 136 |
\item the {\tt l\_in-up} lives on top of the {\tt l\_in-down}, and provides an |
| 137 |
interface to the {\tt h\_in}. |
| 138 |
\end{enumerate} |
| 139 |
|
| 140 |
In NoTA-publications, the network abstraction is often referred to as being |
| 141 |
\emph{transport agnostic}\index{transport agnostic} - above the level of the |
| 142 |
\texttt{l\_in} you don't have to care (or know) what the underlying transport |
| 143 |
technology is. Nodes can be connected using different transports, and when one |
| 144 |
of the transport fails (e.g., a cable gets disconnected), the next one can |
| 145 |
take over. There are of course limits to the transport-agnosticism because of |
| 146 |
the different throughput and latency characteristics that different transports |
| 147 |
have. |
| 148 |
|
| 149 |
\subsection{H\_IN}\index{high-level interconnect} |
| 150 |
The {\tt h\_in} or {\em high-level interconnect} |
| 151 |
\cite{Eriksson2008:3,Eriksson2008:4} lives on top of the {\tt l\_in}, and |
| 152 |
provides the application-layer. It is the {\tt h\_in} where the application |
| 153 |
programmer interacts with NoTA. |
| 154 |
|
| 155 |
NoTA specifies the workings of the {\tt h\_in} in terms of service elements |
| 156 |
and their interactions. However, it does {\bf not} mandate a specific |
| 157 |
API\index{application programming interface}. It is the reference |
| 158 |
implementation of NoTA that defines the programmer-API - other implementations |
| 159 |
could offer other APIs. |
| 160 |
|
| 161 |
\subsection{resource manager}\index{resource manager} |
| 162 |
The resource manager~\cite{Eriksson2008:5} is a special kind of Service Node, |
| 163 |
that can be used to find other Service Nodes. Its mission in life is somewhat |
| 164 |
similar to that of a DHCP-server in a network, but with added functionality |
| 165 |
for searching. It also provides an event-interface, with which nodes can be |
| 166 |
notified when certain service nodes appear or disappear. |
| 167 |
|
| 168 |
For small, static setups, you don't really \emph{need} the resource manager, |
| 169 |
but that approach becomes quickly unfeasible for larger systems. |
| 170 |
|
| 171 |
More about the resource manager in chapter~\ref{chap:rm}. |
| 172 |
|
| 173 |
\subsection{stub-generator}\index{stub-generator} |
| 174 |
\begin{figure} |
| 175 |
\centering |
| 176 |
\includegraphics[width=50mm]{image/stubgen.png} |
| 177 |
\caption{NoTA stubs} |
| 178 |
\label{fig:stubgen} |
| 179 |
\end{figure} |
| 180 |
The stub-generator is a programmer tool that takes a service definition (SIS) |
| 181 |
written following the {\tt WSDL} ({\em Web Services Description |
| 182 |
Language})~\cite{Booth:07:WSD}\index{Web Services Description Language}, and |
| 183 |
generates stub implementations for the message handlers, for both Application |
| 184 |
Nodes and Service Nodes. |
| 185 |
|
| 186 |
Use of the stub-generator avoids writing some of the 'plumbing code', and |
| 187 |
allows the programmer to concentrate on the business logic of his program, |
| 188 |
rather than on NoTA-plumbing details. The stub-generator is discussed in |
| 189 |
chapter~\ref{chap:stubgen}. |
| 190 |
|
| 191 |
Even without the stub-generator, the WSDL service definitions are a useful |
| 192 |
tool to specify the functionality that your services offer to the outside |
| 193 |
world. |
| 194 |
|
| 195 |
\section{Portability}\index{portability} |
| 196 |
\subsection{General} |
| 197 |
There is little in the NoTA-design that favors any particular software |
| 198 |
platform; in fact, NoTA has been designed to scale from |
| 199 |
embedded\index{embedded} systems to PC-class systems, while ports to other |
| 200 |
platforms are very much encouraged. |
| 201 |
|
| 202 |
Having said that, it must be noted that the {\em reference |
| 203 |
implementation}\index{reference implementation} we are discussing in this |
| 204 |
guide has been developed on Linux, which influences some implementation |
| 205 |
choices. A conscious effort has been made though to very much limit the use of |
| 206 |
platform-specific component and, when they are unavoidable, isolate them. |
| 207 |
|
| 208 |
Thus, the reference implementation works on Linux -- on the x86 architecture, |
| 209 |
but also on ARM and AMD64. Outside Linux\index{Linux}, NoTA is known to work |
| 210 |
on Cygwin\cite{Cygwin}, and ports are underway for |
| 211 |
Symbian\cite{Symbian}\index{Symbian}, T-Kernel/TRON\cite{TRON}\index{TRON} and |
| 212 |
Windows-CE\index{Windows-CE}, in various states of completion. |
| 213 |
|
| 214 |
It is, however, true that the reference implementation was developed on Linux |
| 215 |
systems, so in general, the more a system looks like Linux, the easier the |
| 216 |
porting effort will be. For a system very different from Linux, it might make |
| 217 |
more sense to not port NoTA, but instead re-implement it from specification. |
| 218 |
|
| 219 |
\subsection{{\tt l\_in-down}}\index{portability!low-level interconnect} |
| 220 |
While the general part of the NoTA software is quite portable, the {\tt |
| 221 |
l\_in-down}\index{low-level interconnect} network adaptations are quite |
| 222 |
system-specific. |
| 223 |
|
| 224 |
For example, Bluetooth-support requires the {\em Bluez}\cite{Bluez}-libraries |
| 225 |
on Linux. Bluez is not available on any other system, so other systems would |
| 226 |
need to implement their own Bluetooth adaption, using the Bluetooth-libraries |
| 227 |
on that system. |
| 228 |
|
| 229 |
The same is true is for USB and to a lesser extent for TCP. Because the |
| 230 |
TCP-interfaces on different systems are more similar (following the BSD-socket |
| 231 |
model)\index{socket}, the {\tt l\_in-down} for TCP is easier to port. |
| 232 |
|
| 233 |
\section{Questions} |
| 234 |
To test your understanding of this chapter, you could try to answer some of |
| 235 |
these questions. You can find the answers to these question in |
| 236 |
appendix~\ref{chap:answers}. |
| 237 |
\begin{enumerate} |
| 238 |
\item Which two kinds of nodes are distinguished in a NoTA system? What is the |
| 239 |
difference between them? |
| 240 |
\item What is the difference between message passing and function calls? |
| 241 |
\item In NoTA, nodes can communicate using either message passing or |
| 242 |
streaming. Can you give some examples of when you would use either one of |
| 243 |
those? |
| 244 |
\item What are the two layers in the NoTA architecture? What's the purpose of |
| 245 |
each of these layers? |
| 246 |
\item What does the resource manager do? Why would you use the stub-generator? |
| 247 |
\item Do you need to run Linux to run NoTA? |
| 248 |
\end{enumerate} |