C++ and Singleton

在单线程模式下,最简单的办法就是只能通过一个method获取instance,在第一次access的时候建立instance

Read More

rabbit hole of rpath and origin

a little background on dynamic linking

the job of dynamic linker and loader(ld.so) is to resolve the executable’s dependencies on shared libraries and to load the required ones at run-time. readelf .bin to find the NEDDED headers and search the DSO with a matching SONAME

Read More

大话 design pattern

What’s design pattern? > a design pattern is a general reusable solution to a commonly occurring problem within a given context in software design

Read More

Make and CMake in a nutshell

GNU make is a functional language, it got combinators(map | filter), application and anonymous abstractions. it suppress the number of rules from * to just +

Read More

How to make a debugger

When we debug, we want to forgot about all security issue, and just want to peek the state of running applicaion. well, first thing not to do is to put debugger and debuggie to same memory space:) so they have to in different process.

Read More

How to make a chat app

XMPP

tldr It is a IM protocol that use XML, it is decentialized, and XML itself contain rounting info, and it is the server that doing all the heavy work :P

Read More

Linux Graphic Stack and Wayland

3D rendering with OpenGL

  • A library, “Mesa”, implements the OpenGL API. It uses card-specific drivers to translate the API into a hardware-specific form. If the driver uses Gallium internally, there’s a shared component that turns the OpenGL API into a common intermediate representation, TGSI. The API is passed through Gallium, and all the device-specific driver does is translate from TGSI into hardware commands,
  • libdrm uses special secret card-specific ioctls to talk to the Linux kernel
  • The Linux kernel, having special permissions, can allocate memory on and for the card.
  • Back out at the Mesa level, Mesa uses DRI2 to talk to Xorg to make sure that buffer flips and window positions, etc. are synchronized.
Read More