Multi-scale, not multicore

Type-driven programming for mobile, cloud and desktop applications »
Anil Madhavapeddy

Anil Madhavapeddy
Systems Research Group, 
University of Cambridge
Cloud
Desktop
Mobile
PiCloud
AppEngine
Amazon EC2
> def func():
    do_compute ()

> import cloud
> cloud.call(func)
class Location(db.Model):
    loc = db.GeoPtProperty()
    date = db.DateTimeProperty()
    accuracy = db.FloatProperty()
function (doc) {
  if (doc.Type == "customer")
    emit(doc.name, {name: doc.name });
}
Windows
Linux
MacOS X
Android
iPhone
Background processes
Java or native ARM code
JSON/RPC function call bridge 
No background processes
Objective C only for UI
Push support for incoming messages
EuroSys 2007
Melange: Creating a "functional" Internet
http://github.com/avsm/melange
Xen Cloud
Dust Clouds
"Using Dust Cloud to Enhance Anonymous Communication"
Security Protocols Workshop 2010
Jon Crowcroft
Steven Hand
Richard Mortier
Google 
Yahoo
Apple Microsoft
Personal Data
Number of Users
Office
iPhoto
iTunes
Smart phone
LinkedIn
Dopplr
Plaxo
?

People
Places
Things
Messages
Security
Isolation
Archival
Provenance
A Social Database
Multiscale Challenge
Challenges
"I love Falafels!"
"Clerkenwell, London"
"Faiz, King of Falafel"
image/jpeg, 800x600
type t = {
  name: string;
  age: int option;
  friends: t list;
} with type_of
let type_of_t =
  Rec ("t",
     Dict(
         ("name", `RO, String);
         ("age", `RO, Option(Int 63));
         ("friends", `RO, Enum (Var "t"))
     ))
Type
Value
let me = {
  name="Anil";
  age=Some 30;
  friends: [bob];
}
value_of_t me :
  Ext ("t", 3, 
     Dict(
         ("name", String "Anil");
         ("age", Value (Int 63));
         ("friends",
            Ext("t", 2, 
               Dict(
                  ("name", String "Bob");
                  ("age", Null), ...
ORM
type t = {
  name: string;
  age: int option;
  friends: t list;
} with orm
t_init: string -> (t, [`RW]) Db.t
t_init_ro : string -> (t, [`RO]) Db.t

t_save (t,[`RW]) Db.t -> t -> unit

t_get: ?name:[<`Contains of string
                                  |`Eq of string] ->
                  ?age:[< `Null | `Eq int |
                                 `Gt int  (...) ] 
                  (t, [< `RO|`RW ]) Db.t -> unit

t_delete: (t,[`RW]) Db.t -> t -> unit
type t = 
| Unit                  | Int of Int64
| Bool of bool    | Float of float
| String of string
| Enum of t list
| Tuple of t list
| Dict of (string * t) list
| Sum of (string * t list)
| Null     | Value of t
| Arrow of string
| Rec of (string * int64) * t
| Var of (string * int64)
| Ext of (string * int64) * t
type t = 
| Unit      | Bool
| Float     | Char
| String   | Int of int option
| Enum of t
| Tuple of t list
| Option of t
| Dict of (string * [`RO|`RW] * t) list
| Sum of (string * t list) list
| Rec of string * t    | Var of string
| Ext of string * t
| Arrow of t * t
Shelf
json_of_t : t -> string
t_of_json : string -> t

{ name: "Anil",
   age: 30, 
  friends: [
     { name: "Bob", friends: [] }
   ] 
} 
type t = {
  name: string;
  age: int option;
  friends: t list;
} with json
SQL
CREATE TABLE types (n TEXT, t TEXT);
CREATE TABLE t_friends (
    id INT, next INT, size INT, val INT);
CREATE TABLE t (id, name TEXT 
    age_isset INT, age INT, friends INT); 
CREATE UNIQUE INDEX idx_1 
  ON t_friends (id, next);
CREATE TRIGGER t_friends_clean 
  AFTER UPDATE OF friends ON t (...);
AppEngine
name: java.lang.String
age: java.lang.Integer
friends: ListProperty<t>

Uses Cadmium to convert
OCaml to Java
let rec me = { name="Anil";
   age=Some 30; friends=[mothy] }
and mothy = { name="Mothy";
  age=None; friends=[me] } in

let db = t_init "friends.db" in
t_save db me;

let a = t_get ~name:(`Contains "A") db in
...


http://avsm-ocaml1.appspot.com/
Dyntype/ML
Cloud
Desktop
Mobile
Flickr   Picassa
Twitter Facebook
iPhoto  iTunes
iChat Adium
Android
iPhone
Social
GMail Hotmail
Latitude FireEagle
iPad
iWork Office
Map/Reduce
Galaxy Zoo
Genomics on Rails
NASA/Eucalyptus
Scientific
Matlab
    C++/MPI
Fortran
Sensors
     Spacecraft
People
Political
MP Expenses
   Tax Returns 
Data.gov
   TheyWorkForYou
Tax Returns 
   News Readers


Mobile reporting
"Pothole here"
Community events


Perscon
Free, open-source
A VM for you, and only for you
Privacy, Provenance, Control
http://perscon.net
Lessons
Go Faster? Do Less
"Just in Time" Programming
 Smarter toolchains

Loading comments...

Please log in to add your comment.

Report abuse

More presentations by Anil Madhavapeddy

  • Personal Containers

    Anil Madhavapeddy on

    An architecture for securely storing personal data

  • Mirage

    Anil Madhavapeddy on

    Type-driven programming for mobile, cloud and desktop applications

  • Mirage

    Anil Madhavapeddy on

    Type-driven programming for mobile, cloud and desktop applications