About

The pain you feel when you write is actually the pain of clarifying your thinking.(David Perell)

Master Type System

为啥需要 type system? type 就是契约 At the hardware level, the machine does not know types in the way humans or high-level programming languages do. 硬件级别就是电信号了。type 这种概念不存在。 Bits are just bits (0s and 1s), and the CPU/memory has no intrinsic understanding of “integers,” “strings,”

Linux Process State

进程状态机 最近在看南京大学蒋炎岩老师的 2025 操作系统课程。里面有一句话, 计算机中的一切程序可以视为 state machine。很有启发。进程有初始状态, CPU

Asm How Glibc Wrap Syscall

实验平台: x86_64 GNU/Linux mint22.1 使用 glibc 的函数 write1.c #include <unistd.h> int main() { const char msg[] = "Hello, glibc!\n"; write(1, msg, sizeof(msg) - 1); // glibc's write() wrapper return 0; } gcc -o write1 write1.c 使用 ltrace ./write1 查看调用了 write 库函数 不使用 glibc 的函数 write2.c #include <errno.h> #include <syscall.h> #include <unistd.h> ssize_t

Cmd Strace

syscall 操作系统运行在 kernel space, 拥有整个系统的控制权。 应用程序运行在 user space, 拥有部分权限。 这就是隔离。 To prevent user applications from accessing or modifying critical operating system data. 想让操作系统做些事情怎么办?使

Java String Concat in Loop

分析环境 jdk8 分析代码 public class StringConcat { public static void main(String[] args) { String s = "$"; for (int i = 0; i < 10; i++) { s += i; } System.out.println(s); } } main 字节码 public static void main(java.lang.String[]); Code: 0: ldc #2 // String $ 2: astore_1 3: iconst_0 4: istore_2 5: iload_2 6: bipush 10 8: if_icmpge 36 11:

Name Id Pairs

name id pairs 对于 OS 来说,id 更重要。 symbolic name(human readable name) number name(low level name) service name port user name user id process name process id host name ip address file name inode number signal name signal number syscall name syscall number

Java Aqs

abstract queued synchronizer 是啥? AQS is an abstract class that provides a skeleton for managing thread contention, queuing, and state synchronization. It uses a FIFO wait(sync) queue to manage threads waiting for access to a shared resource and an atomic integer (state) to track the synchronizer’s status (e.g., locked/unlocked, available permits). AQS 数据结构 /** * Head of the wait queue, lazily initialized. Except for *

Java User Space Schedule

A user-space scheduler manages tasks or “threads” entirely within an application, without relying on the operating system (OS) scheduler. This is different from kernel-level scheduling, where the OS manages threads. 什么是用户态调度?可以简单理解为自定义一堆任务, 由用户决定怎样执行这些任务。不涉

Learn Llm

pre-training https://huggingface.co/spaces/HuggingFaceFW/blogpost-fineweb-v1 100000 symbols(tokens) raw text —>tokenization —> token tokenization https://tiktokenizer.vercel.app/?model=cl100k_base statistic token simulator 这就是所谓的 prediction 参数 各个 token 的权重 模型有大量的知识,存储在上亿的参数之中。这些参数可以视为对超大规模的知识进行的一种