Jiajun Yao

Stay hungry, Stay foolish.

Nondeterministic Code

Nondeterministic code is hard to debug since bugs are not consistently reproducible. It’s easy to notice that the code is perhaps nondeterministic if multi-threading or random functions are involved. However we can still write nondeterministic single-threaded code without using random functions.

Good Economics for Hard Times

2020,世界很复杂。贸易战,美国大选,全球气候变暖,贫富差距扩大化等热点问题影响着我们每一个人。如果你也对这些问题感兴趣,我推荐你阅读《Good Economics for Hard Times》。这本书可能会带给你一些不同的角度来看待这些问题,有些甚至可能完全颠覆你以往的认知。以下是我的读书笔记:

  1. 移民
  2. 全球化
  3. 偏见
  4. 经济增长
  5. 气候变暖
  6. 贫富差距

Linux PID

In the Linux world, pid means two things. It’s the id of a process from POSIX’s point of view and the id of a task from kernel’s point of view.


Microbenchmark is used to measure the performance of a small piece of code for the purpose of performance optimization. Writing a good microbenchmark is hard and that’s why we should use microbenchmark frameworks (e.g. JMH for Java and Google Benchmark for C++) to help us. This post contains microbenchmarks that I think are interesting.

HugeTLBFS Read Bug

Hit a Linux kernel bug that read() returns wrong data if it crosses a hugepage boundary.