Tasks and concurrency

← Guest Kotlin support

This page describes the current checkout, including unreleased work. Status and evidence policy applies to every entry.

Transparent suspension across a host request

Status: Supported.

An ordinary Guest call preserves its complete stack and resumes at its verified continuation after an asynchronous capability response.

Evidence: MinimalScriptLoweringTest, test ordinary project call resumes transparently across host blocking, and kotlin_writer.rs, test k2_ordinary_project_call_resumes_across_async_capability.

VM-blocking calls from ordinary functions

Status: Supported.

Designated Guest API calls, task joins, and channel handoffs block only the current stackful VM task. Ordinary callers need no source modifier, including across nested project calls.

Evidence: MinimalScriptLoweringTest, tests ordinary main lowers trusted terminal wait as vm blocking and ordinary project call resumes transparently across host blocking, paired with verify/tests.rs, tests vm_blocking_capability_is_valid_in_a_non_suspending_function, task_yield_is_valid_in_a_non_suspending_function, and task_spawn_accepts_a_non_suspending_target.

Kotlin suspend declarations

Status: Unsupported.

Guest tasks use transparent stackful suspension instead of Kotlin’s coroutine effect and calling convention. The compiler and IDE reject suspend source while the artifact reader, verifier, and VM retain legacy suspend-call support.

Evidence: MinimalScriptLoweringTest, test suspend declarations are rejected because Guest tasks suspend transparently, and DiagnosticQueryTest, test suspend declaration is outside the transparent Guest task model.

Cooperative Guest tasks

Status: Partial.

Tasks.launch(block) starts any supported non-null () -> Unit value as a bounded task, Task.join() waits for it, and Tasks.sleepTicks(n) suspends the current task until a deterministic server-tick boundary without consuming Guest instructions. Tasks share one VM and execute one at a time, but a task suspended on host I/O does not stop another runnable task. Scheduling and host-request ownership are deterministic. Failed-task joins rethrow the original exception on every join; an unjoined child failure does not terminate the process. Failure retention ends with the process. Public cancellation, explicit same-turn yield, wall-clock delay, scopes, and kotlinx.coroutines remain unsupported.

Evidence: MinimalScriptLoweringTest, test task tick sleep lowers to one asynchronous timer request, the testKotlinTimerVmConformance task, and ProgramRuntimeHostTest, test timer requests resume on deterministic server tick boundaries.

Related work: #624

Bounded integer channels

Status: Unsupported.

IntChannel is removed from the Guest platform in Compukters 0.5.0. Its compiler intrinsics and specialized channel lowering are removed as well. Generic channels are deferred to a separate design; the current Guest API exposes no channel type. Cooperative Task / Tasks and their blocking/join semantics remain supported.

Evidence: MinimalScriptLoweringTest, test removed IntChannel is unavailable in the Guest platform, and K2CompilerAdapterTest verify import rejection and absence from the compiled platform declarations. Low-level artifact/VM channel instructions retain their existing tests as internal infrastructure; those instructions do not establish Guest API support.

Related work: #702

Parallel Guest execution

Status: Unsupported.

Within a computer, one Guest task at a time executes instructions. Cooperative tasks provide concurrency at suspension points, not parallel instruction execution.

Related work: not scheduled