- 博客(10)
- 收藏
- 关注
Ramer–Douglas–Peucker algorithm
The purpose of the algorithm is, given a curve composed of line segments, to find a similar curve with fewer points. The algorithm defines 'dissimilar' based on the maximum distance between the orig...
2011-05-05 22:55:11
312
原创 compile time assert
compile time assert: #define UNIQUE(x) __unique_name##x#define STATIC_ASSERT(expr) typedef char UNIQUE(__LINE__)[(expr)?1:-1];
2011-05-05 18:14:10
255
原创 false sharing in cache coherence protocols.
False sharing is an inherent artifact of cache coherence protocols (like MESI and MOESI). It happens when two participants (threads) operates on different part of the same cache-line. See http://en.wi...
2011-05-05 18:13:20
145
#pragma GCC poison
#pragma GCC poison Remove the specified identifier(s) from the program (and forbid them from appearing).See http://gcc.gnu.org/onlinedocs/gcc-3.2.3/cpp/Pragmas.html for more information.
2011-05-05 18:11:26
192
Function Names as Strings
__func__, __FUNCTION__, __PRETTY_FUNCTION__In C++, __PRETTY_FUNCTION__ contains the type signature of the function.See http://gcc.gnu.org/onlinedocs/gcc-4.5.2/gcc/Function-Names.html for more info...
2011-05-05 18:08:26
107
pthread_cond_wait will relock the mutex
Quoting APUE2: The mutex passed to pthread_cond_wait protects the condition. The caller passes it locked to the function, which then atomically places the calling thread on the list of threads...
2011-05-05 18:04:57
96
restore deleted while unclosed file
场景:不小心删除了某文件,但该文件之前被某进程(譬如一个daemon)打开尚未关闭。注:文件删除是在打开的fd都关闭以后发生的,即,unlink一个文件以后,如果inode的引用计数降到0,这个文件应该被删除,但如果还有进程打开了这个文件且尚未关闭(即打开计数不为0),那么文件将在最后一个打开该文件的进程关闭该文件的fd以后删除。这也是为什么会有install这种命令的缘故。inst...
2011-05-05 18:02:17
95
原创 ESSIV
Encrypted Salt-Sector Initialization Vector,自Linux Kernel 2.6.10引入的接口,用于产生安全的iv,公式如下:IV(sector) = Es(sector), where s = hash(key) 参见wiki的页面http://en.wikipedia.org/wiki/Disk_encryption_theory#...
2011-05-04 16:46:09
224
原创 XTS-AES
AES加密算法, 不说了。block cipher的各种工作模式,ECB、CBC、Counter等,不说了。 Cipher在用作disk encryption的时候,也有许多问题要考虑。主要是ECB模式不行(很明显),CBC模式也不好(无法随机访问),所以IEEE标准化了一个P1619标准,IEEE Standard for Cryptographic Protection of...
2011-05-04 16:44:24
1627
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人