Part III — Models and machinery · Chapter 8

Modelling: architectures and process algebra

~22 min2 instrumentsA.Y. 2025/26 · Prof. Omicini
M8 Software & System ArchitecturesM9 Process Algebra
The question

How do we represent a distributed system so that we can compare designs, and then prove something about how it behaves?

The argument in one paragraph

Software architectures organise a complex system as components, connectors and data; system architectures place the components. Recurring organisations are architectural styles, which differ in how they couple processes in space and time. Architectures model structure, not behaviour, and prove nothing. Process algebra fills that gap for concurrency: a few operators (+, ;, ∥), laws that serve as axioms for proofs, and transition rules that serve as a reference for implementation. When the rules obey the laws, the implementation inherits formal properties. Physical distribution is still left out.

Why model a distributed system

The basic ontology of Ch. 1 (computational processes in a context of machine, resources, time and space) is our ground. Now we need a general way to represent distributed systems, independent of their heterogeneous nature. Four questions frame it:

  1. How can distributed systems be represented at design time?
  2. How can they be represented at run time?
  3. How do we account for their evolution over time?
  4. How do we account for their distribution in space?

Two answers follow: the classical view of software and system architectures, borrowed largely from Tanenbaum & van Steen [2017], for structure; process algebra for behaviour.

Software and system architectures

To manage their complexity, distributed systems should be properly organised, and organisation is mostly expressed in terms of software components. The ways to organise components are classified as software architectures. Their many instantiations, with components given an actual place in the system, are often called system architectures.

Component & connectorM8 · Components & Connectors

A component is a modular unit with well-defined interfaces, replaceable within its environment. Interfaces go both ways: they are both required and provided.

A connector is an abstraction mediating communication, coordination and cooperation among components: anything providing a mechanism for interaction among them.

Together they produce a huge range of configurations, classified as architectural styles. Fielding gives the precise vocabulary:

Software architecture[Fielding, 2000]

A software architecture is an abstraction of the run-time elements of a software system during some phase of its operation. A system may be composed of many levels of abstraction and many phases of operation, each with its own software architecture.

A software architecture is defined by a configuration of architectural elements (components, connectors, and data) constrained in their relationships in order to achieve a desired set of architectural properties.

Architectural elements [Fielding, 2000]

  1. Component: an abstract unit of software instructions and internal state that provides a transformation of data via its interface.
  2. Connector: an abstract mechanism that mediates communication, coordination, or cooperation among components.
  3. Datum: an element of information that is transferred from a component, or received by a component, via a connector.

The architectural properties of a software architecture derive from the selection and arrangement of components, connectors and data. They include functional properties and quality attributes such as ease of evolution, reusability of components, efficiency and dynamic extensibility. Properties are induced by constraints, and architectural constraints are often motivated by applying a software engineering principle to an aspect of the architectural elements. You choose constraints; properties follow.

The summary slide contrasts them:

Software architecture

Concerned with logical organisation, possibly over time.

System architecture

Concerned with component placement in a distributed setting. It deals with spatial distribution.

Beyond the slides · the usual system architectures

The slides stop at the definition. Tanenbaum & van Steen [2017] name three families: centralised (client-server, possibly split into tiers across machines), decentralised (peer-to-peer, every node in the same role) and hybrid (e.g. edge-server systems). Thunk's cluster of identical workers is decentralised.

Architectural styles

An architectural style is formulated in terms of four things:

  1. Components.
  2. Connections: the way components are connected to each other.
  3. Data flowing through the components.
  4. Configuration: how all of the above are put together to build the system.

A style classifies systems with the same sort of organisation, lets them be compared, and provides general patterns for design.

Architectural style[Fielding, 2000]

An architectural style is a coordinated set of architectural constraints that restricts the roles/features of architectural elements and the allowed relationships among those elements within any architecture that conforms to that style.

A style captures the essence of a pattern of interaction by ignoring the accidental details of the rest of the architecture. Like design patterns, styles are devised out of existing systems rather than invented. Four are identified today as the main ones for distributed systems, and the slides add a fifth:

Main architectural styles for distributed systems

  1. Layered. Components of a layer only call components of the layer below, and are only called by the layer above. Requests flow top-down and responses bottom-up; control follows the same path as data.
  2. Object-based. Components are objects connected through an RPC mechanism. Client-server architectures are built out of this style. Layered and object-based “are the most important styles for distributed systems today”, but “a lot of things are going to happen in the future, which may change such an overall picture”.
  3. Data-centred. Processes communicate through a shared repository, passive (reactive) or (pro)active. Its main features depend on the choice of repository:
    1. how information is represented;
    2. how events are handled;
    3. how the repository behaves in response to interaction;
    4. how processes interact with and through it.
    Examples are everywhere: web-based systems are largely data-centric, and many applications still share files around the network.
  4. Event-based. Processes communicate through an event bus that propagates events, possibly carrying data. Main example: publish/subscribe, where publishers publish events through the middleware and subscribers receive the events they subscribed to. Processes need not reference or know each other (referentially uncoupled) and need not share the same space (uncoupled in space).
  5. Shared data-space. Data-centred plus event-based: the repository is a persistent data-space and also an event bus, storing data along with related events. Main example: the blackboard system. Processes put data in the blackboard, which aggregates knowledge, implements policies and drives their coordination. Processes need no compresence: they are also uncoupled in time.
(a) LAYERED Layer N Layer N−1 ⋮ Layer 1 request flowresponse flow (b) OBJECT-BASED Object Object Object Object method callRPC between objects (c) EVENT-BASED Component Component Component Event bus publishsubscribe /notification… no one names anyone (d) SHARED DATA-SPACE Component Component Shared (persistent)data-space publishdata deliverysub data outlives its writer
Fig. 8.1 — Four of the five styles, after the figures the slides take from Tanenbaum & van Steen [2017]. Data-centred has no figure in the slides. It is (d) without the event bus.

Coupling in space and in time

The last two styles are described by what processes do not need, which gives two axes for comparing all five. Processes are referentially uncoupled when they communicate without referencing or knowing each other; the slides pair this with being uncoupled in space. They are uncoupled in time when they communicate without being active at the same time. The two are independent: a publisher need not know its subscribers, but a subscriber that is absent when the event propagates misses it. Hence the slides' “also uncoupled in time” for the shared data-space.

Instrument 1Coupling classifier

Pick a style to see where it sits, or answer the two questions for your own design (a Thunk steal request, say).

Temporally coupled
Temporally uncoupled
Referentially coupled
Directlayered, object-based
Mailboxnone of the five
Referentially uncoupled
Event-basedpublish/subscribe
Shared data-spaceblackboard

M8 closes with a frank assessment. Styles are approximative and maybe non-scientific ways to model systems, yet expressive and abstract enough to help distributed system engineering: a simple and solid start. But is that a well-grounded science? Can we prove theorems about architectures? What is the role of “math-like” formalisms such as process algebra?

From boxes to behaviour: process algebra

Architectures are not enough:

  1. Properties are not really proven without some well-defined formal representation.
  2. Architectures model structure and organisation, not really behaviour.
  3. Behavioural properties can be understood qualitatively, not really demonstrated.

Concurrency is the first source of complexity in distributed systems. Formal models of concurrent systems abstract away from physical location, as architectures do, but more formally. They are aimed at:

  1. capturing the essence of concurrent and distributed systems;
  2. abstracting away from unnecessary details;
  3. providing a non-ambiguous representation of computational entities and their behaviour;
  4. offering the chance to compute properties.

Of several approaches, the course takes process algebra.

Process, algebra, calculus · process algebra[Bergstra et al., 2001]

A process is a series of actions or events. An algebra is a calculus of symbols that combine according to certain defined laws. A calculus is a system or method of calculation.

A process algebra is a formal description technique for complex computer systems, especially those with communicating concurrently-executing components.

Where it comes from

Following Baeten [2005]: before process algebra, basically only Petri nets [Peterson, 1977] existed for concurrent systems. Formal reasoning mostly gave semantics (meaning) to programming languages, in three ways:

  1. Operational semantics. A program is modelled as the execution of an abstract machine. A state is a valuation of variables, and a transition between states is an elementary program instruction.
  2. Denotational semantics. More abstract: a program is usually modelled by a function transforming input into output.
  3. Axiomatic semantics. The emphasis is on proof methods for proving programs correct. The central notions are program assertions (triples of precondition, statement, postcondition) and invariants.

Early models saw behaviour as an input/output function. Automata theory then modelled a process as an automaton: states, and transitions between them. What was missing? Interaction, and systems. Process algebra deals with interacting, concurrent processes.

Process algebra, historically[Baeten, 2005]

Process algebra can be seen as the study of the behaviour of concurrent/distributed systems by algebraic means.

“Algebraic” is meant literally: process algebras use the methods of universal algebra [MacLane & Birkhoff, 1967]. A process algebra is any mathematical structure satisfying the axioms given for the basic operators, and a process is an element of a process algebra (in Italian, more clearly, algebra dei processi). With the axioms you calculate with processes, though process algebra often crosses the boundaries of universal algebra.

Best-known process algebras [Bergstra et al., 2001]

  1. ACP, Algebra of Communicating Processes [Bergstra & Klop, 1984].
  2. CCS, Calculus of Communicating Systems [Milner, 1980].
  3. CSP, Communicating Sequential Processes [Brookes et al., 1984].
Beyond the slides · the three schools in one line each

ACP: axioms first, communication as a function γ on actions (the rules below are in its style). CCS: complementary actions a, ā synchronise into a silent τ; bisimulation is its reference equivalence. CSP: processes synchronise on shared events; its standard semantics compares traces and refusals (failures), not bisimulation.

Key ingredients shared by all process algebras [Bergstra et al., 2001]

  1. Compositional modelling: a small number of constructs for building larger systems up from smaller ones.
  2. Operational semantics: typically structural operational semantics (SOS) [Plotkin, 1981]. It describes the single-step execution capabilities of systems, so that terms of the algebra translate into labelled transition systems (LTS): states linked by transitions labelled with actions.
  3. Behavioural reasoning: behavioural relations are used to relate different systems given in the algebra [Tribastone, 2014].

Operators and laws

Start from a set of atomic actions (a, b, …), each representing indivisible behaviour. Basic operators combine processes into systems [Baeten, 2005]:

  1. x + y alternative composition: executes either x or y.
  2. x ; y sequential composition: executes first x, then y. Often written x · y.
  3. x ∥ y parallel composition: executes x and y concurrently, in parallel.

Neutral elements are ignored for now. Precedence “typically goes from + (weakest) to ;”, so a ; b + c is (a ; b) + c. The slides do not rank ∥, so here it is always parenthesised.

Structural laws [Baeten, 2005]

LawName in the slides
x + y = y + x1 · commutativity of alternative composition
x + (y + z) = (x + y) + z2 · associativity of alternative composition
x + x = x3 · idempotency of alternative composition
(x + y) ; z = x ; z + y ; z4 · right distributivity of + over ;
(x ; y) ; z = x ; (y ; z)5 · associativity of sequential composition
x ∥ y = y ∥ x6 · commutativity of parallel composition
(x ∥ y) ∥ z = x ∥ (y ∥ z)7 · associativity of parallel composition
Laws as axioms[Baeten, 2005]

Any mathematical structure with three binary operations satisfying the above laws is a process algebra. Most typically such structures are expressed as automata, mostly called transition systems.

Choosing the laws: linear vs branching time

The seven laws can be extended with left distributivity: x ; (y + z) = x ; y + x ; z. What changes?

Linear time

With both right and left distributivity, the moment of choice does not matter. a ; (b + c) equals a ; b + a ; c.

Branching time

Without left distributivity, the moment of choice matters. After a, the first process still offers b and c. The second has already committed to one of them.

It matters once the environment interacts: a user wanting c after a always gets it from the first process, but may find it gone in the second.

Slide check · names of the laws

The slides call law 4 “right distributivity of + over ;”. The usual name, as with multiplication over addition, is distributivity of ; over +; likewise for the left law. The linear-time slide's “right and left associativity” means the two distributivity laws, and “axioms and transactions” on the verification slide means axioms and transitions.

Semantics: operational vs axiomatic

Laws say which processes are equal; transition rules say what a process can do. Each rule reads “if the premises above the line hold, so does the conclusion below”. x a x′ means that x can execute a and then behave as x′. The symbol ✓ means successful termination.

Atomic action · alternative · sequential
a a ✓
x a ✓
x + y a ✓
x a x′
x + y a x′
y a ✓
x + y a ✓
y a y′
x + y a y′
x a ✓
x ; y a y
x a x′
x ; y a x′ ; y
Parallel · interleaving
x a ✓
x ∥ y a y
x a x′
x ∥ y a x′ ∥ y
y a ✓
x ∥ y a x
y a y′
x ∥ y a x ∥ y′
Parallel · communication via γ
x a ✓y b ✓
x ∥ y γ(a,b) ✓
x a x′y b ✓
x ∥ y γ(a,b) x′
x a ✓y b y′
x ∥ y γ(a,b) y′
x a x′y b y′
x ∥ y γ(a,b) x′ ∥ y′

An atomic action executes and terminates. A choice proceeds either way; the other branch disappears. A sequence proceeds one way: when x terminates, y is left. Parallel composition either interleaves (one side moves; if it terminates, the other remains) or lets both sides act together through a communication function γ that turns a pair of actions into one. The four communication cases differ in which sides terminate. Applied repeatedly to a term, these rules (an SOS) build its LTS.

Instrument 2Process-term explorer

Pick a preset or type a term (actions, +, ;, | for ∥, parentheses). The rules above build its LTS; each transition lists its rule. Fill compare with to test equal traces and bisimilarity.

Law 4 holds under the rules: (a + b) ; c and a ; c + b ; c are bisimilar. Left distributivity does not: a ; (b + c) and a ; b + a ; c share traces but branch differently. The rules build a branching-time algebra, consistent with the seven laws (for ∥, given a commutative and associative γ, as ACP assumes). That is the relation between the two views:

Operational vs axiomaticM9 · roughly speaking
  1. Structural laws are the axioms that allow system properties to be proven.
  2. Transition rules give an operational representation suitable as a reference for implementation.
  3. When transitions are defined so as to abide by the structural laws, in principle we have an implementation with formal properties.

If every law is valid for the LTSs the rules produce, what you prove with the laws holds for the running thing. The explorer's verdict on law 4 is a small instance of that check.

Uses of process algebra [Baeten, 2005]

  1. Specification. Process algebra represents concurrent systems, their structure and behaviour. To specify a system S:
    1. (possibly) select the most suitable process-algebraic framework and its structural laws;
    2. define the atomic actions of S;
    3. define the behaviour of S as transitions that comply with the structural laws.
  2. Verification. Process algebra lets you calculate a system's behaviour: exploit the axioms and the transitions to derive properties of S.
Beyond the slides · what equivalences buy

Behavioural relations make “same behaviour” precise. Trace equivalence compares action sequences (linear time). Bisimulation also matches every choice point step by step (branching time). An equivalence lets you swap a component for an equivalent one, or check a refined design against its specification. It checks a model; it does not by itself make the code correct.

What formal models buy, and what they do not

Lessons learnt · for good

  1. Formal models are essential in distributed systems for proving properties and for constraining the implementation of components and systems.
  2. Process algebras are among the most widely used techniques for representing distributed systems and reasoning about their properties.
  3. It is not so difficult to use them to represent some basic properties.
  4. Proofs can be built over systems.

Lessons learnt · for not-so-good

  1. Proofs are not intuitive enough to be an everyday tool for software engineers.
  2. We only dealt with concurrent computation.
  3. Physical distribution was not even mentioned: we know how to deal with concurrent systems, in principle, not with distributed ones.
  4. Formal techniques that deal with distribution exist, but for this course process algebra is enough.

Architectures cover placement but prove nothing; process algebra proves but ignores space. A full model needs both, plus time (Ch. 2) and space (Ch. 3).

For the oral

Practise answering these out loud, about your project.

What are your project's software architecture and its system architecture?

Software: components (worker, stealer, evaluator, dashboard), connectors (message passing between BEAM processes), data (computations as DSL terms, results). System: one worker per container in a Compose cluster, all peers. Name your constraints (no central scheduler, pure tasks) and the properties they induce.

Which style fits Thunk, and how coupled is it?

At its core, direct requests: a stealer names a random peer and needs it alive, so it is coupled in space and in time. Each node is internally layered (application, BEAM, network). A dashboard that only listens to events would be event-based. Only a persistent shared store of results would add time uncoupling.

Why is a box-and-arrow architecture not a proof?

It models structure, not behaviour, and has no formal semantics, so behavioural properties are understood qualitatively, not demonstrated. Process algebra adds unambiguous terms, laws to calculate with, and rules that build an LTS.

Operational vs axiomatic: what does each give you?

Laws are axioms for proofs; transition rules are a reference for implementation. If the rules obey the laws, the implementation carries the proven properties. Show law 4 holding and left distributivity failing in the explorer.

Is a ; (b + c) the same process as a ; b + a ; c?

Same traces, so equal in linear time (with left distributivity). Different in branching time, because the second chooses at a. The slides' seven laws and rules are branching-time.

What happens to ✓ in parallel composition?

If x a ✓ then x ∥ y a y: the terminated side vanishes. In the four communication cases the result is ✓, x′, y′ or x′ ∥ y′, according to which sides terminate.

Project lens · Thunk
Slide coverage: where each slide section went
SlidesContentHere
M8 · PrologueMotivation; disclaimer§1
M8 · Software arch.Handling complexity; components & connectors I–II; what is a software architecture; elements; properties & constraints§2
M8 · Software arch.Styles to classify systems§3
M8 · StylesDefinition; main examples; the five styles (I–III each)§3
M8 · ConclusionSumming up; questions§2, §3
M9 · PrologueProving features; focus on concurrency; harnessing complexity§4
M9 · BasicsBasic concepts; before process algebra I–II; ACP/CCS/CSP; basic ingredients; axioms; history§4
M9 · OperatorsBasic operators; basic laws I–II; choosing the laws I–II§5
M9 · OperatorsTransitions I–II; operational vs axiomatic; uses I–II§6
M9 · ConclusionLessons learnt I–II§7