Home / Docs / Specification / 27. Tasks and time

27.11 The timing label of concurrent work

Release v0.4.0

Normative for τ_conc of a within (§5 rule 8), of a first of (§6 rule 8), of a for ever within (spec/26 §7 rule 5), of the tick of a driven step (conc(step), spec/26 §2 rule 5), of the constructs that L_res counts (spec/26 §7 rule 5, item 6) and of the requests that L_lim counts (§9 rule 5), as ADR 0116 states it in its amendment of 2026-10-25 (P0 to P5). The other timing sites, the statement a limiter scopes over (§10) and L_srv (spec/31 §1), keep the preview's τ_conc until this section names them: ⊤ for a site inside a lambda, a task, the block of a tasks statement or a handler's operation, in a function that a part of a task construct can reach, or, in a package with a task construct, in a function that a function value, a lambda or a handler's operation can run, whether or not a part reaches it; public otherwise.

  1. The whole program (P0). The analysis sees every function whose code can run in the process: the package, the standard library and the prelude. A function with neither a body nor a summary is a node whose τ⁰ and conc are ⊤.

  2. The graph (P1). It has a node per function, those of the prelude without a body included; one node Λ for every lambda of the package; one node per handler, for all of its operations; and one node K(c) per capability c. Each edge records its call site and the innermost construct of that site (rule 4):

    • a call of a function, or a use of its name as a value, goes from the node whose code holds it to that function; a policy call goes to its via function as well (spec/07 §5);
    • a call of a function value, or of a uses of parameter, goes to Λ; a prelude function with a parameter of function type has an edge to Λ, and Λ has an edge to every function named as a value;
    • an operation goes to K(c), through the operation, and K(c) has an edge to each handler of c; a function has an edge to the operations of its uses, which covers a prelude function without a body; an installation goes to its handler;
    • a call inside a lambda's body leaves from Λ, and one inside a handler's operation from the handler. Code outside every node, such as an example's do line, records its edges too, which raise what they reach (rule 4).

    Every call counts, whether or not an entry reaches it.

  3. Parts and κ (P2). κ here is the label ctx and conc carry; a race's own t counts its branches as §6 rule 8 states. The parts of a task construct C are each branch of together and of first of, the body of together for, and the block of tasks with each start in it. The list of together for and the bound of tasks are not parts. κ(C) is τ⁰ of the whole construct, its list and its bound included: the items of spec/26 §7 rule 5 other than 5 and 6, over the call graph of rule 2, where a part that calls a function value or a prelude function with a function argument has ⊤. A site in a part counts κ(C), the part that holds it included: its own code before the site decides which work of its siblings the site overlaps.

  4. Through calls (P3). The constructs of one node's code form a tree by nesting; a lambda's body starts a tree of its own. ctx of a construct is ctx of its parent joined with its κ, and ctx(s) of a site or an edge is that of its innermost construct, or nothing outside every one. conc(n) of a node is the least label such that conc(n) ≥ conc(m) ⊔ ctx(s) for every edge from m, at the site s, to n, and conc(n) ≥ ctx(s) for every edge from code outside every node (rule 2); the members of a cycle of calls share one conc.

  5. At a site (P4). For a site e in the code of the node n, τ_conc(e) = conc(n) ⊔ ctx(e). A site in no node of the graph, such as one in an example's do line, has τ_conc = ⊤.

  6. What it means (P5). κ(C) rises above a label l only when the work of some part of C can depend on data above l, whatever the number of tasks. A construct whose parts handle only public and internal data gives at most internal, and a program without task constructs has τ_conc = public everywhere. So does a site in a lambda or in a handler's operation that no part of a construct reaches, since nothing runs beside it.

  7. Fail closed. A construct whose seed was not recorded, and a construct id that names no construct, count as ⊤.

  8. Costs (amendment, E). The graph, κ of every construct, ctx and conc are computed once per package, in O(V + E + F) joins over the V nodes, E edges and F constructs, plus κ's reading of each construct's recorded seed; a cycle is one strongly connected component. τ_conc of a site is then O(1) joins.