原创 理解 C++ 的 Memory Order

爲什麼需要 Memory Order 如果不使用任何同步機制(例如 mutex 或 atomic),在多線程中讀寫同一個變量,那麼,程序的結果是難以預料的。簡單來說,編譯器以及 CPU 的一些行爲,會影響到程序的執行結果: 即使

原创 ubunt必備

開發必備編譯環境 # 編譯環境 sudo apt-get install build-essential make automake autoconf libtool-bin sudo apt-get install git

原创 GCC靜態鏈接庫與動態鏈接庫的構建過程

本練習採用下面四個C文件, addvec.c multvec.c 和 vector.h 是庫文件, main2.c是引用庫函數的文件 /* vector.h */ /* prototypes for libvector */

原创 Linux-based Futex Locks

void mutex_lock (int *mutex) { int v; /* Bit 31 was clear, we got the mutex (the fastpath) */ if (atomic_bit_

原创 Install samba on Ubuntu

1 Overview A Samba file server enables file sharing across different operating systems over a network. It lets you

原创 【學習xv6】從實模式到保護模式

前言 這是一系列 xv6 代碼學習的總結。對於還不知道 xv6 是什麼的同學,我這裏只簡單說一下:xv6 是一個教學用的操作系統,基於 unix v6,再具體的請大家自行 Google 一下 wiki 什麼的。 配合這個系列的文章,我在我

原创 HTTP 緩存

轉: https://developers.google.com/web/fundamentals/performance/optimizing-content-efficiency/http-caching 通過網絡提取內容既速度緩慢又

原创 關於Linux內核,推薦的8本書籍

推薦幾本高質量的Linux內核的書籍。 第一本,《Linux內核設計與實現》,基於Linux 2.6內核介紹了Linux內核的設計與實現,涵蓋了從核心內核系統的應用到內核設計與實現等各方面內容,主要內容包括:進程管理、調度、時間管理和定時

原创 GCC靜態編譯與動態編譯

靜態鏈接編譯 # create a static library libvector.a gcc -c addvec.c multvec.c ar rcs libvector.a addvec.o multvec.o # bu

原创 C語言備忘錄

C語言itoa()函數和atoi()函數詳解(整數轉字符C實現) C語言提供了幾個標準庫函數,可以將任意類型(整型、長整型、浮點型等)的數字轉換爲字符串。 1.int/float to string/array: C語言提供了幾個標準庫函

原创 How to compile and install Linux Kernel 5.4.1 from source code

https://www.cyberciti.biz/tips/compiling-linux-kernel-26.html Compiling a custom kernel has its advantages and disadvan

原创 程序員練級攻略(2018):前端基礎和底層原理

這個是我訂閱 陳皓老師在極客上的專欄《左耳聽風》,我整理出來是爲了自己方便學習,同時也分享給你們一起學習,當然如果有興趣,可以去訂閱,爲了避免廣告嫌疑,我這就不多說了!以下第一人稱是指陳皓老師。 對於前端的學習和提高,我的基本思路是這樣的

原创 7本計算機聖經

1、《計算機程序設計藝術(第1卷)》       《計算機程序設計藝術》系列是公認的計算機科學領域經典之作,深入闡述了程序設計理論,對計算機領域的發展有着極爲深遠的影響。一共有3卷,第 1 卷,講解基本算法;第2卷,全面講解了半數值算法

原创 透過彙編代碼分析C語言的數據對齊(Data Alignment)與參數傳遞

C代碼 #include <stdio.h> typedef struct S { short a; int b; long c; long d; long e; long f; long g; l

原创 How to recover deleted remote branch in Git

Problem You accidentally deleted a branch in your Git repository. Solution Make sure to perform all of this locally