# T10: why the catalog PostgreSQL server uses EXEC_BACKEND

Reading dated 2026-10-13, against browser-substrate
`e329f2937e699cea48a5395ad15b7487571d51cd`. The recipe remains unchanged:
`EXEC_BACKEND` with `SYS_spawn_vm` addresses a current memory mechanism limit.

The choice is explicit in
[programs/postgres/17.9/build.sh:84](https://github.com/volter-ai/browser-substrate/blob/e329f2937e699cea48a5395ad15b7487571d51cd/programs/postgres/17.9/build.sh#L84):
`CPPFLAGS` includes `-DEXEC_BACKEND`. It was introduced by recipe commit
`35dcba65`, rather than selected by PostgreSQL's default configure behavior.
The recipe's `0001-exec-backend-spawn-vm.patch` replaces the Wasm build's
`internal_forkexec` launch with `SYS_spawn_vm`. Each backend therefore starts
as a new, separately based instance in the postmaster's memory, with its own
C globals and the same live shared segment.

[ADR-0132](https://github.com/volter-ai/browser-substrate/blob/e329f2937e699cea48a5395ad15b7487571d51cd/docs/adr/0132-tasks-may-share-one-memory.md#L8)
records the reason. Ordinary fork preserves shared mappings through
ADR-0125's memory group: one guest execution token, with the outgoing and
incoming members' private images copied at each handover. `SYS_spawn_vm`
avoids those handovers for PostgreSQL's concurrent backends.

That behavior remains in the inspected implementation:

- [wali/runtime.ts:2412](https://github.com/volter-ai/browser-substrate/blob/e329f2937e699cea48a5395ad15b7487571d51cd/packages/wali/src/runtime.ts#L2412)
  creates or extends a memory group when fork inherits a live shared range.
- [wali/runtime.ts:2482](https://github.com/volter-ai/browser-substrate/blob/e329f2937e699cea48a5395ad15b7487571d51cd/packages/wali/src/runtime.ts#L2482)
  retains the parent's SysV mapping in the child's group memory.
- [kernel-sysv-shm.ts:313](https://github.com/volter-ai/browser-substrate/blob/e329f2937e699cea48a5395ad15b7487571d51cd/packages/runtime/src/kernel-sysv-shm.ts#L313)
  accounts for the inherited attachment.
- [memory-group.ts:126](https://github.com/volter-ai/browser-substrate/blob/e329f2937e699cea48a5395ad15b7487571d51cd/packages/wali/src/memory-group.ts#L126)
  acquires the single token and restores the member's private image.

Basic fork admission and SysV inheritance are implemented. The current
recipe already lists `wali.SYS_fork` in its Asyncify imports. A fast initial
fork snapshot does not remove the subsequent memory-group handovers.

The ceiling is separate private C memory and live shared regions for
concurrent fork descendants. These Wasm32 programs address one linear memory
with absolute C pointers; separate `WebAssembly.Memory` objects cannot alias
just the shared range. Putting both private images in the same memory would
also require preserving their existing pointer addresses.
[ADR-0125's constraint](https://github.com/volter-ai/browser-substrate/blob/e329f2937e699cea48a5395ad15b7487571d51cd/docs/adr/0125-a-shared-mapping-stays-one-region-across-fork.md#L17)
names that limitation. It could be lifted by a toolchain/runtime that lowers
C pointers across private and shared memories, for example keeping each
process's C heap and stack in its own memory while accessing a separate shared
memory, or by genuine shared-page aliasing between independent memories.
Enabling a multi-memory feature alone would not implement that pointer model.

T10 therefore retains the existing recipe. The postmaster's executable
version self-check and fresh-image launch costs belong to T5's exec path.
This reading makes no new timing, build, query or application claim; no tests
or program executions were run.
