-
Notifications
You must be signed in to change notification settings - Fork 0
Blueprint 01 Hardware OS
Dmdv edited this page Jul 11, 2026
·
1 revision
Source:
docs/blueprint/01-hardware-os.mdin the main repository.
Low-latency C++ is hardware-sympathetic. Jitter from the OS often dominates algorithmic improvements.
| Topic | Why it matters | In this repo |
|---|---|---|
| CPU isolation | Stops scheduler from migrating/preempting hot threads | Documented boot args |
| Thread pinning | Cache warmth + stable TSC domain |
ll::pin_current_thread_to_cpu (Linux) |
| NUMA | Cross-socket memory is a silent multi-µs tax |
numactl notes |
| Power states | C-state wakeups add µs–ms | BIOS + governor notes |
| Hugepages | Fewer TLB misses on large rings/arenas | Operator notes |
| hwloc | Portable topology (cores, caches, NUMA) |
OPTIONAL — [industry][hwloc]
|
| libnuma | Bind allocations to local socket | Linux soft-detect / DOC |
Industry install: brew install hwloc · full map: 07-industry-libraries.md.
# /etc/default/grub (example — validate for your distro)
GRUB_CMDLINE_LINUX_DEFAULT="... isolcpus=2,3 nohz_full=2,3 rcu_nocbs=2,3"
# Run app memory-local to node 0, CPUs reserved
numactl --cpunodebind=0 --membind=0 ./systems_app#include "ll/affinity.hpp"
ll::pin_current_thread_to_cpu(2); // Linux onlyApple platforms do not expose Linux-style isolcpus. This stack uses:
ll::set_current_thread_interactive_qos(); // QOS_CLASS_USER_INTERACTIVEExpect more tail noise on laptops than on isolated Linux servers — design measurements accordingly.
- BIOS: disable deep C-states for latency labs when possible.
- OS:
performancegovernor (cpupower frequency-set -g performance). - Turbo can help mean throughput but increase jitter — know your goal.
echo 1024 | sudo tee /sys/kernel/mm/hugepages/hugepages-2048kB/nr_hugepagesUse hugepage-backed arenas for multi-GB order books or capture buffers (future ll backend).
#include "ll/affinity.hpp"
const char* backend = ll::affinity_backend();
bool pinned = ll::pin_current_thread_to_cpu(/*cpu=*/2);
bool qos = ll::set_current_thread_interactive_qos();
// ll::kLinuxIsolationNotes — printable operator cheat sheet-
tests/test_ll_modules.cpptag[ll][affinity]
Wiki mirror of repository docs. Edit docs/ in the main repo, then python3 scripts/publish_wiki.py.