@ai-ecoverse/slicc-kernel 1.134.1 → 1.134.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1096,8 +1096,8 @@ The kernel writes `/etc/passwd` and `/etc/group` when it starts (see [Users](#us
1096
1096
  ### How many processes at once
1097
1097
 
1098
1098
  In a browser every process worker of the page shares one renderer. V8 reserves about 8 GiB of address space for each 32-bit wasm memory, whatever its declared maximum, and its sandbox holds about 1 TiB. So a page runs about 125 wasm processes (or programs that own a wasm memory) at once, counting everything in the renderer (#970). Node has no such ceiling, and neither does Linux. The kernel keeps processes inside that ceiling:
1099
- - **The ceiling:** 112 by default in a browser and none in Node. It's the kernel's count of live wasm processes, with the kernel's other wasm memories in the page left outside it. When an instantiation runs out of memory anyway, the kernel learns the real ceiling at that moment (the live count minus one), and that learned value wins over the default. A learned ceiling is never below 16, since an OOM at a low count means something outside it (another tab in the same renderer) filled the renderer. It's raised by 8 for each minute without another OOM, back to the default.
1100
- - **Admission:** a spawn, fork, exec or `kernel.run` at the ceiling waits for another process to exit. It keeps waiting as long as processes exit or are admitted, and fails with `EAGAIN` only after 10 s with neither. A long `make -j` or `xargs -P` therefore queues, and a pipeline that needs more live processes than the ceiling fails cleanly. bash's own retry on a fork's `EAGAIN` (`fork: retry: Resource temporarily unavailable`) handles the rest.
1099
+ - **The ceiling:** 112 by default in a browser and none in Node (`createNodeKernel({ wasmMemories: { ceiling, idleMs } })` sets one in Node; `idleMs`, the quiet spell before `EAGAIN` below, 10 s by default, is there for tests). It's the kernel's count of live wasm processes, with the kernel's other wasm memories in the page left outside it. When an instantiation runs out of memory anyway, the kernel learns the real ceiling at that moment (the live count minus one), and that learned value wins over the default. A learned ceiling is never below 16, since an OOM at a low count means something outside it (another tab in the same renderer) filled the renderer. It's raised by 8 for each minute without another OOM, back to the default.
1100
+ - **Admission:** a spawn, fork, exec or `kernel.run` at the ceiling waits for another process to exit. It keeps waiting as long as processes exit, are admitted or finish starting (a process becoming ready counts, so a slow host that is still booting the processes ahead of it doesn't fail the spawn, #1196), and fails with `EAGAIN` only after 10 s with none of these. A long `make -j` or `xargs -P` therefore queues, and a pipeline that needs more live processes than the ceiling fails cleanly. bash's own retry on a fork's `EAGAIN` (`fork: retry: Resource temporarily unavailable`) handles the rest.
1101
1101
  - **Close to the ceiling** (within 16 of it), the kernel waits for each new process to finish instantiating before the spawn returns. If it ran out of memory, the kernel starts it again, quietly, once there's room, so the caller sees no failure.
1102
1102
  - **The rare residual case:** a process that fails to instantiate with nobody waiting on it, which happens only when something outside the count fills the renderer. It ends with status 126 and `<program>: cannot allocate memory for a new process (too many processes at once)` on its stderr, never a JS `RangeError`.
1103
1103
  - **Below a learned ceiling,** a process that still runs out of memory is started again once another process exits, and the spawn fails with `EAGAIN` after 10 s with none.
@@ -7101,7 +7101,7 @@ function satisfies(version, range2) {
7101
7101
  }
7102
7102
 
7103
7103
  // src/version.ts
7104
- var KERNEL_VERSION = true ? "1.134.1" : "0.0.0-dev";
7104
+ var KERNEL_VERSION = true ? "1.134.2" : "0.0.0-dev";
7105
7105
  var OS_RELEASE = "6.0.0-slicc";
7106
7106
  function procVersion() {
7107
7107
  return `Linux version ${OS_RELEASE} (slicc-kernel ${KERNEL_VERSION}) #1 SMP PREEMPT_DYNAMIC
@@ -24772,6 +24772,9 @@ var WasmMemories = class {
24772
24772
  const source = this.learned ? "learned" : ceiling === void 0 ? "none" : "default";
24773
24773
  return { live: this.live, ceiling: ceiling ?? 0, source };
24774
24774
  }
24775
+ started() {
24776
+ this.progress();
24777
+ }
24775
24778
  ended() {
24776
24779
  this.live = Math.max(0, this.live - 1);
24777
24780
  this.progress();
@@ -28088,6 +28091,7 @@ var Launcher = class {
28088
28091
  });
28089
28092
  const counted2 = (handle2) => {
28090
28093
  void handle2.exited.finally(() => this.memories.ended());
28094
+ void Promise.resolve(handle2.ready).then(() => this.memories.started());
28091
28095
  return handle2;
28092
28096
  };
28093
28097
  if (!this.memories.near()) {