Friendly Virtual Machines Zhang,Bestavros etc., Boston Univ. ACM/USENIX VEE 2005
Http:// If You Build It, They Will Come: The SN B ENCH Architecture Adam Bradley Azer Bestavros &...
-
date post
21-Dec-2015 -
Category
Documents
-
view
213 -
download
0
Transcript of Http:// If You Build It, They Will Come: The SN B ENCH Architecture Adam Bradley Azer Bestavros &...
http://www.cs.bu.edu/groups/wing/
If You Build It, They Will Come:The SNBENCH Architecture
Adam BradleyAzer Bestavros & Michael Long
Computer Science DepartmentBoston University
May 13, 2005 The snBench Architecture 2
Before we begin…
WelcomeTo
Summer!
May 13, 2005 The snBench Architecture 3
Sensorium Infrastructure @ BU
Sensorium: A common space equipped with video sensors (VS) for ubiquitous recognition and tracking of activities therein
Infrastructure: Range of VS Elements Programmable VS Network Backend compute engines Backend TByte storage Mobile/wireless query units Research Engineer
May 13, 2005 The snBench Architecture 4
snBench
The Sensorium is the computer…Design/implement the programming and run-time infrastructure necessary for developers to specify and deploy truly distributed applications over a heterogeneous network of Sensing Elements (SEs) and Computing Elements (CEs)
What sensors could I use and what functionality do I
get from them?
May 13, 2005 The snBench Architecture 5
snBench: Goals
“Write Once, Run… Wherever” Don’t program nodes…
Program the network! Start with building blocks
Sensors Stock algorithms (edge detect, face count, FFT) Dynamic modules (novel algorithms)
Glue together with high-level language Conditionals, loops, functions…
Pretend the network isn’t there “Single System Image” Programming Paradigm
May 13, 2005 The snBench Architecture 6
snBench: Programming Cycle
Program Program specified by gluing together building blocks
using SNAFU language Compile
SNAFU program is compiled to produce a plan of execution expressed in STEP
Map and Link Service Dispatcher decomposes STEP plans
into smaller linked dispatch-able STEPs Load and Execute
STEP plans are dispatched (i.e., loaded) into SXE execution environments
May 13, 2005 The snBench Architecture 7
SNAFU: SNet Apps as FUnctions!
Functional specification language e.g., identify the face seen through camera 1
identify(facefind(snapshot(cam1)))
May 13, 2005 The snBench Architecture 8
SNAFU: SNet Apps as FUnctions!
Use “annotative” functions for constraints e.g., minimum acceptable resolution
e.g., what streams can be “exposed”
public(facecount(snapshot(private(cam1)))))
facecount(resn(800x600x24b,snapshot(cam1)))
May 13, 2005 The snBench Architecture 9
SNAFU: SNet Apps as FUnctions!
Events in time captured by “triggers” e.g., motion detected at night triggers email
email(“[email protected]”, trigger( (motion(snapshot(cam2)) && (2am<NOW<4am)), snapshot(cam2)))
May 13, 2005 The snBench Architecture 10
SNAFU: SNet Apps as FUnctions!
Three trigger types: trigger(p,a): “Wait until p”
do { /* no-op */ } until (p); a; level_trigger(p,a): “Whenever p”
while (true) { if (p) a; }; edge_trigger: “Whenever p becomes true”
while (true) { if (p) { a; while (p) {} } }; Value of trigger is value of a’s evaluation Level and edge triggers produce streams
a.k.a. “persistent queries” living in network
May 13, 2005 The snBench Architecture 11
SNAFU: SNet Apps as FUnctions!
Trigger QoS (Scheduling annotations)
period(100ms, level_trigger(f(cam1), g(cam1)))
May 13, 2005 The snBench Architecture 12
SNAFU: SNet Apps as FUnctions!
Retrieving values from triggers: Non-blocking read - Last result Blocking read - Wait for next result Fresh read - Wait for a “from scratch” result
Recursion: LAST_TRIGGER_EVALUATION term
Last value produced by innermost(?) trigger term Not sure what to call it… “head recursion” ?
May 13, 2005 The snBench Architecture 13
STEP: Sensorium Typed Exec Plan
cam2
snapshot
motion
clock 4am2am
< <
&&
edge_trigger
“Instruction Set Architecture” is a DAG
email(“[email protected]”, edge_trigger( (motion(snapshot(cam2)) && (2am<NOW<4am)), snapshot(cam2)))
May 13, 2005 The snBench Architecture 14
STEP: Sensorium Typed Exec Plan
Notes: Evaluation percolates
up from leaf nodes toward roots.
Sensor nodes provide fresh data at all times.
Function nodes evaluate once then disable themselves.
Trigger nodes can re-enable children for re-evaluation.
cam2
snapshot
motion
clock 4am2am
< <
&&
edge_trigger
May 13, 2005 The snBench Architecture 15
snBench: Runtime Setting
SNAFU-to-STEP compiler SXE: Sensorium eXecution Environment SD: Service Dispatcher
SD, SXE
SXESXE
SXE
SXE
SXE
SXE
Compiler, Web Browser, SXE(?)
May 13, 2005 The snBench Architecture 16
Map, Link, and Dispatch
SXE
SXE
SXE
edge_trigger
cam2
snapshot
motion
clock 4AM2AM
< <
&&
May 13, 2005 The snBench Architecture 17
trigger
Map, Link, and Dispatch
SXE
SXE
SXE
motion
2AM clock 4AM
< <
logical_and
cam2
snapshot
edge_trigger
motion
clock 4AM2AM
< <
&&
cam2
snapshot
May 13, 2005 The snBench Architecture 18
Why snBench?
A Sensorium Research Catalyst Extrinsic research
Accessible framework for developing distributed sensing applications in heterogeneous networks
Intrinsic research Languages, type systems, compilers, graph
algorithms, schedulers, QoS engines, naming, etc. to make the framework efficient/useful/flexible
Supporting research System context, supporting middleware/services
May 13, 2005 The snBench Architecture 19
Extrinsic Research
Flexible substrate for experimenting with distributed sensor applications Extensible w/ new algorithms (“opcodes”) Trade some speed for versatility and
easy re-programmability/re-tasking
Abstracts away “the network” Vision researchers don’t need to understand
communication protocols, RT schedulers, network resource reservation, etc.
May 13, 2005 The snBench Architecture 20
Extrinsic Research: Sensorium Target Applications
Assistive Environments e.g. for home/hospice/elder care/…
Safety Monitoring e.g. in factories/daycare/garages/subways…
Intelligent Spaces e.g. for classrooms/meeting rooms/theaters/farms…
Secure Facilities and Homeland Security Uses e.g. at airports/embassies/prisons/CS labs/…
People Flow/Activity Studies e.g. at malls/interstates/…
May 13, 2005 The snBench Architecture 21
Intrinsic/Extrinsic Research
Why limit ourselves to passive sensing?
Control actuators with snBench programs!
Multi-DOF Cameras Mobile Sensors Robots
Control theory issues…
May 13, 2005 The snBench Architecture 22
Intrinsic Research
Scheduling/Linking/Binding How did we arrive at this partitioning? How did we arrive at these assignments?
SXE
SXE
SXE
edge_trigger
cam2
snapshot
motion
clock 4AM2AM
< <
&&
May 13, 2005 The snBench Architecture 23
edge_trigger
cam2
snapshot
motion
clock 4AM2AM
< <
&&
Scheduling: Processing Capacity
SXE
SXE SXE
SXE
Load averages? Busy rate?
STEP nodes/s?Realtime scheduler?
?
May 13, 2005 The snBench Architecture 24
Scheduling: Network Capacity
SXE
SXESXE
edge_trigger
cam2
snapshot
motion
clock 4AM2AM
< <
&&
SXE
100Mb/s20%
512kb/s75%
8Mb/s95%
100Mb/s40%
100Mb/s10%
?
May 13, 2005 The snBench Architecture 25
Scheduling: Code Presence
edge_trigger
cam2
snapshot
motion
clock 4AM2AM
< <
&&
SXE
SXESXE
SXEmotion
oflow
delta
[empty]
delta
facefind
bodytrack
motion
[empty]
[empty]
snapshot
delta
?
May 13, 2005 The snBench Architecture 26
Intrinsic Research
SXE
SXE SXE
edge_trigger
cam2
snapshot
motion
clock 4AM2AM
< <
&&
SXE
100Mb/s20%
512kb/s75%
8Mb/s60%
100Mb/s40%
100Mb/s10%
?
motion
[empty]
[empty]
motion
oflow
delta
[empty]
delta
facefind
bodytrack
snapshot
delta
Scheduling = Constrained Graph embedding and
optimization!
May 13, 2005 The snBench Architecture 27
More Scheduling
Multiple simultaneous programs may share STEP sub-graphs:
email(“[email protected]”, block( edge_trigger(motion(snapshot(cam2)) && (2am<NOW<4am), snapshot(cam2)))
trigger( facerecognizer( block( edge_trigger(motion(snapshot(cam2)) && (2am<NOW<4am), snapshot(cam2))), facelibrary(“Adam Bradley”)), email(“[email protected]”, “He’s working late again.”))
May 13, 2005 The snBench Architecture 28
email(“[email protected]”, block( edge_trigger(motion(snapshot(cam2)) && (2am<NOW<4am), snapshot(cam2)))
trigger( facerecognizer( block( edge_trigger( motion(snapshot(cam2)) && (2am<NOW<4am), snapshot(cam2))), facelibrary(“Adam Bradley”)), email(“[email protected]”, “He’s working late again.”))
More Scheduling: CSE
Common Subexpression/Subgraph Elimination
cam2
snapshot
motion
clock 4AM2AM
< <
&&
edge_trigger
cam2
snapshot
motion
clock 4am2am
< <
&&
edge_trigger
trigger
“He’s working late again”
facerecognizer
facelibrary
“Adam Bradley”
May 13, 2005 The snBench Architecture 29
trigger( facerecognizer( block( edge_trigger( motion(snapshot(cam2)) && (2am<NOW<4am), snapshot(cam2))), facelibrary(“Adam Bradley”)), email(“[email protected]”, “He’s working late again.”))
email(“[email protected]”, block( edge_trigger(motion(snapshot(cam2)) && (2am<NOW<4am), snapshot(cam2)))
Com
mon
Subgra
ph
More Scheduling: CSE
Common Subexpression/Subgraph Elimination
cam2
snapshot
motion
clock 4AM2AM
< <
&&
edge_trigger
cam2
snapshot
motion
clock 4am2am
< <
&&
edge_trigger
trigger
“He’s working late again”
facerecognizer
facelibrary
“Azer Bestavros”
May 13, 2005 The snBench Architecture 30
trigger( facerecognizer( block( edge_trigger( motion(snapshot(cam2)) && (2am<NOW<4am), snapshot(cam2))), facelibrary(“Adam Bradley”)), email(“[email protected]”, “He’s working late again.”))
email(“[email protected]”, block( edge_trigger(motion(snapshot(cam2)) && (2am<NOW<4am), snapshot(cam2)))
More Scheduling: CSE
cam2
snapshot
lights_are_on
clock 4AM2AM
< <
logical_and
edge_trigger
cam2
snapshot
lights_are_on
clock 4AM2AM
< <
logical_and
edge_trigger
trigger
“He’s working late again”
facerecognizer
facelibrary
“Azer Bestavros”
Common Subexpression/Subgraph Elimination
May 13, 2005 The snBench Architecture 31
trigger( facerecognizer( block( edge_trigger( motion(snapshot(cam2)) && (2am<NOW<4am), snapshot(cam2))), facelibrary(“Adam Bradley”)), email(“[email protected]”, “He’s working late again.”))
email(“[email protected]”, block( edge_trigger(motion(snapshot(cam2)) && (2am<NOW<4am), snapshot(cam2)))
More Scheduling: CSE
cam2
snapshot
lights_are_on
clock 4AM2AM
< <
logical_and
edge_trigger
cam2
snapshot
lights_are_on
clock 4AM2AM
< <
logical_and
edge_trigger
trigger
“He’s working late again”
facerecognizer
facelibrary
“Azer Bestavros”
Common Subexpression/Subgraph Elimination
SXE
SXE
SXE
May 13, 2005 The snBench Architecture 32
Intrinsic Research
Program Optimization
What to optimize? STEP Node count? Trigger count? (More or less?)
let x = snapshot(cam2) inemail(“[email protected]”, block( edge_trigger(motion(x) && (2am<NOW<4am), x)))
let x = snapshot(cam2) intrigger( edge_trigger(motion(x) && (2am<NOW<4am), true), email(“[email protected]”, x))
May 13, 2005 The snBench Architecture 33
More Scheduling: Architecture
What if we can’t run SXE on a node?
STEP: a compile-able virtual ISA Embedded C dialects? Java ME?
Support alternate “linking” protocols Serial (base station) SN wireless protocols
(e.g. 802.15.4)
May 13, 2005 The snBench Architecture 34
Intrinsic Research
Better Programming Languages Alternate Execution Environments
STEP
SNAFUSnQL SnLOG
SnC
SXEJ2ME
Native CJXTA
May 13, 2005 The snBench Architecture 35
Intrinsic Research
Scheduling/Real-Time Type Systems
Resource Management Type Inference
Actualizers (SD is a “mini-ITM”) Static and dynamic “type checks”
period(100ms, let x = period(75ms, edge_trigger(y, z)) in edge_trigger(f(x), g(x))
level_trigger( state(4MB, entropymeasure( bw(2MBps, deltastream(cam1)))), period_gt(250ms, signal(actuator1, true))
May 13, 2005 The snBench Architecture 36
Intrinsic Research
Intentional Naming Naming sensors by identity:
“The webcam in Azer’s Office” Naming sensors by property:
“Any two cams which see point X from perspectives >90 degrees
apart” Naming sensors by dynamic attribute:
“Any cam which sees Adam” May depend upon existence of persistent queries. What
p.q.’s should we instantiate to produce the highest odds of success at the lowest cost?
Wearables as part of the Sensorium?
May 13, 2005 The snBench Architecture 37
Intrinsic Research
How do you offer RealTime, QoS, etc. if you don’t know about the timing of atomic operations? Live profiling of new opcodes Speculative/probabilistic scheduling Run-time scheduler parameter changes
May 13, 2005 The snBench Architecture 38
Supporting Research
SXE Implementations and Internals SXE itself as high-performance service
Real-time scheduling Self-profiling Fast I/O delivery (Lives in kernel sandbox?)
Programmer can upload their own functions C++, Java, C#, Perl, Matlab, whatever… Automatically generate glue to link with SXE Sandboxing issues
May 13, 2005 The snBench Architecture 39
Current Status
Whitepaper SNAFU and STEP syntax (tentative) SNAFU type principles (tentative)
1G Implementation (work in progress) Java
SNAFU-to-STEP compiler Service Dispatcher SXE (with HTTP-based interface) JAR-based extensibility
Expect first live demo mid-summer
http://www.cs.bu.edu/groups/wing/
If You Build It, They Will Come:The SNBENCH Architecture
Adam BradleyAzer Bestavros & Michael Long
Computer Science DepartmentBoston University