Internals for Interns

RSS: https://internals-for-interns.com/index.xml
以通俗易懂的方式讲解软件内部原理的博客合集。

Yzma:用 Go 直接调用 llama.cpp 推理引擎的内部实现

在上一篇文章 我们研究了推理的实际情况是——模型如何逐个标记输入提示并构建响应。我提到了两个可以让你本地运行这个循环的Go项目:伊兹玛,使得 Go 称llama.cpp 推理引擎直接,以及克朗克,它会在其上构建一个友好的 SDK。今天我们打开yzma,看看整个过程是如何组合起来的。
评论点赞收藏6 天前

Fake Clocks, Real Guarantees: Inside Go's synctest

The first time I reached for testing/synctest, I assumed it was a sleep helper with better manners. The public API is small enough to support that assumption: synctest.Test(t, func(t *testing.T) {... ...
评论点赞收藏13 天前

区块层

在 上一篇文章 中,我们从 read 开始,一路向下遍历 VFS:从系统调用开始,经过 struct file,再到 ext4,最终进入页高速缓存。而就在那一刻,我们恰好跳过了许多细节。当页高速缓存发生未命中——即这些字节尚未加载到内存中——文件系统不得不真正去从磁盘上读取它们,而我们当时只是简单地说道:“它会通过块层来读取磁盘。”接下来,我们就将深入探讨这一时刻。
评论点赞收藏20 天前

什么是推理?

介绍在 Go 语言中本地运行大语言模型的技术路径。重点提及 Yzma 项目允许 Go 直接调用 llama.cpp 库(无需 cgo),以及基于其构建的高层 SDK Kronk。旨在向开发者普及本地推理概念及 Go 生态下的实现方案。
评论点赞收藏27 天前

深入 Linux 内核:虚拟文件系统 (VFS) 原理

Linux内核系列续篇,从调度器深入文件系统层。解析程序打开文件时的内核路径:VFS如何统一不同文件系统接口,以及底层驱动交互机制。适合想补齐操作系统底层知识的开发者。
评论点赞收藏34 天前

Go 运行时深度解析:Profiling 机制揭秘

深入解析 Go 运行时五种 Profile(CPU、Heap、Block、Mutex、Goroutine)的底层采集机制与数据格式。文章揭示了它们共享同一 pprof 协议骨架,但采集模型截然不同:CPU 基于信号中断与无锁环形缓冲区流式处理;Heap/Block/Mutex 在分配器或锁内部原地聚合采样;Goroutine 则是全量快照。详细拆解了采样率随机化、延迟计数(GC 配合)、时长加权采样及缩放估算等关键工程细节。
评论点赞收藏39 天前

真实Go存储引擎中的MMAP与pread之争

以VictoriaLogs为例,深入剖析Go存储引擎中mmap与pread的性能权衡。指出mmap虽能减少系统调用开销,但冷数据引发的Major Page Fault会导致Go线程阻塞且无法被Runtime调度器感知,从而引发整体停顿。文章展示了结合mincore检查页面驻留状态的双路径读取实现,为高性能Go数据库开发提供了极具价值的底层优化思路。
评论点赞收藏39 天前

理解 Linux 内核:调度器

深入解析Linux 7.1内核调度器机制。澄清进程与线程在底层均为task_struct,详解EEVDF算法如何通过虚拟运行时间(vruntime)实现公平性与低延迟平衡。剖析上下文切换的缓存冷启动成本及抢占触发逻辑,适合希望理解操作系统核心原理的开发者。
评论点赞收藏49 天前

Understanding the Go Runtime: The Reflect Package

In the previous article we watched the runtime rebuild an entire stack trace out of metadata the compiler and linker had frozen into the binary at build time. I told you at the end that reflect works ...
评论点赞收藏56 天前

Memory Manager

In the previous article we looked at how a user program crosses the ring 3 → ring 0 boundary to ask the kernel for help. The example we used was read — a file descriptor, a buffer pointer, a byte cou...
评论点赞收藏69 天前

Stacktraces

In the previous article we took apart the select statement and saw how it’s really two features in one, with the compiler rewriting the easy shapes away and only the hard cases falling through to the...
评论点赞收藏76 天前

System Calls

In the previous article we followed the kernel from the very first instruction the bootloader handed us all the way to the moment kernel_init called execve on /sbin/init. That was a long ride, but it...
评论点赞收藏83 天前

ZFS

In the previous article, we explored Btrfs—a copy-on-write filesystem built around a single kind of B-tree, where every file, extent, checksum and chunk mapping lives as a tagged item in some tree, an...
评论点赞收藏111 天前

Understanding the Go Runtime: The Network Poller

In the previous article we saw how sysmon steps in every 10ms to call netpoll(0) on behalf of busy Ps, making sure network I/O doesn’t stall when the scheduler is too busy to poll on its own. We gloss...
评论点赞收藏118 天前

Filesystems: Btrfs

In the previous article, we explored XFS—a filesystem built for extreme scale that divides the disk into independent Allocation Groups, each with its own B+ trees for free space, inodes, and extent tr...
评论点赞收藏124 天前

Understanding the Go Runtime: The System Monitor

In the previous articles we explored the scheduler — how goroutines get multiplexed onto OS threads through the GMP model — and the garbage collector — how Go tracks and reclaims memory using a concur...
评论点赞收藏129 天前

XFS

In the previous article, we explored NTFS—a filesystem where everything is a file, from your documents to the Master File Table itself. NTFS centralized all metadata into the MFT, using attribute-base...
评论点赞收藏139 天前

Understanding the Go Runtime: The Garbage Collector

In the previous article we explored the Go scheduler — how goroutines get multiplexed onto OS threads, the GMP model, and all the tricks the runtime uses to keep your cores busy. But there’s a fundame...
评论点赞收藏145 天前

NTFS

In the previous article, we explored ext4—a filesystem that divides the disk into block groups and separates metadata from data, with inodes in one place and file content in another. NTFS takes a rad...
评论点赞收藏153 天前

登录芦苇

登录后关注作者、收藏内容和参与讨论。