Performance design and measurement¶
Reduce synchronous work at protection boundaries¶
Use IPC for control, capability-controlled shared memory for data, and batching for throughput. When porting a monolithic subsystem, restructure fine-grained call chains across servers around buffer ownership and asynchronous completion. Measure synchronous calls, copies, and wakeups per operation. Preserve filesystem, VM, network, and driver placement in userspace.
Investigate register-based short messages, combined call and reply-and-wait, and direct thread handoff where scheduling allows. Preserve rights checks, reply ownership, revocation, cancellation, accounting, and slow-path semantics. Aim for constant-time common capability lookup and kernel-free uncontended userspace locks. Compare same-core and cross-core paths. Evaluate per-CPU state, notification batching, client/server affinity, and cross-core queues on SMP. Measure timer programming, fences, and TLB flushes before reducing them. Use tagged address spaces and targeted invalidation where the architecture, coherence rules, and measurements support them.
On the optimized native path, target at most one synchronous service
round trip for a cached read after open(), and no mandatory
synchronous IPC per network packet. See Filesystems, block storage, and networking for the
delegation and buffer contracts that make these paths possible.
Research baselines¶
L4Linux’s 1997 AIM peak throughput was about 5% below native Linux with a single Linux server. Use it as a baseline for its configuration. System measures its separate VFS, VM, filesystem, network, and driver domains end to end. SawMill’s cached reread comparisons and LionsOS’s selected networking experiments show how specific multiserver paths can be optimized. Each result depends on the workload and design.
SkyBridge-style hardware-assisted address-space switching can be studied after measurements identify a bottleneck. Any backend must preserve capability checks, isolation, accounting, and a portable path. UnderBridge is a research reference for a different service placement model and is outside System’s userspace service baseline.
The optional kernel timing workload allocates counters for the boot CPU inventory. A sample belongs to the CPU that records it. The SMP balancing benchmark starts a burst on CPU 0 and migrates ready work to the highest online secondary CPU. Compare queue dwell across the per-CPU rows and burst completion on CPU 0.
Targets and comparison method¶
For same-core cross-address-space short IPC, target at most twice comparable seL4 latency initially and within 20% after optimization. Benchmark short call/reply, capability lookup, scheduler handoff, fault/reply, and TLB behavior. Compare equivalent message lengths, core placement, scheduling context, and mitigations on the same hardware where available. Use QEMU for functional regression and physical hardware for cycle counts and end-to-end performance.
The RISC-V native measurement includes protected user IPC and a cross-address-space map/unmap cycle. The supervisor holds mapping and frame capabilities and runs 128 cycles against a dedicated address space. Each sample includes both native syscall boundaries, capability checks, mapping bookkeeping, and any required TLB invalidation. Task and frame allocation occur outside the timed loop.
xmake run system bench on RV64 also compares fixed placement and
ready redistribution using the same timeshare policy. Each run alternates
which case starts first and submits 16 bursts of eight equal kernel jobs
to each case. The fixed case runs on the boot hart. The redistribution
case submits transfers through the same source request and destination
arrival paths as resident balancing before both queues dispatch. The
report includes submission-to-dispatch p50 and p99, burst completion
time including migration work, and the number of jobs that ran on the
destination. These virtual measurements show the cost distribution for
the fixture. Physical runs and native application measurements are
needed for workload performance claims.
xmake test native-login-disk/resident-balance checks the live UEFI
dispatcher with two fresh copies of the same native image. Both guests
use EEVDF and run two compute workers pinned to separate CPUs to verify
that dispatch remains concurrent. A second fixture creates four workers
pinned to CPU 0 and then lets them widen their own affinity. The test checks that
at least one worker migrates in the default boot and that all four stay
on CPU 0 with system.no-smp-balance. It reports guest monotonic
elapsed time for each run without a timing threshold.
In a traced native SMP session, user_slice records the application
task and its executed ticks in the ring of the CPU that ran the slice.
Timer samples from secondary slices carry their user PCs in that same
ring. Boot-CPU PMU measurements come from that CPU’s samples.
Use thread_migrate to count kernel-stack transfers
and user_slice to measure secondary application execution.
For automatic transfers, use sched_migration and count each known
boundary bit separately. Keep unknown topology in its own total.
sched_doorbell counts scheduler wake requests by sending and
destination CPU. Check the ring’s loss count before comparing totals.
See Crash dumps and observability for the record fields.
The same command compares two blocking server workers and two workers running request continuations on the native 1:1 thread runtime. Each case processes identical bursts of eight requests. Two requests wait for a fixed completion time. The remaining requests can finish as soon as a worker is available. The report includes overall throughput and p50 and p99 for the requests that have no external wait.
Aim for native application performance within 5–10% of a comparable Linux or FreeBSD configuration, with workload-specific targets.
Workload |
Engineering target |
|---|---|
CPU-bound computation |
Within 2–3% of the baseline. |
Sequential storage and bulk TCP |
At least 90% of baseline throughput. |
Representative kernel build |
Within 10–15% of the baseline. |
Native isolated zone |
0–2% overhead relative to the native global zone. |
FreeBSD-branded zone |
0–10% additional overhead as an initial investigation target. |
Linux-branded zone |
0–15% additional overhead as an initial investigation target. |
Windows or Darwin personality |
Measure translation cost per workload. |
Compare equivalent hardware, behavior, compiler flags, security
mitigations, and durability guarantees. Record OS and toolchain revisions,
workload parameters, and repeated-run variation. Measure elapsed time or
throughput, p50 and p99 latency, IPC and context switch counts, CPU
cycles, retired instructions, and cache and TLB misses where counters
are available. Report cached and uncached I/O, metadata-heavy and
fault-heavy workloads, and syscall latency separately. Distinguish
zone namespace and resource costs from ABI translation and extra I/O.
Use sel4bench-inspired tests, lmbench, STREAM, fio, iperf3, PostgreSQL,
and comparable LLVM or kernel builds.
See also