Kernel visual atlas
From the privilege gate to a signed causal epoch: 31 views of the historical x86-32 kernel.
These figures preserve the source snapshot documented below. SlOS now targets native x86-64 and AArch64 with ELF64/LP64 user programs and default native SMP; see current platform qualification. Historical address layouts, ELF32 gates and cooperative AP offload are not native implementation diagrams.
Diagram index
Scope, source baseline and visual key
x86-32 kernel and local Hew consumer; architectural snapshot, not a performance measurement. Source references are private-checkout study paths, not public source links. Kernel a3d7653ade20b8de9529e446201d2fda32ae2a1c; the local Hew runtime comparison uses consumer c1c901f8c9c26fc2e4f864e6b799f9a834f8fa41.
Blue denotes user execution; rust denotes a boundary or rejection; ochre denotes persistent storage; olive denotes causal evidence. Uncolored nodes are ordinary kernel mechanisms. Labels carry the same meaning without color. Arrows name data movement, control transitions or causes; dashed vertical lines in sequence diagrams are participant lifelines.
Flows omit error cases only where stated. Region and block layouts are schematic, not measured area. Lamport values are illustrative. At this snapshot, user execution stays on the BSP and AP offload is opt-in and kernel-task-only. Hew's cooperative process runtime is separate from SlOS kernel actors.
Subsystem chapters · Concept trails · Operating manual · Local Hew runtime
Machine and privilege
Ring 3 · private address spaces
- User shell / C programs
- Local Hew executables Restricted freestanding runtime
Ring 0 · shared kernel trust domain
- Tasks + paging
- Streams + files + TCP
- Kernel actors + mesh
↓ task, I/O and message events
↓ bounded archival
↓ device operations + sector I/O
Private user processes enter a shared kernel; instrumented operations feed the causal record.
Text equivalent and source references
- Ring 3 contains separate user processes, including local Hew programs. INT 0x80 crosses into ring 0.
- Tasks, I/O and kernel actors share kernel privilege. Task, I/O and message events enter the causal DAG; archival writes use SlFS and block I/O.
Layered architecture. Source paths refer to the atlas baseline; the kernel checkout is private.
kernel/core/main.c · kernel_mainkernel/core/syscall.c · syscall_handlerkernel/graph/causal.c · causal_emit
The x86 boot path establishes memory and tasking before publishing system tasks.
Text equivalent and source references
- Multiboot entry reaches kernel_main, then descriptor tables, interrupts, memory, graph state, tasking and filesystems initialize in dependency order.
- SlFS restore is conditional on block-device availability. Network and graph services initialize before SMP discovery and the idle/shell task handoff.
Initialization flow. Source paths refer to the atlas baseline; the kernel checkout is private.
arch/x86/boot.asm · _startkernel/core/main.c · kernel_main
Software buffer validation complements, rather than replaces, hardware page isolation.
Text equivalent and source references
- A syscall buffer must pass the non-null, overflow and user-range checks, then the current task page-table permission walk.
- A failed check returns an error. Direct ring-3 access to supervisor-only or unmapped pages faults in hardware independently of those software checks.
Decision flow. Source paths refer to the atlas baseline; the kernel checkout is private.
include/memory.h · is_user_ptrkernel/core/memory.c · vmm_user_range_okkernel/core/syscall.c · syscall_handler
Exceptions, device IRQs and user syscalls share entry machinery but have different dispatch rules.
Text equivalent and source references
- CPU exceptions use isr_handler; PIC IRQs are remapped to vectors 32–47; the ring-3 syscall entry uses INT 0x80.
- irq_handler acknowledges the controller before calling a device handler. The BSP timer increments ticks, wakes sleepers and schedules when the quantum expires; AP entries skip shared tick work.
Dispatch tree. Source paths refer to the atlas baseline; the kernel checkout is private.
arch/x86/interrupt.asm · ISR / IRQ stubskernel/core/interrupt.c · irq_handler, timer_handlerkernel/core/x86.c · idt_init
Page isolation, encrypted transport and signed evidence establish different, limited claims.
Text equivalent and source references
- User mappings and the syscall gate separate user processes from kernel privilege. Kernel components themselves share ring 0.
- Mesh encryption authenticates channel traffic under exchanged keys. A self-derived SPIFFE-shaped identity and advertised signing key are not external workload certification.
- Signed roots establish cryptographic consistency with a selected key, not the truth of peer claims. Capability checks only enforce operations at actual check sites.
Trust-flow map. Source paths refer to the atlas baseline; the kernel checkout is private.
include/memory.h · user pointer validationinclude/cap.h · cap_requirekernel/graph/mesh.c · compute_spiffe_id, handle_handshakekernel/graph/federation.c · signing-key / epoch-root handling
Memory
The bitmap tracks ownership; the next-free cursor is only a search hint.
Text equivalent and source references
- PMM determines available frames from Multiboot information, marks usable regions free and reserves occupied kernel, bitmap and heap frames.
- Allocation finds a free bit, marks it used and returns a 4 KiB frame; freeing clears ownership and makes the frame reusable. Exhaustion returns failure.
Allocation flow. Source paths refer to the atlas baseline; the kernel checkout is private.
kernel/core/memory.c · pmm_init, pmm_alloc_frame, pmm_free_frame, heap_initinclude/memory.h · PAGE_SIZE
Task A · page directory A
- Private user stack
- User + writable
- Private heap / ELF
- User pages
- Low 128 MiB identity map
- Supervisor only
Task B · page directory B
- Private user stack
- Different frames
- Private heap / ELF
- Different frames
- Low 128 MiB identity map
- Same kernel frames
Scheduler: change CR3 when page directories differ. Shared virtual regions do not imply shared user frames.
Each user task has private user frames and the same supervisor-only kernel identity map.
Text equivalent and source references
- Task A and task B have different page directories and private ELF, stack and heap frames.
- Both directories retain the low 128 MiB supervisor-only identity map. A context switch loads CR3 only when the selected directories differ. Rows show regions, not address-scale measurements.
Aligned comparison. Source paths refer to the atlas baseline; the kernel checkout is private.
kernel/core/memory.c · vmm_init, vmm_create_user_dirkernel/core/task.c · task_create_user, schedule
- CR3 → page directory1024 entries · bits 31…22 select PDE
- PDE → page table1024 entries · bits 21…12 select PTE
- PTE → physical frame4 KiB · frame base + permission flags
- Frame base + offset → physical byteBits 11…0 remain unchanged
The 10 / 10 / 12 split selects a directory entry, a table entry and a byte within a 4 KiB frame.
Text equivalent and source references
- Bits 31–22 index one of 1024 page-directory entries; bits 21–12 index one of 1024 page-table entries.
- The selected PTE identifies a frame and permissions. Its frame base combines with the unchanged low 12 bits to form the physical byte address. This is the x86-32 path.
Bit-field and dataflow. Source paths refer to the atlas baseline; the kernel checkout is private.
include/memory.h · PAGE_DIR_ENTRIES, PAGE_TABLE_ENTRIES, PAGE_FRAME_MASKkernel/core/memory.c · vmm_map_page, vmm_user_range_ok
- Before allocationAddress order →Allocated AFree BAllocated C
- kmallocFirst fit · align + guards · split if usefulANew allocationB remainderC
- kfreeValidate guards · merge adjacent free blocksACoalesced BC
Schematic sizes · no live allocation moves. Interrupt-atomic mutation; SMP adds heap locking.
First fit consumes a suitable free block; freeing merges adjacent free neighbors.
Text equivalent and source references
- kmalloc aligns the request, includes guard space and scans for the first suitable block. A useful remainder stays free.
- kfree validates the block and guards, then coalesces adjacent free neighbors without relocating live allocations. Block widths are schematic, not measured sizes.
Before / during / after. Source paths refer to the atlas baseline; the kernel checkout is private.
kernel/core/memory.c · heap_init, kmalloc, kfree, heap_merge_next
Execution
Default user execution stays on the BSP; opt-in AP offload is restricted to eligible kernel tasks.
Text equivalent and source references
- The BSP chooses among eight priority queues, with starvation and causal-activity adjustments. Runnable tasks return to ready queues after yield or preemption.
- Only READY, non-user, explicitly offloadable kernel tasks are candidates for the configured SMP offload lane. This does not migrate user tasks to APs.
Queue / routing map. Source paths refer to the atlas baseline; the kernel checkout is private.
kernel/core/task.c · schedule, maybe_offload_to_idle_aps, ready_counts_offloadableinclude/task.h · task_set_ap_offloadabledocs/SHOWCASE.md · SMP limits
Task metadata, TSS and CR3 change before the assembly stack exchange.
Text equivalent and source references
- The scheduler selects next, updates its state, quantum and the ring-0 TSS stack, then changes page directories if needed.
- Assembly saves flags and callee-saved registers on the outgoing stack, stores its ESP, loads the incoming ESP, restores registers and returns on that stack. The incoming path releases the scheduler guard.
Low-level control flow. Source paths refer to the atlas baseline; the kernel checkout is private.
kernel/core/task.c · schedulearch/x86/context.asm · context_switch
Exiting is not the same as reclaiming: waitable children remain zombies until collected.
Text equivalent and source references
- READY dispatches to RUNNING; yield or preemption returns it to READY. Sleep, wait and I/O can block; a wake source makes it ready again.
- Stop signals produce STOPPED and SIGCONT restores readiness. Exit produces a waitable ZOMBIE when there is a live parent, otherwise DEAD; wait or orphan cleanup makes zombies dead. Reaping frees resources and the slot.
State machine. Source paths refer to the atlas baseline; the kernel checkout is private.
include/task.h · task_state_tkernel/core/task.c · task_finish, task_wait, task_reap, task_kill
Time runs downward; the saved register frame carries arguments and the result across the gate.
Text equivalent and source references
- The user executes INT 0x80. The x86 entry stub saves registers and calls the kernel syscall handler.
- The handler validates buffers and dispatches the selected operation, writes the result into EAX and returns through the stub. IRET resumes ring-3 code; blocking operations may schedule other tasks before returning.
Sequence diagram. Source paths refer to the atlas baseline; the kernel checkout is private.
arch/x86/interrupt.asm · isr128, isr_common_stubkernel/core/syscall.c · syscall_handlerinclude/syscall.h · syscall ABI
A new user task starts blocked while its private image, arguments and I/O are prepared.
Text equivalent and source references
- Resolve and validate static ELF32 bytes, create a blocked user task, then allocate private PT_LOAD pages, copy file contents and zero the remaining segment memory.
- Set up argc/argv and validated launch I/O before making the task ready. The user trampoline enters ring 3; failed loading rolls back owned pages and the partial task.
Launch / failure flow. Source paths refer to the atlas baseline; the kernel checkout is private.
kernel/core/elf.c · elf_load_args_io, elf_setup_argskernel/core/task.c · task_create_user, task_entry_trampoline_user, task_rollback_user_pages
Streams and process I/O
| Endpoint | Condition | Result |
|---|---|---|
| Read | Bytes present | READ |
| Read | No writers | READ + HUP; drain then EOF |
| Write | Readers + free space | WRITE |
| Write | No readers | HUP + ERROR; broken pipe |
| Either | Empty / full, peer still present | Operation may WOULD_BLOCK |
EOF and broken pipe derive from endpoint reference counts, not a special byte in the stream.
Text equivalent and source references
- A read endpoint is ready when bytes exist or no writers remain. After buffered bytes drain, no writers means EOF; readiness also reports HUP.
- A write endpoint is ready when readers exist and the 4096-byte ring has space. No readers yields HUP plus ERROR and writes report broken pipe. Empty/full streams with a peer present may return WOULD_BLOCK.
State / result matrix. Source paths refer to the atlas baseline; the kernel checkout is private.
kernel/core/user_io.c · stream_t, readiness, user_io_read, user_io_write
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_waiterskernel/net/tcp.c · tcp_user_ready
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_cleanupkernel/core/task.c · task_finish
Filesystem
RAM-first reads and path-directed writes are different policies.
Text equivalent and source references
- Read-open checks the RAM overlay before SlFS. Creates in /tmp route to RAM; ordinary writes and creates outside /tmp route to SlFS.
- Appending a visible RAM file to the persistent route preserves its prefix before promotion. A successful persistent write-open removes the RAM shadow; an unresolved backing file is an error, not a silent durable-to-RAM fallback.
Decision flow. Source paths refer to the atlas baseline; the kernel checkout is private.
include/fs_route.h · slos_route_for_writekernel/core/syscall.c · SYS_OPEN
SlFS v1 · sector order ↓
- Superblock
- Magic, region offsets, size, replacement intent
- Allocation bitmap
- Sector ownership
- Inode table
- 256 inodes · 512 bytes each
- Data region
- File bytes + indirect pointer sectors
One inode · one sector
- Identity
- Type, name, parent inode, flags
- Content
- Size, 12 direct pointers, single + double indirect
- Time
- Creation + modification ticks
The inode table addresses one-sector inodes; their pointers address the data region. Region sizes are schematic, not to scale.
A one-sector inode names its parent and points to file data; region offsets come from the superblock.
Text equivalent and source references
- The superblock identifies the allocation bitmap, inode table and data region, and holds the optional replacement intent in its padding.
- There are 256 one-sector inodes. Each stores identity, parent, type, flags, timestamps, size and direct/indirect block pointers. Sectors are 512 bytes; the drawing is not a disk-capacity scale.
Nested record layout. Source paths refer to the atlas baseline; the kernel checkout is private.
include/blockfs.h · slfs_super, slfs_inodekernel/fs/blockfs.c · blockfs_init
Direct, single-indirect and double-indirect pointers cover successively larger file ranges.
Text equivalent and source references
- Twelve direct pointers address 12 data sectors. One single-indirect sector holds 128 data-sector pointers.
- A double-indirect root points to up to 128 pointer sectors, each with 128 data pointers. The theoretical data maximum is 16,524 sectors, or 8,460,288 bytes, excluding pointer overhead.
Pointer topology. Source paths refer to the atlas baseline; the kernel checkout is private.
include/blockfs.h · SLFS_DIRECT_BLOCKS, SLFS_MAX_FILE_SIZEkernel/fs/blockfs.c · blockfs_read_file_locked
OLD and NEW distinguish which inode version recovery keeps under the ordered-I/O model.
Text equivalent and source references
- Persist an OLD intent with the saved inode pointers, stage a separate new block tree, install the replacement inode, then persist NEW before releasing old blocks and clearing intent.
- On mount, OLD restores saved pointers; NEW keeps the installed inode. Recovery rebuilds the allocation bitmap and clears intent. This is not protection against torn sectors or a device that violates the ordering model.
Transaction / recovery flow. Source paths refer to the atlas baseline; the kernel checkout is private.
include/blockfs.h · slfs_intentkernel/fs/blockfs.c · blockfs_write_file_locked, blockfs_init
Causal history and evidence
Two branches can have ordered Lamport values without an edge between them.
Text equivalent and source references
- A shell command causes an actor send and independent local work. The send causes a receive, which causes an application effect.
- Arrows encode parent relations; illustrative Lamport values increase along them. Events on separate branches need not causally depend on one another. Events retain up to four parents alongside wall-tick and TSC time.
Directed acyclic graph. Source paths refer to the atlas baseline; the kernel checkout is private.
include/causal.h · causal_time_t, causal_event_tkernel/graph/causal.c · causal_emitkernel/graph/actor.c · actor_send, actor_recv
The hot ring, segment journal and restart snapshot have separate retention and lookup roles.
Text equivalent and source references
- Instrumented operations enter the 16,384-event hot ring. cjournal spills compact records into bounded SlFS segments, with up to 512 events per file and 32 segment slots.
- Queries look up resident events or read archived records through the segment index. The separate journal.bin snapshot holds up to 512 restart records. Neither retention tier is unbounded, and emitting an event is not itself a durable disk commit.
Storage / query dataflow. Source paths refer to the atlas baseline; the kernel checkout is private.
include/causal.h · CAUSAL_MAX_EVENTSinclude/cjournal.h · segment limitskernel/graph/cjournal.c · cjournal_query_by_idinclude/causal_persist.h · PERSIST_MAX, PERSIST_PATH
Checksums, canonical event hashes, Merkle roots and signatures protect different layers.
Text equivalent and source references
- A segment contains its header, compact events and a footer with sizes, checksum, prior checksum and flags. Compact events retain a payload digest rather than full payload bytes.
- Versioned BLAKE2s hashes feed a Merkle epoch root; explicit signing adds an Ed25519 signature. Segment writing precedes hash/root sidecars, with removal on sidecar failure. A signature is not automatic or a claim of overall correctness.
Record / dependency map. Source paths refer to the atlas baseline; the kernel checkout is private.
kernel/graph/cjournal.c · write_segment, write_segment_hashes, cjournal_sign_segmentinclude/cjournal.h · cjournal_event_tkernel/graph/causal.c · causal_event_hash_with_payload_hash
Being included in a signed epoch is not the same claim as satisfying a behavioral predicate.
Text equivalent and source references
- Recompute a versioned event-summary hash, verify its Merkle path and verify the root signature against the selected node key. This establishes inclusion in that signed epoch.
- The prove predicates independently scan available events and report PROVED, VIOLATED or INSUFFICIENT_DATA. Neither mechanism establishes complete history, program correctness or externally certified identity; missing evidence limits the claim.
Claim / evidence dependency. Source paths refer to the atlas baseline; the kernel checkout is private.
kernel/graph/cjournal.c · epoch proof and signature verificationinclude/prove.h · proof_result_tkernel/graph/prove.c · predicate evaluators
Network and actors
VirtIO and Ethernet feed protocol-specific paths, not one universal packet handler.
Text equivalent and source references
- VirtIO-net supplies frames. Ethernet dispatches ARP or IPv4; IPv4 dispatches ICMP, UDP or TCP.
- UDP supports DHCP, DNS and mesh discovery. TCP state and fixed buffers feed user PID-owned sockets or kernel mesh transport. Transmit constructs the headers in reverse order. The TCP table has 32 connection slots.
Protocol dispatch tree. Source paths refer to the atlas baseline; the kernel checkout is private.
kernel/drivers/virtio_net.c · receive pathkernel/net/net.c · Ethernet / IPv4 dispatchkernel/net/tcp.c · tcp_handle_packetkernel/core/syscall_net.c · socket dispatchinclude/tcp.h · TCP_MAX_CONNS
Active and passive open converge on ESTABLISHED; each close direction has a different path.
Text equivalent and source references
- An active open reaches SYN_SENT and accepts SYN+ACK; a listener creates a SYN_RECEIVED child and accepts ACK. Both reach ESTABLISHED.
- Local close passes FIN_WAIT_1 and FIN_WAIT_2, while peer-first close passes CLOSE_WAIT and LAST_ACK. Simultaneous close may use CLOSING; TIME_WAIT expires after 200 ticks. Resets, retries and cleanup are omitted; FIN_WAIT_2 also has a bounded timeout.
State machine. Source paths refer to the atlas baseline; the kernel checkout is private.
include/tcp.h · connection state enumkernel/net/tcp.c · tcp_handle_packet, tcp_close, tcp_retransmit_check
Named routes choose a local mailbox or a remote proxy; neither is an unbounded queue.
Text equivalent and source references
- actor_send or a named route chooses a target using local-first or round-robin policy. Local delivery enqueues a message if capacity exists; actor_recv removes it and links its cause.
- The kernel has 64 actor slots, 64 messages per mailbox and a 256-byte message payload maximum. Unknown/full destinations fail; remote proxies use federation. These are not the local Hew runtime mailboxes.
Routing / ring-buffer map. Source paths refer to the atlas baseline; the kernel checkout is private.
include/actor.h · actor_t, actor_msg_t, actor_route_tkernel/graph/actor.c · actor_send, actor_send_by_name, actor_recv
A cooperative Hew actor turn runs inside an OS process; it is not a kernel actor or an AP worker.
Text equivalent and source references
- The local restricted Hew runtime runs cooperative turns and mailboxes in one ring-3 process worker. Its freestanding adapter requests generic kernel operations through INT 0x80.
- SlOS independently preempts that OS task on the BSP and supplies I/O wait/wake. The kernel actor registry is a separate ring-0 object system; no automatic mapping of Hew actors to kernel actors or mesh peers is implied.
Execution-boundary comparison. Source paths refer to the atlas baseline; the kernel checkout is private.
consumer: runtime/hew_slos_actor.c · cooperative actor schedulerconsumer: runtime/current.c · coroutine safepointskernel/core/task.c · scheduleinclude/actor.h · actor_t
A transported message carries enough origin context to connect remote ancestry to local delivery.
Text equivalent and source references
- Node A sends target actor, payload, sender node/actor, remote causal ID, Lamport clock and summary hash through the encrypted mesh.
- Node B decrypts and dispatches, merges the remote clock and anchors the remote cause, then attempts local mailbox enqueue. A later receive links local delivery ancestry. Unknown/full destinations fail; bounded retries and retained proofs are not exactly-once delivery.
Sequence diagram. Source paths refer to the atlas baseline; the kernel checkout is private.
include/federation.h · federation_msg_t, retry limitskernel/graph/federation.c · federation receive loopkernel/graph/actor.c · actor_send_remote, actor_recv
TCP peers age from last-seen time; local inter-core peers bypass network stale checks.
Text equivalent and source references
- UDP announcements on 5100 discover up to eight peers. TCP on 5101 performs the simplified Noise_XX-like handshake before encrypted traffic.
- At 100 Hz, connected peers become stale beyond 6000 ticks and disconnected beyond 12000; refresh can restore a stale peer, and a disconnected peer retries with backoff. Transport failures can disconnect immediately. Local peers use SPSC channels, not TCP/Noise.
Peer state machine. Source paths refer to the atlas baseline; the kernel checkout is private.
include/mesh.h · limits, peer states, transportskernel/graph/mesh.c · mesh_tick, mesh_connect_peer, handle_handshake