diff options
authorOlli Salli <>2013-01-27 15:29:44 (GMT)
committerOlli Salli <>2013-01-27 15:29:44 (GMT)
commitfc6349b7d7aca5f5a3833d11701d4a7bf9e2f2ee (patch)
parente34916960343a5ab83ef7bf362b91f15840a65f1 (diff)
Add WIP master's project reportHEADmaster
2 files changed, 193 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index a2de352..2a42508 100644
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,4 @@
-all: abstractsonly.pdf gradu.pdf
+all: abstractsonly.pdf ertyo.pdf gradu.pdf
-Gpenwidth=2 -Npenwidth=2 -Epenwidth=2
@@ -93,5 +93,8 @@ abstractsonly.pdf: abstractsonly.tex abstracts.tex
gradu.pdf: gradu.tex abstracts.tex gradu.bbl gradu.toc gradu.nls ${FIGURES}
pdflatex -interaction nonstopmode $<
+ertyo.pdf: ertyo.tex ertyo.toc
+ pdflatex -interaction nonstopmode $<
- rm -f *.nlo *.nls *.ilg *.nls-stamp *.lof *.lot *.aux *.log *~ abstractsonly.pdf gradu.pdf *.toc *.blg *.bbl *.eps ${FIGURES}
+ rm -f *.nlo *.nls *.ilg *.nls-stamp *.lof *.lot *.aux *.log *~ abstractsonly.pdf gradu.pdf ertyo.pdf *.toc *.blg *.bbl *.eps ${FIGURES}
diff --git a/ertyo.tex b/ertyo.tex
new file mode 100644
index 0000000..35eccda
--- /dev/null
+++ b/ertyo.tex
@@ -0,0 +1,188 @@
+% vim: set nocin noai nosmartindent:
+% UTU compliant page layout
+\Large \textbf{Master's project}
+\mbox{Department of Information Technology} \\
+\mbox{Computer Science} \\
+\today \\
+Olli Salli \\
+% Table of Contents
+% Text chapters
+The topic of my Master's thesis\footnote{\url{}} is
+``Building object-oriented software with the D-Bus messaging system''. D-Bus is a message
+passing-oriented inter-process communication (IPC) system. The focus of the thesis is on practical
+requirements on how D-Bus and similar systems can be used in interactive desktop software. Several
+object-oriented design and implementation techniques that help creating software fulfilling these
+requirements are presented and analyzed.
+The ideas presented in the thesis are based on my work on the open-source Telepathy communications
+framework\footnote{\url{}}. Telepathy consists of independent
+modules such as protocol backends, account storage and logging services, and user interfaces (UIs).
+The modules are connected together at runtime over the D-Bus messaging bus.
+Over the year, the various components of Telepathy have been contributed to by dozens of people.
+This report details those of my own personal contributions that are directly connected with the
+\section{Early backend and interface design work}
+My involvement with Telepathy started in 2006 with implementing the \texttt{te\-le\-pa\-thy-id\-le}
+protocol backend for the Internet Relay Chat (IRC) protocol. At that point, Telepathy was in its
+infancy, with only one other reasonably complete protocol backend in existence, one for the
+Jabber/XMPP protocol. Telepathy was being taken into use in a software update for the Nokia 770
+Internet Tablet device, which had a slow 200 MHz ARM CPU and only 128 megabytes of RAM.
+Section 5.5 of the thesis deals with mechanisms that allow querying the state of multiple objects
+with one D-Bus method call. When I started working on \texttt{te\-le\-pa\-thy-id\-le}, these
+mechanisms didn't exist yet in Telepathy. IRC chat rooms can have thousands of members, which used
+to cause several thousand D-Bus method calls to be made to the protocol backend. With the limited
+resources of the Nokia 770, joining an IRC chat room could thus take minutes. In version 0.13 of the
+Telepathy D-Bus interfaces,\footnote{\url{}} we
+changed all operations that worked with contacts to process an arbitrary number of contacts with a
+single call. This improved the performance of Telepathy with IRC to a reasonable level.
+Initially, \texttt{telepathy-idle} exposed its functionality over D-Bus by implementing low-level
+stub methods. These stubs were generated from low-level D-Bus introspection data corresponding to
+the Telepathy D-Bus interfaces. As detailed in Section 6.1 of the thesis, this format lacks
+sufficient information for meaningful static typing of more complex method arguments. For this
+reason, a lot of hand-written code was required in \texttt{te\-le\-pa\-thy-id\-le} for the purpose
+of encoding and decoding argument values. Because it implemented the same interfaces, similar code
+was also required in the Telepathy XMPP protocol backend. Over time, we refactored these and some
+other common pieces of the implementation to the \texttt{te\-le\-pa\-thy-glib} library, and in
+May 2007 I completed reimplementing the IRC backend using the
+\section{UI-side work}
+After \texttt{telepathy-idle}, I implemented another Telepathy backend for a proprietary protocol
+using the \texttt{te\-le\-pa\-thy-glib} library. At this point, Telepathy was used in a fairly
+complex setting in the Nokia N800 and N810 devices, successors to the original 770. As a part of
+this work, I investigated some issues with the device freezing in certain communication situations.
+This was caused by certain UI-side Telepathy-related components calling D-Bus methods on each
+other using the pseudo-blocking algorithm, forming a \emph{wait-reorder cycle}, as explained in
+Section~3.5.3 of the thesis.
+In Summer 2008, I
+the \texttt{te\-le\-pa\-thy-qt4} project to enable implementing Telepathy UIs using the Qt framework
+more easily. This was motivated by Nokia acquiring Trolltech, the developer of
+and eventual rebasing of their Linux device portfolio on Qt. The library later became the basis for
+all messaging-related components in the Harmattan release of their Maemo/MeeGo operating system,
+used in the Nokia N9 mobile phone, and a part of its
+\subsection{Code generation}
+As the first part of the \texttt{tp-qt4} project, I implemented machinery to generate low-level
+proxy code for accessing Telepathy service objects. This is at the level described by Section~6.2 of
+the thesis.
+At that point, the Telepathy D-Bus interfaces were no longer specified using the bare D-Bus
+introspection format, but an extended version. However, due to differences between the GLib and Qt
+type systems, some further modifications were required to generate Qt code.\footnote{
+To facilitate these, and to enable sharing some parts of the machinery between \texttt{tp-qt4} and
+\texttt{tp-glib}, I also partially reimplemented the \texttt{te\-le\-pa\-thy-glib} code generation
+Owing to experience from previous projects, from the start, the generated \texttt{tp-qt4} proxies
+have only made it possible to call methods asynchronously. At the lowest level, the calls are
+represented using \texttt{QD\-Bus\-Pen\-ding\-Call\-Wat\-cher} objects from the Qt framework.
+\subsection{Higher-level proxies}
+Generated proxies follow the structure of the D-Bus API, for which the prime concern is
+flexibility and efficiency. This occasionally makes the APIs less convenient to use. For this
+reason, both \texttt{tp-qt4} and \texttt{tp-glib} wrap the generated proxies with a hand-written
+higher-level API, as described in the introduction to Chapter 6 of the thesis. I implemented the
+\texttt{tp-qt4} high-level proxies together with Andre Magalhaes and Simon McVittie, among others.
+Up to 2010, we were busy implementing basic state caching proxies (thesis section~5.2) for all parts
+of the Telepathy API, and following changes to the other parts of the framework. Because the
+primary target platform of \texttt{tp-qt4} was a mobile phone, special attention was paid to
+avoiding redundant battery-eating wakeups. One artifact of this is the conditional activation
+functionality in the state caching mechanism, described in Section~5.3 of the thesis as the
+``Optional Proxy Features'' pattern.
+Another notable feature of the proxies in \texttt{tp-qt4} is wrapping some D-Bus operations inside
+higher level ``job objects''. These are described as the ``Pending Operation Objects'' and
+``Composite Pending Operation'' patterns in Section~5.1 of the thesis. One example is the
+facility for fetching contact information from a protocol backend, using the D-Bus level
+mechanisms described in Section~5.5 of the thesis. The efficiency orientation of these mechanisms
+make them very inconvenient to use directly. For this reason, they are wrapped as pending operations
+in the \texttt{Con\-tact\-Ma\-na\-ger} part of the \texttt{tp-qt4} API, which I implemented in early
+% 5.4 factories
+% - lots of features, prepare separately, blah blah, hard
+% (general "it's hard")
+% (acc/conn fact.)
+% 5.5 multiplexed state sync
+% - early 2009: implemented tp-qt4 Contact, ContactManager with Conn.I.Contacts D-Bus API