Linux Kernel API (2.6)
#protect share data
spin_lock/spin_unlock: protect the data during process context(and only at process context), and make sure your code bewteen lock/unlock is fast enough.There may deadlock if the same spin_lock is called at interrupt context.
spin_lock_irq/spin_unlock_irq: call it during interrupt context, make sure the irq is on before calling this function, it will disable irq before accessing share data
spin_lock_irqsave/irqrestore: use at interrupt context, and will save/restort irq registers
The code between spin_lock**/spin_unlock** must not sleep.
The spin_lock** API is defined at include/linux/spinlock_api_up.h for UP architecture.
linux/kernel/spinlock.c is only for SMP.
mutex_lock/mutex_unlock: the similar with down/up, but more efficient
mutex_lock_interruptible: the simlilar with down_interruptiable, can be interruptiable by signal.(like CTRL-C)
the code beween mutex_lock and mutex_unlock can go to sleep
相关文档:
至此落笔之际,恰至Linux问世18周年,18年的成长,如梦似幻,风雨颇多,感慨颇多。
犹自忆起多年以前一位前辈训导时的箴言:今天的必然正是由之前一系列的偶然所决定的。过去的某年某月,我偶然初识Linux就身陷其中,至今仍找不到出去的路,而正是这次乃至之后的多次偶然相联合,从而决定了今日的我要在此写下这些话。那么 ......
现象:用SSH软件连接时,中文是乱码
解决:
修改/etc/sysconfig/i18n文件,将其改成以下内容:
LANG="zh_CN.GB18030"
LANGUAGE="zh_CN.GB18030:zh_CN.GB2312:zh_CN"
SUPPORTED="zh_CN.UTF-8:zh_CN:zh:en_US.UTF-8:en_US:en"
SYSFONT="latarcyrheb-sun16" ......
在Linux中使用电驴是一件非常容易的事情,下面以Fedora6为例介绍安装使用步骤.
安装
--在安装之前请先确认,自己的系统中是否安装了wxGTK
这个包:
--使用系统自带的源即可安装
# yum install wxGTK
--下载aMule并安装(此处安装的是Fedorazod版本)
& ......
I learned some experience while Nanjing found 0x03 error. At begining, we don't know why our GSRM(a linux process) hang in a short time 5 seconds sometimes. It didn't handle any message at that time and the interruption is not regularly. So we assume we have Linux OS problem. We did following checks ......
最近在研究 Linux 内核的时间子系统,为下一篇长文《服务器程序中的日期与时间》做准备,无意中注意到了 Linux 新增的几个系统调用的对编写服务器代码的影响,先大致记录在这里。这篇博客也可算作前一篇《多线程服务器的常用编程模型》的一个注脚。 1. 服务器程序的风格可能在变 新的创建文件描述符的 syscall 一般都支持 ......