Register, scan and block without losing a wakeup

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.

Register, scan and block without losing a wakeup Acquire scheduler guard then stream lock, register wait items and scan current stream, timer, child and TCP levels. Ready items, poll mode or deadline expiry return a count; a relevant signal interrupts. Otherwise mark blocked under the guard, release before scheduling, then reacquire and rescan after a publisher wakes the task. Local console input is deliberately excluded from nonblocking readiness. register->scan scan->ready ready->signal no ready->result yes signal->block no signal->interrupted yes block->publish stream / TCP / tick / child event publish->wake wake->scan resume + reacquire register Acquire scheduler guard → stream lock register items + deadline scan Scan stream / timer / child / TCP levels ready Ready / poll / deadline reached? signal Unmasked signal other than SIGCHLD? block Mark task BLOCKED under same guard release locks → schedule publish Publisher changes state scan waiters under matching guard wake Ready / expired → unblock task result Copy revents → clear registration release locks → return ready count interrupted Clear registration return INTERRUPTED
Register, scan and block without losing a wakeup Acquire scheduler guard then stream lock, register wait items and scan current stream, timer, child and TCP levels. Ready items, poll mode or deadline expiry return a count; a relevant signal interrupts. Otherwise mark blocked under the guard, release before scheduling, then reacquire and rescan after a publisher wakes the task. Local console input is deliberately excluded from nonblocking readiness. register->scan scan->ready ready->signal no ready:e->result:e yes signal->block no signal:e->interrupted:e yes block->publish stream / TCP / tick / child event publish->wake wake:e->scan:e resume + reacquire register Scheduler guard → stream lock register items + deadline scan Scan stream / timer / child / TCP ready Ready / poll / deadline? signal Unmasked signal other than SIGCHLD? block Mark BLOCKED under same guard release locks → schedule publish Publisher changes state scan waiters under matching guard wake Ready / expired → unblock result Copy revents; clear registration release locks; return ready count interrupted Clear registration return INTERRUPTED

Wait registration and the blocked transition use the same guard as publishers.

Text equivalent and source references
  • Acquire scheduler guard then stream lock, register wait items and scan current stream, timer, child and TCP levels.
  • Ready items, poll mode or deadline expiry return a count; a relevant signal interrupts. Otherwise mark blocked under the guard, release before scheduling, then reacquire and rescan after a publisher wakes the task. Local console input is deliberately excluded from nonblocking readiness.

Concurrency flow. Source paths refer to the atlas baseline; the kernel checkout is private.

  • kernel/core/user_io.c · io_acquire, user_wait_many, readiness, wake_waiters
  • kernel/net/tcp.c · tcp_user_ready