3 Mobile Computation Offloading transfer of computation execution

Cuckoo: A Computation
Offloading Framework
for Smartphones
by Roelof Kemp, Nicholas Palmer, Thilo
Kielmann, and Henri Bal
MOBICASE 2010, LNICST 2012
2014/7/8
Nguyen Thi Thanh Nha
HMCL
Problem
2
Cuckoo: A Computation Offloading Framework for Smartphones
Nguyen Thi Thanh Nha - HMCL
2014/7/8
Solution?
Mobile Computation Offloading
transfer of computation execution
outside the mobile device
3
Cuckoo: A Computation Offloading Framework for Smartphones
Nguyen Thi Thanh Nha - HMCL
2014/7/8
Cuckoo framework

A complete framework for computation offloading for
Android, which integrates with Eclipse




4
a runtime system
a resource manager application for smartphone users
a programming model for developers
It supports local and remote execution
Cuckoo: A Computation Offloading Framework for Smartphones
Nguyen Thi Thanh Nha - HMCL
2014/7/8
Android


Android provides an application model that fits well for
computation offloading
Android application components





5
Activities
Services
Content Providers
Broadcast Receivers
Cuckoo focuses on activities and services
Cuckoo: A Computation Offloading Framework for Smartphones
Nguyen Thi Thanh Nha - HMCL
2014/7/8
Android IPC
A schematic overview of the Android IPC mechanism
6
Cuckoo: A Computation Offloading Framework for Smartphones
Nguyen Thi Thanh Nha - HMCL
2014/7/8
Build Process of an Android application
Generates Java files from
AIDL files
7
Compiles the Java source
code and the generated
Java code
Cuckoo: A Computation Offloading Framework for Smartphones
Bundles the resources,
the compiled code and
the application into an
installable apk file
Nguyen Thi Thanh Nha - HMCL
2014/7/8
Cuckoo: Programming Model

Easy to use and to understand





8
Programming model acts as the interface of the system to the
developers
Use the Android’s existing ‘activity/service’ model that
separate the services (compute intensive parts) and activities
(interactive parts of the application).
Support both local and remote method implementations.
Specifically support remote implementations to be
different from the local implementation.
Bundle all local and remote code to be together
Cuckoo: A Computation Offloading Framework for Smartphones
Nguyen Thi Thanh Nha - HMCL
2014/7/8
Cuckoo: Build Process
Have to be invoked after
the Java Builder
- Derives a dummy remote
implementation from the
available AIDL interface.
- Generates an Ant build file.
9
Cuckoo: A Computation Offloading Framework for Smartphones
Rewrites the generated Stub
for each AIDL interface, so
that at runtime Cuckoo can
decide whether a method will
be invoked locally or remote.
Nguyen Thi Thanh Nha - HMCL
2014/7/8
Cloud Resources



10
An application can offload its computation to any
resource that runs the Java Virtual machine
The user runs a simple Java application, the server, on a
resource to enable it to be used for computation
offloading.
Services available on a phone can be installed onto such a
server.
Cuckoo: A Computation Offloading Framework for Smartphones
Nguyen Thi Thanh Nha - HMCL
2014/7/8
Cloud Resources

The remote resource has to register its address to the
Resource Manager application that runs on the phone



11
QR code contains the address of the server
Resource description file
The Cuckoo framework will query the Cuckoo Resource
Manager for any available resources
Cuckoo: A Computation Offloading Framework for Smartphones
Nguyen Thi Thanh Nha - HMCL
2014/7/8
Implementation




12
Offloading Decision
Ibis communication
Client Server Protocol
Configuration of Cuckoo: Trade Offs
Cuckoo: A Computation Offloading Framework for Smartphones
Nguyen Thi Thanh Nha - HMCL
2014/7/8
Offloading Decision

At the runtime, The Cuckoo system intercepts all method
calls and then decides whether to offload the method
invocations or not.


13
If remote, check whether the remote resource is reachable
If locally, it return the result to the proxy
Cuckoo: A Computation Offloading Framework for Smartphones
Nguyen Thi Thanh Nha - HMCL
2014/7/8
Ibis Communication

Middleware for distributed applications, written in Java
 Communicate between the remote resources and the phones
 The Ibis High Performance Programming System is used
for Cuckoo’s communication.

High-level programming model


e.g. Remote Method Invocation (RMI)
Remote
Low-level communication library

Ports: unidirectional communication channels
 Messages are sent between multiple ports.
 Every port has a unique identifier
Activity
Proxy
 An Ibis identifier
 The name of the port.
14
Cuckoo: A Computation Offloading Framework for Smartphones
Stub
Nguyen Thi Thanh Nha - HMCL
Local
2014/7/8
Client Server Protocol




15
The clients find a server using its Ibis identifier and bind
a Send Port to the matching Receive Port at the server to
exchange messages with the server.
The client will request the server to execute a particular
method from a service
The client can install the service onto server
Cuckoo can switch to another remote resource
Cuckoo: A Computation Offloading Framework for Smartphones
Nguyen Thi Thanh Nha - HMCL
2014/7/8
Configuration of Cuckoo: Trade Offs

Early binding



Late binding





16
Increase the chance to find remote resource that can be used
More overhead in terms of time and energy if Cuckoo cannot connect to any of
the resources.
Execute method of the service in parallel on multiple resources.


For optimizing energy usage
The resource discovery process will be delayed until a method will be invoked
Increase maximum number of remote resources


For gaining speed
Try to find and, if needed, install a remote resource at the moment the activity
binds to the service
Speed up execution
Energy hungry
Configure individual methods of a service to be not offloadable at
all
Cuckoo: A Computation Offloading Framework for Smartphones
Nguyen Thi Thanh Nha - HMCL
2014/7/8
Application: eyeDentify




17
Object recognition of images captured by the camera
Allows the user to teach new objects to the application
Converts an image into a feature vector
Compute and memory intensive
Cuckoo: A Computation Offloading Framework for Smartphones
Nguyen Thi Thanh Nha - HMCL
2014/7/8
Application: eyeDentify

18
Results

Always perform object recognition, even when no
network connection is available

Remote implementation

Speed up the recognition (60 times faster)

Reduce the energy consumption (40 times less energy)

Higher quality object recognition
Cuckoo: A Computation Offloading Framework for Smartphones
Nguyen Thi Thanh Nha - HMCL
2014/7/8
Application: PhotoShoot

19
Face detection will determine whether a shot is a hit or
not.
Cuckoo: A Computation Offloading Framework for Smartphones
Nguyen Thi Thanh Nha - HMCL
2014/7/8
Application: PhotoShoot


20
The major compute intensive operation in this game is the
face detection.
Without offloading, the slower the processor of the
smartphone, the longer it takes for the shot to be analyzed
Cuckoo: A Computation Offloading Framework for Smartphones
Nguyen Thi Thanh Nha - HMCL
2014/7/8
Cuckoo Limitations


Cuckoo does not yet support callbacks.
Method arguments can only be used as input parameters
and cannot be used in a C-style way as output parameter.



21
Only the return object of a method will be available to the
activity.
Does not support any form of security.
Supports only stateless services.
Cuckoo: A Computation Offloading Framework for Smartphones
Nguyen Thi Thanh Nha - HMCL
2014/7/8
Conclusions




A framework that allows local and remote
implementations for computation offloading for
smartphones
It allows a single interface from both implementations
It can use more remote servers and it can switch between
them if there are disconnections
With no big programming effort, Cuckoo can


22
increase the speed of compute intensive operations
reduce the energy consumption
Cuckoo: A Computation Offloading Framework for Smartphones
Nguyen Thi Thanh Nha - HMCL
2014/7/8
THANK YOU
23
Cuckoo: A Computation Offloading Framework for Smartphones
Nguyen Thi Thanh Nha - HMCL
2014/7/8