Skip to content

Index

Source Code Study

Version History
Date Description
Oct 16, 2021 Move compilers section to a separate file
Dec 7, 2020 add sanitizers section
Sep 13, 2020 some notes for python; add tcpstat
Jul 26, 2020 Add OpenJDK! Hinted by Hacker News :)
Jun 2, 2020 Add librcu
Apr 26, 2020 Add wayland, X, gnome, gtk etc
Apr 10, 2020 add graphics section
Apr 6, 2020 add verbs perftes
Mar 3, 2020 add FreeBSD, some fpga stuff
Feb 4, 2020 add io_uring, firecracker
Jan 31, 2020 Add some good stuff
Jan 18, 2020 Initial

Beautiful code is art. This page documents all the interesting & practical software/hardware/firmware I came across during my work.

Nutrition

Projects supporting our day-to-day work.

  • GNU glibc: libc, elf, and dynamic linker
    • It is the default C library used by almost everyone
    • It includes ld.so, the dynamic linker
    • I wrote some notes about GOT/PLT and explains what has happend before main() is called.
  • GNU binutils: gas, static linker, and more
    • This repo has a lot commands like as, ld, objdump, nm and so on
    • ld is static linker and I like the magic of its linker script
    • I guess another useful repo is elfutils
  • C Library
    • GNU glibc used by major Linux distributions
    • musl libc is a small libc impl used by Alpine Linux. Clean code.
    • uClibc is a small libc targeting embedded cases
    • bionic is Android’s C library, math library, and dynamic linker
  • [C++ Library]
  • strace
    • System call tracer at userspace
    • I’ve designed one for LegoOS in kernel space
  • Unix Commands
    • Of course almost all other listed repos in this section have some sort of commands. But they are not essential. The following repos have the essential UNIX commands like ls, cat. It’s not possible to go through all of them. But rather, I think they serve as references when we want to know how certain things are implemented (e.g., how dmesg get kernel log).
    • BusyBox
    • GNU Coreutils
    • util-linux
    • FreeBSD and its friends
  • Tools
  • Editors
  • C for life
    • Some small and useful C projects
    • cJSON: A lightweight JSON parser in C.
    • userspace-rcu: A userspace RCU implementation library.
  • Outliers
    • CRIU: Checkpoint and Restore in Userspace
      • The reason I love this repo is because it has so many interesting pieces on how to interact with kernel, save states, and restore them. In addition, it shows how to properly use many less well known syscalls.
    • GRUB2: bootloader
      • Learn how modern bootloader works.
      • Detailed analysis of Linux booting sequence (how it transit from real-mode to protected mode, and finally to 64-bit mode, how to navigate Linux source code etc.)
    • FFmpeg
      • FFmpeg project is famous for its clean and neat C code.
      • Besides, this project is used by a lot online video service companies
    • io uring

Operating Systems

See here.

Network

  • iperf3 is a TCP, UDP, and SCTP network bandwidth measurement tool
  • tcpdump
  • iputils (arping, ping, etc)
  • scapy: Python-based interactive packet manipulation program & library. Very neat
  • tcpstat: C-based simple tool that could dump network traffic. Seems using pcap interface, the one used by tcpdump?
  • Also checkout FreeBSD as it has tools like ifconfig, if.
  • OpenSSH is our ssh!
  • OpenSSL

Virtualization

Also see: http://lastweek.io/notes/source_code/virt/.

Compilers

See here.

Bootloader and Firmware

See here.

The open-source firmware landscape: 20200506-on-firmware-landscape.png

FPGA

Web Servers

Key Value Stores

Point of interests: 1) in-memory, and can it extend to use disk/ssd? 2) persistence support 3) network support

Databases

RDMA and More

See here

Graphics

More here

  • X Server and Wayland
    • X is being replaced by Wayland now..
    • Wayland code seems clean
  • xvnc
    • xvnc and its friends, are sitting on top of display manager (i.e., X/Wayland). They are clients of X/Wayland, but they act as X/Wayland servers for upper layer application such as GTK/Qt.
    • It’s a middleman, bringing network between X and GTK.
    • TigerVNC, TurboVNC and so on.
  • GNOME Shell and GTK
    • GTK’s default backend is X.
    • GNOME shell is a layer on top of GTK+. Similar for KDE/Qt.
  • xRDP, an RDP server. In C
  • FreeRDP, client and server. In C
    • Took a brief read of the code, it’s super neat. Should take a serious look sometime.
  • Vulkan/OpenCL
  • Proton

The landscape: 20200501-on-graphic-softwares-img3.png 20200501-on-graphic-softwares-img3.png

Sanitizers

There are many tools in both user and kernel space helping programmers identify various issues early on. Those issues including memory safty issue, threading issue, and others.

Personally I have not used these tools a lot. But I am very interested in them. I think they could greatly improve productivity.

TODO: https://github.com/google/sanitizers


Last update: October 16, 2021

Comments

Back to top