Jiajun Yao

Stay hungry, Stay foolish.

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.

Jonathan Lee

我说我喜欢你的歌,我不知道这算不算是一件好事。 我说我喜欢你的词,总是道出我心中不欲人知的事。

What I Have Learned From CMU CS Education


What I Have Learned From Writing a Kernel From Scratch

Last semester, I took the course 15410 and wrote a kernel from scratch with my partner. I learned a lot from this course and the kernel project. Following is what I have learned:

  1. Never Failed Functions
  2. Comment on Why
  3. Synchronization
  4. Error Handling
  5. Why Writing a Kernel From Scratch
  6. Misc.

Which Intent Will You Get After Android Relaunches the Activity

Imagine that you launch a singleTop activity using intent A and then launch it again using intent B. As a result, activity’s onNewIntent method is called and inside this method you call setIntent to store the new intent. After that, Android decides to relaunch the activity. Now we have the question: which intent will you get after Android relaunches the activity? The original one(A) or the latest one(B)?