Docs / Architecture
12. Minimal Runtime Architecture
Dryad's runtime implements in C++ a minimal set of approximately 50 primitive syscalls (intrinsics), enabling the Standard Library to be almost 100% written in pure Dryad, facilitating self-hosting and broad debugging. All raw intrinsic calls are wrapped in safe Dryad functions that validate inputs and manage cleanup — raw intrinsics may only be used within the standard library's boundary layer. The runtime includes a native Buffer type with bounds-checked access, zero-copy I/O operations, and a Hardware Abstraction Layer (HAL) that isolates platform-specific syscall differences behind a uniform interface.
| Category | Primitive Syscall | Runtime Description |
|---|---|---|
| File I/O | open, read, write, close, lseek, stat, unlink, mkdir | Access to direct file descriptors of the file system. |
| Networking | socket, connect, bind, listen, accept, send, recv | Multiplexed network configurations. |
| Memory | malloc, free, realloc, memcpy, memset | Internal runtime allocation with reference counting. |
| Async I/O | epoll_create, epoll_wait (Linux), kqueue, kevent (macOS) | OS-level event loop without thread-blocking. |
| Process/Thread | fork, exec, wait, pthread_create, pthread_join | Processor parallelism synchronization. |
1 // Internal runtime native syscall declaration 2 @intrinsic("syscall.open") 3 extern function __open(path: string, flags: i32): i32; 4 5 @intrinsic("syscall.read") 6 extern function __read(fd: i32, buf: ptr8>, len: usize): isize; 7 8 @intrinsic("syscall.close") 9 extern function __close(fd: i32): void; 10 11 // Abstract handler class in pure Dryad 12 export class Arquivo { 13 private fd: number; 14 15 constructor(caminho: string) { 16 this.fd = __open(caminho, 0); // O_RDONLY 17 if (this.fd < 0) { 18 throw "Failed to read native file!"; 19 } 20 } 21 }
The entire socket library, virtual file system, HTTP client, and JSON parser are built in pure Dryad consuming these intrinsic primitives.
Found an error in the spec? Open a PR.
Official Version: 1.0 · May 2026