Abstract:
Nowadays, mobile devices have become an integral part of daily life. Traditionally,
mobile applications are developed natively using platform-speci c programming
languages and development environments. To enable a native application
to run on multiple platforms is not a simple task. Usually, this would require
dedicated streams of development for each platform. With the emergence of
more and more mobile platforms, the e ort required to provide multi-platform
support becomes strenuous. To address this problem, software engineering
communities propose a cross-platform development approach. Cross-platform
development enables the use of a single codebase across multiple platforms
while providing acceptable application performance. This is mainly achieved
using web technologies (e.g., HTML, CSS, and JavaScript) that are inherently
portable from one mobile platform to another.
However, existing cross-platform development frameworks are still struggling
with several challenges. Firstly, they lack interoperability with commonly-used
programming languages. For a long time, JavaScript was the only supported
programming language by these frameworks. It is generally challenging to reuse
a wide range of existing programs or libraries written in other programming
languages. Secondly, most cross-platform apps run signi cantly slower than
native applications. A primary culprit is the use of Javascript, which is notoriously
hard to compile and optimize e ciently. The performance penalty
degrades user experience and can render applications unusable on low-end
devices. The recent rise of the WebAssembly has shed some light on the two
challenges. WebAssembly is a young low-level programming language supported
by every modern browser. WebAssembly promises to deliver signi cantly higher
performance than Javascript and is designed to have high interoperability with many popular programming languages. Nevertheless, WebAssembly itself does
not provide a complete solution to the challenges above. Compared to native
applications, WebAssembly applications have been reported on average to run
45% slower according to previous benchmarks. Besides that, many existing
programs can not be directly reused since they expect abstractions from modern
OSs such as threads, le system, and sockets. It is important to note that these
abstractions are not directly available in WebAssembly.
In this thesis, we present Browserify, a framework that enables consistent
and performant application deployment across heterogeneous mobile devices.
Browserify consists of two major components: BroswerVM and Wasmachine.
BrowserVM is a WebAssembly-based virtual machine hypervisor that allows
the execution of unmodi ed and complete operating systems and applications
inside browsers. Though slower than native hypervisors, BroswerVM provides
acceptable performance to reuse unmodi ed applications that are not computeintensive.
Wasmachine is an OS aiming to e ciently and securely execute
WebAssembly applications in mobile devices with constrained resources. Wasmachine
achieves e cient execution by compiling WebAssembly ahead of time
to native binary and executing it in kernel mode for zero-cost system calls. In
practice, WebAssembly applications in Wasmachine can even run faster than
their native counterparts in Linux. We illustrate the capabilities of Browserify
via a case study called SwiftPad. In SwiftPad, we port the famous TEX typesetting
system to e-paper mobile devices and enable users to compose high
typographic quality documents in a WYSIWYG (what you see is what you
get) fashion. We showcase how Browserify facilitates building cross-platform
applications and the reuse of existing software components.