Papers
Topics
Authors
Recent
Search
2000 character limit reached

Modular Sessions in Concurrency

Updated 9 July 2026
  • Modular Sessions are techniques that decompose protocol specifications into modular, partially verifiable components for concurrent systems.
  • They implement strategies like partial typing, layered integration, and mixed-choice modularization to preserve safety properties while easing composition.
  • Practical applications include object-oriented, callback-based, and hyper-environment frameworks that abstract complex session interactions into manageable modules.

Searching arXiv for recent and foundational papers on modular sessions and related session-typing formalisms. Modular Sessions denotes a family of approaches in session-typed and protocol-typed concurrency that recover modularity in the specification, verification, implementation, or composition of communication protocols. The term is not used uniformly across the literature. In some works, it denotes partial specification and partial verification of a selected subset of participants within a larger asynchronous multiparty session; in others, it denotes modularisation of mixed-choice systems into loosely coupled modules, two-level integration of scenario specifications, constructive assembly of multiparty behavior from dyadic building blocks, runtime linking of previously created session fragments, or the encapsulation of linear channels behind modular object or callback interfaces (Barbanera et al., 2024, Su et al., 2012, Thiemann, 2023). Across these variants, the common objective is to preserve session-theoretic guarantees while relaxing the requirement that all reasoning, implementation, and composition be monolithic.

1. Conceptual scope

The literature treats modularity in session systems as a technical property of how protocol structure is represented and checked, rather than as a single fixed formalism. Standard multiparty session disciplines typically take the global type to describe the whole protocol and well-typedness to be a whole-session property. Modular Sessions arise where that whole-system stance is weakened in a principled way: by typing only a subsystem, by separating integration from message exchange, by allowing grouped roles on one channel, by linking independently created channels, or by hiding linear resources inside a small trusted core (Barbanera et al., 2024, Su et al., 2012, Xi et al., 2016, Wu et al., 2018, Fowler et al., 2021).

Sense of modularity Representative mechanism Representative paper
Partial verification HPM:GH \vdash_P \mathcal{M} : G for selected participants (Barbanera et al., 2024)
Layered specification Integrating sessions over communicating sessions (Su et al., 2012)
Loosely coupled modules Connectors and P\mathcal P-modularisation for mixed choice (Barbanera et al., 19 Aug 2025)
Constructive assembly Dyadic group sessions and linking combinators (Xi et al., 2016)
Runtime interconnection Multiparty linking with residual and three-way linking (Wu et al., 2018)
Encapsulation of linearity Callback interpreters and hidden channels (Thiemann, 2023)
Modular runtime typing Hyper-environments and hypersequents (Fowler et al., 2021)

A recurring misconception is that modularity in session systems always means full separate compilation or algebraic composition of independently verified protocol fragments. Several of the cited systems are explicit that this stronger meaning is not what they provide. Partial typing for asynchronous MPST, for example, still checks the whole session operationally even though the assigned global type may describe only a subsystem. Conversely, the mixed-choice modularisation of Simple Multiparty Sessions does support a genuine decomposition into modules, but only under a restricted connector discipline (Barbanera et al., 2024, Barbanera et al., 19 Aug 2025).

2. Partial and layered specifications

A central strand of Modular Sessions replaces whole-protocol typing by partial or layered specification. In asynchronous multiparty sessions, the key judgment is

HPM:GH \vdash_P \mathcal{M} : G

where PP is the set of participants of interest, M\mathcal{M} is a session, GG is a bounded asynchronous global type, and HH is a history used to make the inductive presentation decidable in the presence of regular infinite processes, regular global types, and cycles. The global type is partial: it need not describe the full behavior of the session. Its asynchronous syntax is

G::=pq!{λi.Gi}iIpq?λ.GEnd\begin{array}{rcl} G & ::= & p q ! \{ \lambda_i . G_i \}_{i\in I} \mid p q ? \lambda . G \mid End \end{array}

with explicit separation of send and receive phases, which is essential because queues are explicit at both process and type level. The resulting guarantees are correspondingly partial: typability yields PP-lock-freedom and PP-orphan-message-freedom, not whole-session lock-freedom or orphan-message-freedom. The queue discipline is captured by P\mathcal P0-soundness, defined in terms of the finite weight of queued messages whose sender and receiver both lie in P\mathcal P1 (Barbanera et al., 2024).

A second strand separates communication from integration. The two-level session theory of session communication and integration introduces a general session syntax

P\mathcal P2

and then stratifies it into communicating sessions P\mathcal P3, which exclude establishment, and integrating sessions P\mathcal P4, which exclude direct communication and use only restricted establishment P\mathcal P5. In this setting, concatenation P\mathcal P6, union P\mathcal P7, product P\mathcal P8, and nesting through establishment model scenario integration rather than ordinary process parallelism. The operational rule

P\mathcal P9

makes establishment the point where an integrating specification activates a communicating one. This yields a formal account of protocol modularisation in which scenario composition is distinct from the parallel composition of program components (Su et al., 2012).

A third specification-level approach handles mixed choice by localising it inside modules. In “Modular Multiparty Sessions with Mixed Choice”, sessions are partitioned into loosely coupled modules; cross-module communication is restricted to connectors, and the typing rule does not choose one arbitrary enabled action but a HPM:GH \vdash_P \mathcal{M} : G0-coherent set of labels witnessed by a module. The core rule is

HPM:GH \vdash_P \mathcal{M} : G1

and the point of coherence is that the front of enabled interactions is selected modulewise rather than participantwise. This restores Subject Reduction, Session Fidelity, and Lock Freedom for typable mixed-choice systems while preserving the expressive value of mixed choice inside each module (Barbanera et al., 19 Aug 2025).

These three lines of work show different answers to the same question: what may be omitted from the type without losing useful guarantees? Partial typing omits behavior outside the participant subset; two-level integration omits communication detail at the upper level; modular mixed-choice typing omits global participant-level sequentialisation and replaces it with module-level coherence.

3. Constructive assembly and runtime linking

Another major meaning of Modular Sessions is that multiparty behavior can be assembled from smaller typed components rather than specified monolithically. A foundational example is the theory of linearly typed dyadic group sessions. Instead of assigning each endpoint a single role, the channel type is indexed by a group of roles: HPM:GH \vdash_P \mathcal{M} : G2 where HPM:GH \vdash_P \mathcal{M} : G3 is a finite role set and HPM:GH \vdash_P \mathcal{M} : G4 is a session. A message constructor

HPM:GH \vdash_P \mathcal{M} : G5

is interpreted relative to HPM:GH \vdash_P \mathcal{M} : G6: it is internal if HPM:GH \vdash_P \mathcal{M} : G7, a send if HPM:GH \vdash_P \mathcal{M} : G8 and HPM:GH \vdash_P \mathcal{M} : G9, a receive if PP0 and PP1, and external otherwise. This role-group semantics supports generic linking operators. Theorem 4.1 gives

PP2

Theorem 4.2 gives

PP3

and Corollary 4.3 derives

PP4

The explicit thesis is that dyadic g-sessions are a fundamental building block for multiparty sessions: multiparty structure is obtained by typed forwarding and role-group algebra rather than by starting from a monolithic multiparty object (Xi et al., 2016).

A related but operationally distinct strand studies linking as runtime composition of already created multiparty channels. In the shared-memory implementation of linking for multiparty sessions, each channel is represented as a blackboard supporting atomic writes, atomic selective reads, unbounded capacity, and message-order preservation. Endpoints have the shape

PP5

and linking is implemented with distinguished [KEEP](https://www.emergentmind.com/topics/keep) and KILL messages. One board is chosen as the keep board, the other as the kill board; writes follow KILL, reads may consult both boards, and a crucial invariant is that KILL should be the last message in a board. This yields two specifically multiparty constructions. The first is two-way linking with residual, in which the linker may remain a participant with the intersection of role sets; the canonical example computes

PP6

The second is three-way linking, which can connect three session fragments simultaneously and is also derivable from successive two-way linkings with residual. The logical justification is given in terms of classical linear multirole logic and multiparty cut, so linking is not merely an implementation detail but the runtime form of modular composition (Wu et al., 2018).

Constructive assembly also appears at the specification level in two-level integration. The running example

PP7

builds a complete business protocol from an Auction session, alternative transaction sessions, and a nested EPay session, thereby illustrating that modularity may be expressed either through typed connectors and links or through explicit scenario integration operators (Su et al., 2012).

4. Objects, callbacks, hyper-environments, and toolchains

A further notion of Modular Sessions concerns where the protocol discipline lives in an implementation. In object-oriented session systems, modularity is obtained by attaching a session type to a class definition and allowing the implementation of that class session to be partitioned into separately callable methods. The class session type

PP8

describes legal method-call sequences on instances, while internal checking relates field typings PP9 to external session states M\mathcal{M}0 through the consistency relation M\mathcal{M}1. Session-typed channels are treated as objects by translating channel session constructors into send and receive methods; access points likewise become objects with request and accept. This lets a channel be stored in a field and used across methods, so protocol implementation can be modularised at method granularity rather than forced into a single method body (Gay et al., 2012).

In embedded functional implementations, the modularity move is different: linear channels are removed from the public API. “Intrinsically Typed Sessions With Callbacks” replaces direct channel primitives with a session-indexed command datatype, GG3 interpreted by a small trusted core GG4 that owns the channel and invokes callbacks. The application never receives a first-class channel value, so it cannot duplicate it, discard it, or reuse it after type change. The paper extends this inversion-of-control design to branching, recursion, multichannel and higher-order session, and context-free sessions. In the multichannel section, the MSession construction, together with connect, CheckDual0, and Causality, yields an embedded implementation that guarantees deadlock freedom by construction (Thiemann, 2023).

At the level of core calculi, HGV addresses a different modularity failure: the non-preservation of typing under structural congruence in GV. HGV introduces hyper-environments,

M\mathcal{M}2

and types configurations with judgments of the form

M\mathcal{M}3

The rule

M\mathcal{M}4

records concurrency as explicit separation, while

M\mathcal{M}5

reconnects separated components. The result is a modular and extensible core calculus in which structural congruence is type preserving and which admits an operational correspondence with HCP (Fowler et al., 2021).

Implementation modularity also appears in tooling. “A Modular Toolkit for Distributed Interactions” organizes protocol analysis into two streams: global protocol design and analysis, and participant implementation analysis. The architecture supports parsing, one-time unfolding, linearity checking, well-assertedness checking, projection, endpoint typing, refinement against projected roles, and code generation. The paper is explicit that its modularity is primarily that of tool architecture and analysis pipeline, not a new modular session formalism; nevertheless, it operationalizes a global-to-local workflow central to many session-based methodologies (Lange et al., 2011).

5. Safety theorems and semantic invariants

Across the literature, Modular Sessions are justified by familiar session properties, but the properties are parameterised or reformulated to match the chosen notion of modularity. In partial typing for asynchronous multiparty sessions, the main results are Session Fidelity, Subject Reduction, Partial Lock-freedom, and Partial Orphan-message-freedom. Subject Reduction is explicitly modular: M\mathcal{M}6 then reductions tracked by players of M\mathcal{M}7 advance the type, while untracked external reductions preserve typing with the same M\mathcal{M}8. This is the formal mechanism that permits hidden behavior of participants outside the represented subsystem (Barbanera et al., 2024).

For mixed-choice modules, the metatheory has the standard MPST shape but with module-level coherence in place of whole-system participant sequentialisation. The main guarantees are Subject Reduction, Session Fidelity, and Lock Freedom for typable sessions. Coherence preservation under unrelated reductions is the critical lemma: an unrelated communication cannot destroy the coherent communication front of a module, because connector restrictions prevent uncontrolled interference across module boundaries (Barbanera et al., 19 Aug 2025).

For dyadic group sessions, the core guarantees are type preservation and global progress in the multi-threaded lambda-calculus with linear types. The progress theorem is supported by the DF-reducibility invariant on collections of channel sets, which rules out deadlocked blocked configurations. These metatheoretic results are what allow dyadic link combinators such as chan2_link, chan3_link, and chan2_link_create to function as safe building blocks for larger multiparty structures (Xi et al., 2016).

For object-oriented modular sessions, static typing guarantees that both sequences of messages on channels and sequences of method calls on objects conform to type-theoretic specifications, thereby ensuring type-safety. The paper proves subject reduction, no communication errors for the distributed fragment, and a conformance theorem relating executions to class session types and translated channel protocols. The consistency relation M\mathcal{M}9 is the central invariant connecting internal field state to external protocol state (Gay et al., 2012).

For callback-based embeddings, the guarantees are split between untrusted client code and a trusted library kernel. Application programs are intrinsically session typed because only protocol-shaped Cmd values can be constructed. In the multichannel extension, the paper states that the construction guarantees deadlock freedom by construction; the channel collection is tracked by MSession, while CheckDual0 and Causality constrain composition so that arbitrary cyclic waiting dependencies cannot arise (Thiemann, 2023).

For HGV, the principal results are type preservation under both structural congruence and reduction, deadlock freedom/global progress for ground configurations, confluence, and strong normalization. The use of hyper-environments is essential here: it makes structural congruence type preserving and exposes the tree structure of communication topologies through abstract process structures and tree canonical forms (Fowler et al., 2021).

Taken together, these theorems show that modularity does not remove the need for session invariants; it reindexes them. Lock-freedom may become GG0-lock-freedom, coherence may become module-relative, progress may depend on tree or forest structure, and protocol conformance may be expressed via class sessions, command indices, or projected roles.

6. Trade-offs, misconceptions, and open directions

The modularity provided by these systems is precise but limited. Partial typing for asynchronous MPST does not deliver full compositional verification of separately typed components: the full session still appears in the typing judgment, all active participants in GG1 must be represented in the type, cycles must preserve queue invariants, the global type must be bounded, and the setting excludes delegation, session interleaving, and self-messages. The paper is explicit that its contribution is modular reasoning about subsystems inside a larger session, not separate compilation or full protocol decomposition (Barbanera et al., 2024).

The modularisation of mixed-choice sessions is likewise conditional. Cross-module interaction is restricted to connector-to-connector communication, and typability presupposes GG2-modularisability. The coarsest modularisation remains legal, but then the inferred global type may degenerate into a complete interaction tree that is less manageable. The approach is therefore conservative: without mixed choice it collapses to standard SMPS typing (Barbanera et al., 19 Aug 2025).

In object-oriented modular sessions, the gain is method-level partitioning of a protocol implementation, but the distributed metatheory stops at communication safety and conformance; it does not provide a global deadlock-freedom theorem. Recursive helper methods require explicit req/ens annotations, and the discipline relies on linear treatment of session-typed or non-uniform objects to avoid aliasing (Gay et al., 2012).

In callback-based embeddings, the proof burden is concentrated rather than removed. The trusted component is small, but exec and the raw channel layer still require verification. The Agda development uses a Gas parameter for the recursive interpreter, and the context-free command interface is more sophisticated than the monadic callback interface available for simpler regular sessions (Thiemann, 2023).

In two-level integration, the formal development assumes well-formed and race-free sessions. The process-slicing technique helps identify violated sessions during type checking, but the paper proves that slicing is only a debugging aid: correspondence between slices and projections does not imply typability (Su et al., 2012).

In tool-oriented work, modularity of the workbench does not by itself amount to a modular session calculus. The toolkit paper is candid about current limitations: assertions are practically restricted by the Presburger API, Cooper’s decision procedure is super-exponential in formula size, generated code is proof-of-concept Haskell over Chan, and runtime monitors for assertions were planned rather than implemented (Lange et al., 2011).

These trade-offs show that “Modular Sessions” is best read as an agenda rather than a single design. The common lesson is that modularity can be obtained by weakening the scope of specifications and guarantees, by layering specification languages, by constraining interfaces between modules, by building larger protocols from typed links, or by moving linearity and protocol evolution into a smaller trusted substrate. This suggests that the main axis of variation in the field is not whether modularity is present, but where the boundary is drawn between the part of the system that is specified exactly and the part that is abstracted, hidden, or reconstructed by the type discipline.

Topic to Video (Beta)

No one has generated a video about this topic yet.

Whiteboard

No one has generated a whiteboard explanation for this topic yet.

Follow Topic

Get notified by email when new papers are published related to Modular Sessions.