Launch I/O references outlive individual handles

This figure documents the historical i386 source baseline. Current native x86-64/AArch64 qualification is recorded separately; this is not an ELF64 or native SMP implementation diagram.

Launch I/O references outlive individual handles Creating a stream starts one reader and one writer reference. Assigning child stdio increments the selected endpoint references. Each close or task cleanup drops its own references. The last writer causes drain-then-EOF, the last reader causes broken pipe, and zero references on both sides clear the stream slot. cluster_launch 1 · Launch cluster_use 2 · Use and close cluster_final 3 · Final references create->assign assign->parent parent->next_use child->exit exit->next_refs peer->reuse create Parent creates stream read ref = 1 · write ref = 1 assign Assign child stdio: add endpoint references parent Parent closes unused ends its references drop next_use Continue at 2 child Child reads / writes via stdio shared reference accounting exit Child close / task exit: cleanup ordinary + stdio refs next_refs Continue at 3 peer Last writer → drain then EOF Last reader → broken pipe reuse Both counts zero: clear slot for reuse
Launch I/O references outlive individual handles Creating a stream starts one reader and one writer reference. Assigning child stdio increments the selected endpoint references. Each close or task cleanup drops its own references. The last writer causes drain-then-EOF, the last reader causes broken pipe, and zero references on both sides clear the stream slot. create->assign assign->parent parent->child child->exit exit->peer peer->reuse create Parent creates stream read ref = 1 · write ref = 1 assign Assign child stdio: add endpoint references parent Parent closes unused endpoints its references drop child Child reads / writes via stdio shared reference accounting exit Child close / task exit: cleanup ordinary + stdio refs peer Last writer → drain then EOF Last reader → broken pipe reuse Both counts zero: clear slot for reuse

Closing the parent copy does not close the child copy; exit cleanup releases both ordinary and stdio handles.

Text equivalent and source references
  • Creating a stream starts one reader and one writer reference. Assigning child stdio increments the selected endpoint references.
  • Each close or task cleanup drops its own references. The last writer causes drain-then-EOF, the last reader causes broken pipe, and zero references on both sides clear the stream slot.

Ownership lifecycle. Source paths refer to the atlas baseline; the kernel checkout is private.

  • kernel/core/user_io.c · user_stream_create, user_io_assign, drop, user_io_cleanup
  • kernel/core/task.c · task_finish