Chinaunix首页 | 论坛 | 博客
  • 博客访问: 680704
  • 博文数量: 192
  • 博客积分: 1875
  • 博客等级: 上尉
  • 技术积分: 2177
  • 用 户 组: 普通用户
  • 注册时间: 2010-10-23 23:21
个人简介

有时候,就是想窥视一下不知道的东东,因为好奇!

文章分类

全部博文(192)

文章存档

2024年(8)

2023年(3)

2020年(1)

2019年(1)

2018年(1)

2017年(2)

2016年(69)

2015年(53)

2014年(14)

2013年(1)

2012年(5)

2011年(25)

2010年(9)

分类: LINUX

2011-02-22 23:01:02

p { margin-bottom: 0.21cm; }

-拷贝-更新(Read-Copy Update)

1.-拷贝-更新(Read-Copy Update)

     使用RCU保护的共享数据,读操作不需要获得任何锁就可以访问,不使用原子操作。写操作在访问前需要先复制一份副本,然后对副本进行修改,最后使用一个回调机制,在适当的时机把指向原来数据的指针重新指向新的被修改的数据。RCU可以看做读写锁的高性能版本。

2.linux内核中的RCU操作

读锁定

rcu_read_lock()

rcu_read_lock_bh()

读解锁

rcu_read_unlock()

rcu_read_unlock_bh()

同步RCU(由写操作使用)

synchronize_rcu()

挂接回调

call_rcu(struct rcu_head *head, void (*func)(struct rcu_head *rcu))

call_rcu_bh(struct rcu_head *head, void (*func)(struct rcu_head *rcu))

链表操作RCU

list_add_rcu(struct list_head *new, struct list_head *head)

list_add_tail_rcu(struct list_head *new, struct list_head *head)

list_del_rcu(struct list_head *entry)

list_replace_tail_rcu(struct list_head *old, struct list_head *new)

list_for_each_rcu(pos, head)

list_for_each_safe_rcu(pos, n, head)

list_for_each_entry_rcu(pos, head, member)


hlist_del_rcu(struct hlist_node *n)

hlist_add_head_rcu(struct hlist_node *n, struct hlist_head *h)

hlist_for_each_rcu(pos, head)

hlist_for_each_entry_rcu(tpos, pos, head, member)

阅读(5029) | 评论(0) | 转发(0) |
1

上一篇:顺序锁

下一篇:completion

给主人留下些什么吧!~~