
无锁编程
文章平均质量分 90
无锁编程是多核多处理器时代编程的新模式,主要针对锁引起的各种问题。本栏目致力于收集无锁编程的方案,并提出新的思路。
sahusoft
Coding4Fun
展开
-
无锁编程介绍
H2 { margin-bottom: 0.21cm; }H2.western { font-family: "DejaVu Sans",sans-serif; font-size: 12pt; font-style: normal; }H2.cjk { font-family: "DejaVu Sans"; font-size: 12pt; }H2.ctl { font-family: "Loh翻译 2013-06-30 23:14:18 · 6234 阅读 · 0 评论 -
无锁编程:最简单例子
场景 假设存在这样一个情况:需要N个线程对一个全局的变量进行M次递增操作。首先想到的常常是,使用互斥量。当然在“无锁”的世界里,还有其它实现方式。话不多说,看代码:测试代码gcc_sync_test.c#include #include #include #define TEST_ROUND 20000#define THREAD_NUM 10#define SYNC#d原创 2013-06-20 21:46:45 · 3217 阅读 · 0 评论 -
GCC内建原子操作
参见:http://gcc.gnu.org/onlinedocs/gcc/_005f_005fsync-Builtins.htmlThe following built-in functionsare intended to be compatible with those describedin the Intel Itanium Processor-specific Application B原创 2013-06-05 21:44:14 · 2552 阅读 · 0 评论