If being distributed means being in different places, what does it take to compute with space, and to move computation through it?
Distribution is first of all physical, hence spatial, distribution. Mathematics and logic offer tools to represent space at very different costs, from Tarski's decidable but inefficient geometry to modal logics that read “necessarily” and “possibly” as interior and closure. Computer science meets space three times: the system is spread in space and middleware maps a logical topology onto it; computations must be situated where perception and action happen; and applications compute about space. Spatial computing covers all three. Once location matters, where a computation runs becomes a design choice, so code can move. Code mobility is classified by what travels with the code, who starts the move, and what happens to the resources the process was using.
M7 opens with a plain claim: distribution is first of all physical distribution, which basically means spatial distribution. Just as Ch. 2 asked what time is, we must ask what space is and how we represent it in reasoning and in computing, because a huge number of application scenarios now require spatial reasoning and spatial computing. (The deck borrows from the EASSS 2016 tutorial “Spatial Multi-Agent Systems”.)
For early humans, awareness of the environment was the premise to self-awareness [Martelet, 1998], and modelling and measuring it the premise to goal-driven action. Space is a conceptual tool to model where we live and to organise resources, activities and their dynamics. How we represent space and how we reason about it affect each other, in ways not yet well understood; [Li & Gleitman, 2002] and [Levinson et al., 2002] state two clearly contrasting views. Humans have their own ways to process spatial information [Byrne & Johnson-Laird, 1989], and are not alone in reasoning spatially [Gentner, 2007; Haun et al., 2006]. Human spatial reasoning may be either qualitative or quantitative, but is mostly approximated [Dutta, 1988]; Clements & Battista [1992] survey how humans learn it.
Geometry abstracts away from perception: basic concepts (point, line, angle, circle) and shapes (triangle, rectangle, trapezoid), from Babylonian astronomy through the Egyptians to Greek geometry. With Euclid's Elements [Kline, 1972] it stops being “a set of empirical observations and practical methods for measuring distances, area of land, etc.” and becomes “an abstract mathematical theory” with “its own, absolute right of existence and development” [Aiello et al., 2012], built on axioms, theorems and proofs. Physical space may not satisfy Euclid's fifth postulate, and non-Euclidean geometries follow: elliptic (Riemann) and hyperbolic (Bolyai, Lobachevsky). Aiello et al. call this “an unsurpassed manifestation of the superiority of the abstract, logical approach of mathematics over the empirical approach”.
Kline asks what geometrical knowledge “must be the logical starting point for a science of space” [Russell, 1956, foreword]. The slides trace three answers [Aiello et al., 2012]:
Modal logics are particularly interesting among non-classical logics of space: they can be more specific and have better computational behaviour, very often being decidable. The route goes through topology. The basic spatial problem is distance, handled with metrics; neighbourhood generalises metric, and leads to topology [Singer & Thorpe, 1967], now “one of the fundamental branches of contemporary mathematics”.
The modal operators are reinterpreted: □ (necessarily) as the interior operator, ◇ (possibly) as the closure operator of a topological space. The modal logic S4 [Bull & Segerberg, 1984] is sound and complete with respect to this topological semantics, and S4 is the modal logic of any Euclidean space.
A point is in □X when some neighbourhood of it lies inside X, in ◇X when every neighbourhood touches X.
Mathematical morphology (MM) analyses shape and spatial information, as in image processing; any mathematical theory of shapes can contribute to it. Modal morphology comes from the similarity between the algebraic properties of MM operators and of modal operators. It is efficient for spatial reasoning: to guide the exploration of space in a focus-of-attention process, and for recognition and interpretation. In short, we can compute about space and its organisation with diverse levels of efficiency.
With a structuring element (here a cell and its 8 neighbours), erosion keeps the cells whose whole neighbourhood is in X, dilation those whose neighbourhood meets it. Like □ and ◇ they are dual (□X = ¬◇¬X), monotone, and □X ⊆ X ⊆ ◇X. But a topological interior is idempotent (S4: □X → □□X), while eroding twice can shrink further. Opening, dilation after erosion, is ◇□X (□ applied first) and removes thin spurs and specks; closing, □◇X, fills narrow holes and gaps. Both are idempotent.
Paint a region X (click or drag), pick an operator, read what it removed or added. Try □ then □□, and ◇□ on the spur.
Read spatially, distributed systems give software components a new space: computational units, channels and data are physically distributed. Local networks built the first virtual spaces, the Internet and IP-based locations the first “global” ones, and the WWW the first global space shared by agents and humans, a knowledge-intensive one.
Middleware (Ch. 1), the operating system of distributed systems, gives that space structure. It possibly supports mobility [Fuggetta et al., 1998], the second half of this chapter, and through EAI (enterprise application integration) it integrates applications horizontally into aggregated environments. Above all, it provides topological notions and maps logical distribution upon physical distribution: JADE's containers and platforms represent locality for agents [Bellifemine et al., 2007]. Sometimes, however, physical distribution is what actually matters.
Situated computation: computation occurring locally where either perception or action is taking place, elaborating on perception, driving action, or both. When system requirements mandate situated computations within a distributed physical environment, situated distributed systems are the only way out.
Examples: disaster recovery, environmental monitoring, crowd steering. IoT makes the need unescapable. The slides sum up:
Space can also be what a computation is about.
Computational geometry [de Berg et al., 2000] uses space to represent problems, spatial or not, geometry to make them computable, and algorithms to solve them. The slides' example: find the nearest coffee shop on the Cesena campus, then for any point, by dividing the campus into regions containing all the points for which each shop is the nearest. How do we compute this?
The partition is the Voronoi diagram of the shops. Once computed, “which shop is nearest?” becomes “which region am I in?”.
GIS capture, store, check and display data on positions on the Earth (maybe other planets soon), so in GIS the notion of space is clearly defined.
A computer-based system that supports the study of natural and man-made phenomena with an explicit location in space. To this end, the GIS allows data entry, data manipulation, and production of interpretable output that may provide new insights about the phenomena.
VR builds artificial worlds, represented exclusively as computational environments, where “real people” perform sensorimotor and cognitive activity.
Virtual reality is a scientific and technical domain that uses computer science (1) and behavioural interfaces (2) to simulate in a virtual world (3) the behaviour of 3D entities, which interact in real time (4) with each other and with one or more users in pseudo-natural immersion (5) via sensorimotor channels.
Interaction and immersion are the key concepts. Gaming is VR's most prominent application: the slides cite Microsoft Kinect as a well-known VR application, and Unity3D and Unreal Engine for building whole virtual worlds.
LBS add a virtual layer to physical space: they use the position of a user or device to provide information, entertainment or security. Examples: Around Me, Mobike; BotFighters, GeoZombie [Prandi et al., 2016], Ingress, Pokémon Go, Harry Potter: Wizards Unite, Minecraft Earth.
AR integrates virtual and physical space, merging real-world information with context-sensitive digital content in a meaningful way [Furht, 2011]. The point is that the two layers mutually affect each other, dynamically.
Mixed reality is an old term possibly coming back into use, yet with an uncertain meaning. Gamification leads from AR to applications of any sort: medical, civic, educational, touristic. GeoZombie [Prandi et al., 2016] went a step further than Pokémon Go, and before it.
Spatial computing is about systems where space cannot be abstracted away from computation [Shekhar et al., 2016]. The Dagstuhl workshop “Computing Media and Languages for Space-Oriented Computation” (06361) identified three classes of spatial systems:
Class 2 is situated computation; class 3 is computing about space.
A spatial computer (or spatial computing system) is a computational system where (the logic of) space is essential in representing the problem, defining the computation, and expressing the result.
Spatial computing is any form of computation where (the logic of) space is relevant to express and perform computation.
Spatial computing languages (SCL) bring space into programming languages, letting programmers deal explicitly with space-related aspects at the language level. Spatial computing is a “landscape framework” for the many sorts of spatial computations and systems; the already-long list of SCLs can be analysed and compared through the conceptual framework of [Beal et al., 2013].
M7 closes with four points:
The third point is the hinge. If computation is situated, where it runs is part of its meaning and its cost, so we should be able to change it: that is the middleware “possibly supporting mobility”.
C6 draws mostly on Fuggetta, Picco & Vigna [1998]. Sometimes passing data is not enough: we want to change where code executes (for load balancing, security, scalability…), or we do not want to separate data from the code that runs on them (objects, agents). Then code should be passed. Traditionally code moves with its whole computational context, so moving code is moving processes: process migration [Milojicic et al., 2000].
Why migrate code
But what moves with a program? Execution status, pending signals, data. A process has actions to execute, a state, and an environment (a computational context). Hence:
A process can be thought of as three segments:
Depending on which portion of a process is moved along with the code, we classify different types of code mobility.
Weak mobility is the bare minimum: only the code segment is transferred, possibly with initialisation data. The code runs ex novo every time: no computational context matters, or the one needed is the target's. The only requirement is that the target can execute the code, so it is very simple.
Strong mobility transfers the execution segment along with the code segment: a process can be stopped, moved, and restarted on another machine. It is very demanding: the technological environment, typically the middleware, must allow for it.
Two more questions: who starts the move, and what happens at the target.
Sender-initiated migration starts where the code resides or runs: search-bots, mobile agents. Servers should know clients and secure their resources: a more complex interaction scheme.
Receiver-initiated migration (the slide also says client-initiated) starts at the target machine, which wants a new behaviour added: Java applets, JavaScript chunks. Few client resources need securing and clients may be anonymous: a less complex scheme.
Target vs separate process. Weakly mobile code may run in the target process or a separate one. Java applets run in the browser's address space, so no inter-process communication is needed at the target; the main problem is protection against malicious or buggy code, solved by running mobile code in a separate process.
Migrate vs clone. Strong mobility can also be supported by remote cloning: an exact copy of the process runs on the target machine in parallel with the original, as when a UNIX process forks a child that executes on a remote machine. Cloning is an alternative to migration, and in some sense improves distribution transparency: processes are transparently replicated on many machines.
Pick a scenario, answer the three questions, press Check; the path lights up in Fig. 3.3. Free classification describes any choice.
The article also classifies designs by where code, resources and execution are. Client-server (CS): the server has code and resources and runs its own code on request (calling an existing stored procedure is CS, not mobility). Remote evaluation (REV): the client ships code to the server holding the resources. Code on demand (COD): the client fetches code to use on its own resources (applets). Mobile agent (MA): an executing component moves, with its state, to the resources.
Resources may not be as easy to move as code and variables: a huge database could in theory cross the network, but in practice it will not. Either references are updated or resources are moved, and two issues decide which.
How does the resource segment refer to resources? Process-to-resource binding
How does the resource relate to the hosting machine? Resource-to-machine binding
The slide crosses the two in a table of actions on references to local resources when migrating code [Tanenbaum & van Steen, 2017], using four actions:
Click a cell, or pick a resource below to see where it falls and why. First action preferred; bracketed ones are alternatives.
| process ↓ · machine → | Unattached | Fastened | Fixed |
|---|---|---|---|
| By identifier | |||
| By value | |||
| By type |
By columns: unattached resources travel cheaply, so MV and CP are open; a fixed resource never leaves its machine, so only GR or RB. By rows: a binding by identifier demands that very resource, so CP and RB never appear; a fixed resource bound by identifier gets a GR to the same resource, not a different local one. A binding by type accepts any resource of that type, so RB always comes first. GR is the common fallback, but every later access then crosses the network. As C6 concludes, code may move for many good reasons, and which type of mobility fits depends on application needs or technology constraints.
Practise answering out loud, two minutes each.
Distribution is spatial, and how we represent space shapes what we can reason about. The tools differ in cost: Tarski's geometry is decidable but inefficient; modal logics of topology (□ interior, ◇ closure; S4 for Euclidean space) are specific and often decidable.
Thunk is class 1: space as a resource (more machines, more computing power). It is not situated (no perception or action tied to a place) nor spatial (results do not represent space). Saying so beats claiming more.
Weak: a target able to execute the code, each run ex novo. Strong: middleware that captures the execution segment (stack, program counter, private data) and restores it elsewhere.
Any local printer: by type, fixed → RB (or GR). A particular database: by identifier, fastened → GR (or MV). A library: by value, unattached → CP (or MV, GR). By-identifier bindings never allow RB.
Weak mobility in the slides' terms: a program (the DSL term) travels with initialisation data (the input) and runs from scratch at the target. The evaluator never moves; every node has it. A closed DSL also answers the protection problem without a separate process: peers can only send what the evaluator interprets.
| Slides | Content | Here |
|---|---|---|
| M7 · Prologue | Space in DC; disclaimer | §1 |
| M7 · Space in Math & Logic | Humans & space; spatial reasoning I–II | §1 |
| M7 · Geometry | Modelling space; Euclid; non-Euclidean | §2 |
| M7 · Logics | Euclid to Tarski I–III; modal logics of topology I–II; MM; summary | §2 |
| M7 · Physical space | DS & middleware recaps; situated DS; summary | §3 |
| M7 · Computing with space | Computational geometry; GIS; VR; gaming | §4 |
| M7 · Physical meets computational | LBS; AR | §4 |
| M7 · Spatial computing | I–II; SCL; summary | §5 |
| M7 · Conclusion | Summing up | §5 |
| C6 · Premise | Disclaimer | §6 |
| C6 · Moving code | Moving code; reasons | §6 |
| C6 · Understanding mobility | I–II: three segments | §6 |
| C6 · Weak / strong | Weak mobility; strong mobility | §6 |
| C6 · Initiative & execution | Sender/receiver I–II; separate vs target; cloning | §7 |
| C6 · Models | Alternatives (figure) | §7, Fig. 3.3 |
| C6 · Local resources | Local resources; bindings; actions table | §8 |
| C6 · Conclusion | Summing up | §6–§8 |