Part I — Foundations · Chapter 3

Space, situatedness and mobility

~22 min3 instrumentsA.Y. 2025/26 · Prof. Omicini
M7 Computing with SpaceC6 Code Mobility
The question

If being distributed means being in different places, what does it take to compute with space, and to move computation through it?

The argument in one paragraph

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.

Distribution is spatial distribution

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.

Space in mathematics and logic

Geometry: from measuring land to axioms

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”.

From Euclid to Tarski

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]:

  1. Axiomatic. From Euclid to Peano, axiom systems are related to basic geometric notions; Hilbert gives a sound axiomatic foundation [Hilbert, 1950].
  2. Analytic. Descartes coordinatises space, so geometric problems are solved algebraically. Klein's Erlangen program studies not figures but transformations preserving fundamental properties [Balbiani et al., 2007]: an abstract algebraic foundation.
  3. Logical. Tarski makes elementary geometry a first-order theory with just two relations, betweenness and equidistance [Tarski, 1959]. Via coordinates it is like the field of reals, whose first-order theory is complete and decidable: an algorithm decides any statement of elementary Euclidean geometry, though not efficiently.

Modal logics of topology

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”.

Topological reading of modal operators[McKinsey & Tarski, 1944]

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.

Beyond the slides · what “similar” means

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.

Instrument 1Neighbourhood operators

Paint a region X (click or drag), pick an operator, read what it removed or added. Try □ then □□, and ◇□ on the spur.

in X and in resultin X, removedadded (not in X)

Physical space in computational systems

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 computationM7

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:

  1. Distributed systems originate from the physical distribution of computation, communication and data.
  2. Middleware provides a logical topology upon physical distribution.
  3. Pervasive systems and IoT make situated computation a requirement, and situated distributed systems the only viable approach.
  4. Nowadays non-trivial computational systems need to be space-aware.

Computing about space

Space can also be what a computation is about.

Computational geometry and GIS

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?

ABCDE you campus · 5 coffee shops
Fig. 3.1 — The coffee-shop partition: each region holds the points closer to its shop than to any other; borders lie on perpendicular bisectors.

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.

Geographic information system[Huisman & de By, 2009]

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.

Virtual reality and gaming

VR builds artificial worlds, represented exclusively as computational environments, where “real people” perform sensorimotor and cognitive activity.

Virtual reality[Fuchs et al., 2011]

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.

Precision · Kinect

Kinect is a motion-sensing input device: a behavioural interface (2) in Fuchs's definition, not a VR application itself.

Physical space meets computational space

Location-based services

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.

Augmented reality

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

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:

  1. Distributed systems, where space is either a means or a resource: intensive computing, or coping with space.
  2. Situated systems, where location in space (and time) is essential for computation: embedded in space.
  3. Spatial systems, where space is fundamental to the application problem, is explicitly represented and manipulated, and is essential to express the result of a computation: representing space.

Class 2 is situated computation; class 3 is computing about space.

Spatial computer · spatial computing[Beal et al., 2011]

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:

  1. Maths and logic tools to represent, analyse and reason about space.
  2. Computing about space and its organisation.
  3. Different types of code mobility are possible.
  4. Spatial computing as a framework for spatial computations and systems.

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”.

Moving the computation

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

  1. Load balancing.
  2. Minimising communication.
  3. Optimising perceived performance.
  4. Improving scalability.
  5. Flexibility through dynamic configurability.
  6. Improving fault tolerance.

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:

Process model for code migration[Fuggetta et al., 1998]

A process can be thought of as three segments:

  1. Code segment: the set of executable instructions of the process.
  2. Execution segment: the store for the execution state of the process, with private data, stack and program counter.
  3. Resource segment: the set of references to the external resources the process needs, like files, printers, devices, other processes.

Depending on which portion of a process is moved along with the code, we classify different types of code mobility.

PROCESS Code segment Execution segment Resource segment executable instructionsprivate data · stack · program counterreferences to external resources weak:code(+ init data)strong: code+ executionstate file database printer outside the process: bindings decide (§8)
Fig. 3.2 — The three-segment process model. The resource segment holds only references.

Weak 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

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.

Alternatives for code migration

Two more questions: who starts the move, and what happens at the target.

Sender-initiated

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

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.

Mobilitymechanism Weak mobility Strong mobility Sender-initiated Receiver-initiated Sender-initiated Receiver-initiated in target process in separate process in target process in separate process migrate process clone process migrate process clone process
Fig. 3.3 — Alternatives for code migration [Tanenbaum & van Steen, 2017].
Instrument 2Code-mobility classifier

Pick a scenario, answer the three questions, press Check; the path lights up in Fig. 3.3. Free classification describes any choice.

1 · What travels with the code?
2 · Who initiates the move?
3 · What happens at the target?
Beyond the slides · the four design paradigms of Fuggetta et al. [1998]

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 that do not move

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

  1. By identifier: the process needs the resource with a given name, e.g. via a URL or a local ID.
  2. By value: it needs a resource based on its value, e.g. code libraries.
  3. By type: it needs a resource based on its type, typically local devices like printers and monitors.

How does the resource relate to the hosting machine? Resource-to-machine binding

  1. Unattached: easily moved between machines, like files associated with the migrating code.
  2. Fastened: can be moved, but at a cost, like a local database.
  3. Fixed: bound to a specific machine, like a monitor.

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:

  1. MV: move the resource along with the code.
  2. GR: establish a global, system-wide reference to the resource, which stays where it is.
  3. CP: copy the value of the resource to the target.
  4. RB: rebind the process to a locally available resource of the same type.
Instrument 3Resource-binding explorer

Click a cell, or pick a resource below to see where it falls and why. First action preferred; bracketed ones are alternatives.

process ↓ · machine →UnattachedFastenedFixed
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.

For the oral

Practise answering out loud, two minutes each.

Why does a distributed systems course talk about geometry, topology and modal logic?

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.

Distributed, situated, spatial: which Dagstuhl class is your project in?

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 vs strong mobility: what does each ask of the platform?

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.

A migrating process uses a printer, a database and a library. What happens to each reference?

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.

Thunk ships tasks as a small operator DSL, not as closures. Is that code mobility?

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.

Project lens · Thunk
Slide coverage: where each slide section went
SlidesContentHere
M7 · PrologueSpace in DC; disclaimer§1
M7 · Space in Math & LogicHumans & space; spatial reasoning I–II§1
M7 · GeometryModelling space; Euclid; non-Euclidean§2
M7 · LogicsEuclid to Tarski I–III; modal logics of topology I–II; MM; summary§2
M7 · Physical spaceDS & middleware recaps; situated DS; summary§3
M7 · Computing with spaceComputational geometry; GIS; VR; gaming§4
M7 · Physical meets computationalLBS; AR§4
M7 · Spatial computingI–II; SCL; summary§5
M7 · ConclusionSumming up§5
C6 · PremiseDisclaimer§6
C6 · Moving codeMoving code; reasons§6
C6 · Understanding mobilityI–II: three segments§6
C6 · Weak / strongWeak mobility; strong mobility§6
C6 · Initiative & executionSender/receiver I–II; separate vs target; cloning§7
C6 · ModelsAlternatives (figure)§7, Fig. 3.3
C6 · Local resourcesLocal resources; bindings; actions table§8
C6 · ConclusionSumming up§6–§8