每个程序员心中都有一个朴素的梦想:拥有一台属于自己的“好”电脑。工作两年后的这个 520,我终于如愿以偿,实现了这个小小的心愿。

本来计划是等到 618 再入手,但由于各个平台已经把 618 提前到了 513,而且都有 30 天保价政策,于是我果断下单。

那么,能否一次点亮呢?

Every programmer has a simple dream in mind: owning a “good” computer of their own. On this 520 (May 20th) after two years of working, I finally got my wish and fulfilled this small dream.

I originally planned to wait until the 618 (June 18th) shopping festival, but since various platforms had moved 618 up to 513 with a 30-day price protection policy, I placed the order without hesitation.

So, will it light up on the first try?

结绳记事

什么是 RCU

RCU (Read-Copy-Update) 是一种高效的同步机制,主要用于解决读多写少场景下的并发访问问题。它是 Linux 内核中广泛使用的同步技术,由 Paul McKenney 在 2001 年引入。RCU 允许多个读者无锁并发访问共享数据,同时写者可以并发修改数据,而不会导致数据不一致。

读者

内存状态

指向

通过ptr访问

通过ptr访问

数据对象 v1

全局指针 ptr

读者1

读者2

What is RCU

RCU (Read-Copy-Update) is an efficient synchronization mechanism primarily used to solve concurrency problems in read-heavy, write-light scenarios. It is a synchronization technique widely used in the Linux kernel, introduced by Paul McKenney in 2001. RCU allows multiple readers to access shared data concurrently without locks, while writers can modify the data concurrently without causing data inconsistency.

Readers

Memory State

points to

accesses via ptr

accesses via ptr

Data object v1

Global pointer ptr

Reader 1

Reader 2

C/C++WikiLinuxKernel

思绪回到 2024 年初

Thoughts Back to Early 2024

结绳记事

hexo-blog-encrypt 插件无法加密很多主题的文章目录,我使用的 hexo-theme-yun 也是如此。这篇文章记录了如何解决这个问题。

Demo:

The hexo-blog-encrypt plugin can’t encrypt the table of contents for many themes, and the hexo-theme-yun I use is no exception. This article documents how to solve this problem.

Demo:

阅读更多
Wiki教程GitHubJS

对于博客内容加密这件事,在有后端服务器的情况下,是一件比较简单的事情,但是对于静态博客来说,就比较麻烦了。Hexo 博客里面有个非常著名的加密插件 hexo-blog-encrypt,它的大概原理是在 hexo g 的时候对 HTML 的内容进行加密,然后在输入正确的密码后解密出正确的 HTML 内容。

在插件的 issue 列表里面一个 Won’t fix 的 issue 里面提到一个问题是这个插件解密后导致 Dplayer 播放器显示不出来。

https://github.com/D0n9X1n/hexo-blog-encrypt/issues/190

最后的结论是受限于 Hexo 静态博客的特性,这个问题不会被修复。

Encrypting blog content is a fairly simple task when you have a backend server, but for static blogs it’s much more troublesome. There’s a very famous encryption plugin for Hexo blogs, hexo-blog-encrypt. Its rough principle: it encrypts the HTML content during hexo g, then decrypts it to reveal the correct HTML after the correct password is entered.

In the plugin’s issue tracker, a Won’t fix issue mentions that after decryption, the Dplayer player fails to display.

https://github.com/D0n9X1n/hexo-blog-encrypt/issues/190

The final conclusion was that, due to the nature of Hexo static blogs, this issue will not be fixed.

阅读更多
Wiki教程GitHubJS

本文编写一个简单的 Linux 内核模块,然后在 QEMU 中使用 insmod 加载模块, lsmod 查看模块信息, rmmod 卸载模块来进行测试工作。

实验环境在前文Linux Kernel 从编译到运行为 Linux Kernel 添加系统调用 中已经准备好了,这里不再赘述。

编译模块的工作流程如下:

  1. 环境准备

  2. 编写模块代码

  3. 编写 Makefile

  4. 编译模块

  5. 加载、卸载测试

This article writes a simple Linux kernel module, then tests it in QEMU by loading it with insmod, checking its info with lsmod, and unloading it with rmmod.

The experimental environment was already prepared in Linux Kernel: From Compilation to Running and Adding a System Call to the Linux Kernel, so I won’t repeat it here.

The module compilation workflow is as follows:

  1. Environment preparation

  2. Writing the module code

  3. Writing the Makefile

  4. Compiling the module

  5. Load/unload testing

WikiLinux教程Kernel