文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>Linux Concurrency and race conditions

Linux Concurrency and race conditions

时间:2007-07-01  来源:jack_zheng

  1. sources of concurrency(race conditions)
  • multiple user-space processes
  • SMP
  • preempible kernel code
  • device interrupts
  • delayed code execution mechanism, such as workqueues, taksklets and timers.
  • hot-pluugable

2. Semaphores

Semaphores are used for mutual exlusion. can be used  when slepps are a possibility.

==> Reader/Writer Semaphores

3. Spinlocks

Spinlocks may be used in code that cannot sleep. Performance is higher than semaphores when properly used.

  • Any time kernel code holds a spinlock, preemption is disable on the relevant processor.
  • Disable interrupts while spinlock is held.
  • spinlock mus always be held for the minimum time possible.

==> Reader/Writer spinlocks

 

4. Alternatives to Locking

1) Lock free algorithms

circular buffer

2) Atomic variables

you should not count on an atomic_t holding more than 24 bits.

3) Bit Operations

4) seqlock

5) read-copy-update

 

ldd3-ch5

 

     
相关阅读 更多 +
排行榜 更多 +
一剑灭天

一剑灭天

角色扮演 下载
戮仙战纪

戮仙战纪

角色扮演 下载
头号海贼王手机版

头号海贼王手机版

棋牌卡牌 下载