Engineering distributed applications and services in emerg-
ing and open computing scenarios like the Internet of Things, cyber-physical systems and pervasive computing, calls for identifying proper abstractions to smoothly capture collective behaviour, adaptivity, and dynamic injection and execution of concurrent distributed activities. Accordingly, we introduce a notion of “aggregate process” as a concurrent
field computation whose execution and interactions are sustained by a dynamic team of devices, and whose spatial region can opportunistically vary over time. We formalise this notion by extending the Field Calculus with a new primitive construct, spawn, used to instantiate a set of field
computations and regulate key aspects of their life-cycle. By virtue of an open-source implementation in the ScaFi framework, we show basic programming examples and benefits via two case studies of mobile ad-hoc networks and drone swarm scenarios, evaluated by simulation.
6. Motivation Aggregate Computing
concurrent
collective adaptive computations
move in flocking formation
detect or estimate something
elect leader
organise teams for missions departing from the flock
R. Casadei Introduction Contribution Evaluation Wrap-up 6/62
7. Motivation Aggregate Computing
concurrent
collective adaptive computations
move in flocking formation ...while also, dynamically...
detect or estimate something
elect leader
organise teams for missions departing from the flock
R. Casadei Introduction Contribution Evaluation Wrap-up 7/62
8. Motivation Aggregate Computing
concurrent
collective adaptive computations
move in flocking formation ...while also, dynamically...
detect or estimate something
elect leader
organise teams for missions departing from the flock
R. Casadei Introduction Contribution Evaluation Wrap-up 8/62
9. Motivation Aggregate Computing
concurrent
collective adaptive computations
move in flocking formation ...while also, dynamically...
detect or estimate something
elect leader
organise teams for missions departing from the flock
R. Casadei Introduction Contribution Evaluation Wrap-up 9/62
10. Motivation Aggregate Computing
concurrent
collective adaptive computations
move in flocking formation ...while also, dynamically...
detect or estimate something
elect leader
organise teams for missions departing from the flock
R. Casadei Introduction Contribution Evaluation Wrap-up 10/62
11. Motivation Aggregate Computing
concurrent
collective adaptive computations
Roberto Casadei, Danilo Pianini, Mirko Viroli, and Antonio Natali. “Self-organising
Coordination Regions: A Pattern for Edge Computing”. In: International Conference
on Coordination Languages and Models. Springer. 2019 [coord19scr]
R. Casadei Introduction Contribution Evaluation Wrap-up 11/62
13. Motivation Aggregate Computing
Aggregate Computing [ieeecom; coord18a]
programming paradigm for CAS
Mirko Viroli, Jacob Beal, Ferruccio Damiani, Giorgio Audrito, Roberto Casadei, and
Danilo Pianini. “From Field-Based Coordination to Aggregate Computing”. In: Int.
Conf. on Coordination Languages and Models. Springer. 2018
R. Casadei Introduction Contribution Evaluation Wrap-up 13/62
16. Motivation Aggregate Computing
Aggregate Computing [ieeecom; coord18a]
execution model (protocol)
async rounds of computation
1) full run of “aggregate program” against “local context”
device state
sensor readings
neighbourhood coordination data
2) broadcast coordination data to neighbours
R. Casadei Introduction Contribution Evaluation Wrap-up 16/62
20. Motivation Aggregate Computing
nice things about aggregate
computing
predictable composition of emergent behaviour
[tocl19Aud]
declarativity [VCP16] flexibility in execution
formal properties: self-stabilization [tomacs18Vir],
eventual consistency [taas17]
practical (see PLs/tools like ScaFi [CPV16])
much more [coord18a]
R. Casadei Introduction Contribution Evaluation Wrap-up 20/62
21. Motivation Aggregate Computing
also: FC is space-time
universal [coord18b]
however
describing multiple dynamic computations on dynamic
domains is practically unfeasible
R. Casadei Introduction Contribution Evaluation Wrap-up 21/62
22. Motivation Aggregate Computing
also: FC is space-time
universal [coord18b]
however
describing multiple dynamic computations on dynamic
domains is practically unfeasible
R. Casadei Introduction Contribution Evaluation Wrap-up 22/62
23. Motivation Aggregate Computing
also: FC is space-time
universal [coord18b]
however
describing multiple dynamic computations on dynamic
domains is practically unfeasible
R. Casadei Introduction Contribution Evaluation Wrap-up 23/62
27. Motivation Aggregate Computing
example: multi-gradient
sources.map(s => gradient(s))
// (1) we need to align on some computation ID (e.g., 's')
// (2) 'sources' field determines lifecycle & domain
need to extend FC machinery for compositionality to
support dynamic collections of computations
need to simplify management of dynamic domains
R. Casadei Introduction Contribution Evaluation Wrap-up 27/62
29. aggregate process
a dynamic collective computation (a “bubble”)
− similar to OS processes but running on aggregates
features
R. Casadei Introduction Contribution Evaluation Wrap-up 29/62
30. aggregate process
a dynamic collective computation (a “bubble”)
− similar to OS processes but running on aggregates
features
process lifecycle
– generation
– spreading/shrinking (border management)
– destruction
process logic
process interaction
R. Casadei Introduction Contribution Evaluation Wrap-up 30/62
31. aggregate process
a dynamic collective computation (a “bubble”)
− similar to OS processes but running on aggregates
features
process lifecycle
– generation
– spreading/shrinking (border management)
– destruction
process logic
process interaction
R. Casadei Introduction Contribution Evaluation Wrap-up 31/62
32. aggregate process
a dynamic collective computation (a “bubble”)
− similar to OS processes but running on aggregates
features
process lifecycle
– generation
– spreading/shrinking (border management)
– destruction
process logic
process interaction
R. Casadei Introduction Contribution Evaluation Wrap-up 32/62
33. new spawn primitive
Syntax:
P ::= F e program F::= def d(x) {e} function declaration
e ::= x v (x)
τ
=> e e(e) rep(e){x => e} nbr{e} spawn(e, e, e) expression
v::= φ value φ::= δ → neighbouring field value
::= f c( ) local value f::= b d (x)
τ
=> e function value
R. Casadei Introduction Contribution Evaluation Wrap-up 33/62
34. new spawn primitive
Auxiliary functions:
args((x)
τ
=> e) = x body((x)
τ
=> e) = e name((x)
τ
=> e) = τ
args(d) = x if def d(x){e} body(d) = e if def d(x){e} name(d) = d
ρ(v θ ) = v name(b) = b
πi (v θ1, . . . , θn ) = θi if 1 ≤ i ≤ n else •
πf
(v θ1, . . . , θn ) = θn if name(ρ(θ1)) = name(f) else •
πk
(v → θ) = θi s.t. vi = k if it exists else •
F(θ) = v θ if θ = pair(v, True) θ else •
For aux ∈ ρ, πi , πf
, πk
, F :
aux(•) = •
aux(δ → θ, Θ) = aux(Θ) if aux(θ) = •
aux(δ → θ, Θ) = δ → aux(θ), aux(Θ) if aux(θ) = •
Rules for expression evaluation: δ; Θ; σ e ⇓ θ
[E-SPAWN]
δ; πi (Θ); σ ei ⇓ θi
for i ∈ 1, 2, 3
k1, . . . , kn = ρ(θ2
) ∪ {dom(π4(Θ(δ ))) for δ ∈ dom(Θ)}
δ; πki (π4(Θ)); σ ρ(θ1)(ki , ρ(θ3)) ⇓ θi for i ∈ 1, . . . , n
δ; Θ; σ spawn(e1, e2, e3) ⇓ F(k → ρ(θ)) θ1
, θ2
, θ3
, F(k → θ)
R. Casadei Introduction Contribution Evaluation Wrap-up 34/62
35. new spawn primitive
implemented in ScaFi [CPV16]
def spawn[K,A,R](process: K => A => (R,Boolean),
newKeys: Set[K],
args: A): Map[K,R]
key as process instance ID and construction parameter
boolean status to express if in or out of the bubble
R. Casadei Introduction Contribution Evaluation Wrap-up 35/62
36. dynamics (intuition)
the entire network run the spawn expression
no active process instance yet
R. Casadei Introduction Contribution Evaluation Wrap-up 36/62
37. dynamics (intuition)
G is productive in device 1
a new P instance with PID 1 is injected
R. Casadei Introduction Contribution Evaluation Wrap-up 37/62
38. dynamics (intuition)
process 1 automatically spreads from participants
nbrs may opt out to prevent expansion (“live border”)
R. Casadei Introduction Contribution Evaluation Wrap-up 38/62
39. dynamics (intuition)
process 1 shrinks a little (border retracts)
R. Casadei Introduction Contribution Evaluation Wrap-up 39/62
40. dynamics (intuition)
G is productive in device 3
a new, concurrent process springs out
R. Casadei Introduction Contribution Evaluation Wrap-up 40/62
41. dynamics (intuition)
multiple process instances may intersect
process 1 about to close
R. Casadei Introduction Contribution Evaluation Wrap-up 41/62
42. dynamics (intuition)
process 1 fades away
process 3 expands, stretching the border out
R. Casadei Introduction Contribution Evaluation Wrap-up 42/62
43. example: gossip replication [coord16]
k running replicates, staggered by interval p
Gossip #1Gossip #1
Gossip #3Gossip #3
Gossip #2Gossip #2
…Time
p
k=3
Gossip #4Gossip #4
R. Casadei Introduction Contribution Evaluation Wrap-up 43/62
44. example: gossip replication [coord16]
k running replicates, staggered by interval p
def replicated[A,R](proc: A => R)
(argument: A, p: Double, k: Int) = {
val lastPid = clock(p, dt())
spawn[Long,A,R](pid => arg => (proc(arg), pid > lastPid+k),
Set(lastPid),
argument)
}
R. Casadei Introduction Contribution Evaluation Wrap-up 44/62
45. APIs on top of spawn
work-in-progress
Ǧ statuses to express the stance wrt a process instance
R. Casadei Introduction Contribution Evaluation Wrap-up 45/62
46. APIs on top of spawn
work-in-progress
Ǧ statuses to express the stance wrt a process instance
R. Casadei Introduction Contribution Evaluation Wrap-up 46/62
47. APIs on top of spawn
work-in-progress
Ǧ statuses to express the stance wrt a process instance
def statusSpawn[K,A,R](process: K=>A=>(R,Status),
keys: Set[K],
args: A): Map[K,R] =
spawn[K,A,Option[R]](k => a =>
handleOutput(handleTermination(process(k)(a))),
keys, args
).collectValues { case Some(p) => p }
R. Casadei Introduction Contribution Evaluation Wrap-up 47/62
48. example: multi-gradient
statusSpawn[ID,ID=>Double,Double](src => limit =>
gradient(src==mid,nbrRange) match {
case g if src==mid && !isSrc => (g, Terminated)
case g if g>limit(src) => (g, External) // out
case g => (g, Output) // in
},
newKeys = if(isSrc) Set(mid) else Set.empty,
args = maxExtension)
R. Casadei Introduction Contribution Evaluation Wrap-up 48/62
49. example: multi-gradient
statusSpawn[ID,ID=>Double,Double](src => limit =>
gradient(src==mid,nbrRange) match {
case g if src==mid && !isSrc => (g, Terminated)
case g if g>limit(src) => (g, External) // out
case g => (g, Output) // in
},
newKeys = if(isSrc) Set(mid) else Set.empty,
args = maxExtension)
R. Casadei Introduction Contribution Evaluation Wrap-up 49/62
56. drone swarm for fire detection
R. Casadei Introduction Contribution Evaluation Wrap-up 56/62
57. drone swarm for fire detection
Scenario
200 UAVs
start at base station, 10 random waypoints, and back
naive gossip vs. S+C+G vs. replicated gossip
R. Casadei Introduction Contribution Evaluation Wrap-up 57/62
58. drone swarm for fire detection
R. Casadei Introduction Contribution Evaluation Wrap-up 58/62
60. key points
aggregate processes model dynamic, concurrent
collective adaptive behaviours carried out by
dynamic formations of devices
implementation over field calculus and ScaFi
largely extend practical expressivity
future work
API & combinators
test on more advanced coordination scenarios
R. Casadei Introduction Contribution Evaluation Wrap-up 60/62
61. key points
aggregate processes model dynamic, concurrent
collective adaptive behaviours carried out by
dynamic formations of devices
implementation over field calculus and ScaFi
largely extend practical expressivity
future work
API & combinators
test on more advanced coordination scenarios
R. Casadei Introduction Contribution Evaluation Wrap-up 61/62
63. References
[coord16] Danilo Pianini, Jacob Beal, and Mirko Viroli. “Improving Gossip Dynamics Through Overlapping
Replicates”. In: COORDINATION 2016. Ed. by Alberto Lluch Lafuente and José Proença.
Vol. 9686. Lecture Notes in Computer Science. Springer, 2016, pp. 192–207. ISBN:
978-3-319-39518-0. DOI: 10.1007/978-3-319-39519-7_12. URL:
http://dx.doi.org/10.1007/978-3-319-39519-7_12.
[coord18a] Mirko Viroli et al. “From Field-Based Coordination to Aggregate Computing”. In: Int. Conf. on
Coordination Languages and Models. Springer. 2018, pp. 252–279.
[coord18b] Giorgio Audrito et al. “Space-time universality of field calculus”. In: International Conference on
Coordination Languages and Models. Springer. 2018, pp. 1–20.
[coord19scr] Roberto Casadei et al. “Self-organising Coordination Regions: A Pattern for Edge Computing”. In:
International Conference on Coordination Languages and Models. Springer. 2019, pp. 182–199.
[CPV16] Roberto Casadei, Danilo Pianini, and Mirko Viroli. “Simulating large-scale aggregate MASs with
Alchemist and Scala”. In: FedCSIS, Proceedings of. IEEE. 2016, pp. 1495–1504.
[ieeecom] Jacob Beal, Danilo Pianini, and Mirko Viroli. “Aggregate Programming for the Internet of Things”. In:
IEEE Computer (2015). ISSN: 1364-503X.
[taas17] Jacob Beal et al. “Self-adaptation to device distribution in the Internet of Things”. In: ACM
Transactions on Autonomous and Adaptive Systems (TAAS) 12.3 (2017), p. 12.
[tocl19Aud] Giorgio Audrito et al. “A Higher-Order Calculus of Computational Fields”. In: ACM Transactions on
Computational Logic 20.1 (Jan. 2019), 5:1–5:55. ISSN: 1529-3785. DOI: 10.1145/3285956.
[tomacs18Vir] Mirko Viroli et al. “Engineering Resilient Collective Adaptive Systems by Self-Stabilisation”. In: ACM
Transactions on Modeling and Computer Simulation 28.2 (2018), 16:1–16:28.
[VCP16] Mirko Viroli, Roberto Casadei, and Danilo Pianini. “On execution platforms for large-scale
aggregate computing”. In: UbiComp, Proceedings of. ACM. 2016, pp. 1321–1326.
R. Casadei Appendix References 63/62