AutolangDocs
Execution Model

Single-Threaded Execution

Autolang operates under a strict single-threaded execution model. There is no multi-threading overhead, no thread context-switching, and no locking mechanisms in the core interpreter.

Thread Blocking & Waiting (Synchronous IO)

To keep script logic clear and prevent memory concurrency issues, Autolang does not expose keywords like async or await. All external activities (like HTTP requests or File IO operations) block the VM thread until completion.

Synchronous Blocking

When calling Http.get(...), the compiler halts VM evaluation entirely. The underlying C++ thread waits for the network payload before stepping to the next bytecode line.

Clean Script Logic

Script authors write sequential code without promises or callbacks. Concurrency complexity is pushed down to the native host implementation rather than leaking into Autolang scripts.

@import("std/http") // This call blocks VM execution completely. // No "await" needed. The next line runs ONLY when HTTP succeeds. val response = Http.get("jsonplaceholder.typicode.com", 5000) println(response)

Embedded Hardware & Lock-Free Performance

Operating on a single core allows the VM to skip locking overheads and register-saves that degrade performance on thin embedded devices.

01

No Mutex or Semaphores

Global memory tables, class allocations, and object heaps do not require synchronization guards. Program instructions execute consecutively at maximum CPU throughput.

02

Optimal L1/L2 Cache Locality

Multi-threaded environments constantly invalidate CPU cache lines. Single-thread processing preserves instruction data sequentially inside the L1/L2 hardware caches.

💡

Embedded Strategy

On thin chips (Cortex-M microcontrollers), time-sliced multi-threading wastes cycles just saving CPU contexts. Autolang VM directly claims execution, maximizing efficiency on single-core devices.

Safety & Developer Experience

Writing scripts in Autolang means you never deal with data corruption, deadlocks, or thread race conditions.

// Variables are updated sequentially. // Mutex synchronization structures do not exist. var counter = 0 fun update() { counter = counter + 1 } update() update() println("Counter: " + counter.toString()) // Guaranteed to output 2