Linux内核同步,进程,线程同步
包括我自己在内,很多人对内核,进程,线程同步都不是很清楚,下面稍微总结一下:
内核同步:
主要是防止多核处理器同时访问修改某段代码,或者在对设备驱动程序进行临界区保护。主要有一下几种方式:
1. Mutex(互斥)
头文件:
#include <linux/mutex.h>
初始化方法:
DEFINE_MUTEX(name);或者
void mutex_init(struct mutex *lock);
使用方法:
void mutex_lock (struct mutex *lock);
Tries to lock the mutex, sleeps otherwise.
Caution: can't be interrupted, resulting in processes you cannot kill!
int mutex_lock_interruptible (struct mutex *lock);
Same, but can be interrupted. If interrupted, returns a non zero value and doesn't hold the lock. Test the return value!!!
int mutex_trylock (struct mutex *lock);
Never waits. Returns a non zero value if the mutex is not available.int mutex_is_locked(struct mutex *lock);Just tells whether the mutex is locked or not.
void mutex_unlock (struct mutex *lock);
Releases the lock. Make sure you do it as quickly as possible!
2. Reader/writer semphopres 读写信号量
Allow shared access by unlimited readers, or by only 1 writer. Writers get priority.
允许有限数量的读访问,但是只能有一个写访问。
void init_rwsem (struct rw_semaphore *sem);
void down_read (struct rw_semaphore *sem);
int down_read_trylock (struct rw_semaphore *sem);
int up_read (struct rw_semaphore *sem);
void down_write (struct rw_semaphore *sem);
相关文档:
1. HCI层协议概述:
HCI提供一套统一的方法来访问Bluetooth底层。如图所示:
从图上可以看出,Host Controller Interface(HCI) 就是用来沟通Host和Module。Host通常就是PC, Module则是以各种物理连接形式(USB,serial,pc-card等)连接到PC上的bluetooth Dongle。
在Host这一端:application,SDP,L2cap等协议 ......
最近装了fedora9,由于显示问题很大,又退回了f8.然后在f9安装时对文件的备份分区加了密,结果导致我不能恢复备份文件了,那个郁闷阿,一挂载
加密分区就提示我"mount: unknown filesystem type
'crypt_LUKS'",网上找了半天才找到解决办法,顺带也了解了linux对数据保护的强大
这里就对如何使用linux保护
硬盘里的 ......
linux目录架构
/ 根目录
/bin 常用的命令 binary file 的目錄
/boot 存放系统启动时必须读取的档案,包括核心 (kernel) 在内
/boot/grub/menu.lst GRUB设置
/boot/vmlinuz 内核
&nbs ......
前 言
“Linux?它比Windows更好吗?我能用它打魔兽吗?”
“咳!别提了,它操作起来特别麻烦,你得不停地敲击键盘。没准它还会趁你不注意的时候在你的手指头上咬一口呢!”
或许你也有类似的想法。但无论人们对Linux有怎样的误解,至少我不再像前些年那样频繁地回答“Linux ......
赛门铁克推出新版BackupExec System Recovery 2010(BERS 2010),支持Linux系统数据备份还原功能,并提供免费BERS Management Solution 2010管理工具。
新版BERS 2010可支持微软Exchange、SharePoint、Active
Directory、Windows Server、SQL
Server与VMwareESX虚拟机提供自动化排程的数据备份、还原功能。除更新微软 ......