Locking in the OS Kernel for SMP Systems (4.2 Performance Penalty of Lock Operations)

2307阅读 0评论2011-12-30 Heartwork
分类:LINUX

4.2 锁操作的性能损失
    图1显示了在一个包含8个1.45GHz CPU的PPC系统的几种典型操作所消耗的时间。正常指令执行、高速缓存命中的内存访问(cache-hitting memory access,这里没有列出,他们一般比原子自增操作快3-4倍)和锁操作之间的差距是显而易见的(译注:指三种操作消耗的时间差距很大)。
    让我们看看当前的SMP系统的体系结构和它对于自旋锁的影响。
    (译注:图1中一个时钟周期大概是指令消耗时间的三倍,文章注脚给出的解释:If you wonder why and instruction takes less time than a CPU cycle, remember that we are looking at a 8-CPU SMP system, and view these numbers as "typical instruction cost".个人认为这种说法值得商榷,如果是因为CPU个数的话,应该是8倍才对,个人猜测可能与指令流水线有关)
上一篇:Locking in the OS Kernel for SMP Systems (4.1 Scalability)
下一篇:Locking in the OS Kernel for SMP Systems (4.2.1 Cache)